/*
  Theme Name: Yaruohiroba 3rd
  Theme URI: https://www.yaruohiroba.cfbx.jp/blog/
  Author: Yaruohiroba
  Description: やる夫広場テーマ（4th世代リニューアル版）
  Version: 4.0.0
  Text Domain: yaruohiroba-3rd
*/

/* ==========================================================================
   0. VARIABLES
   ========================================================================== */
:root {
  --bg-main: #EEF4F9;
  --bg-card: #FFFFFF;
  --bg-accent: #E3EDF6;
  --bg-header: #4A9DD9;
  --bg-header-dark: #3A85BF;
  --text-primary: #222833;
  --text-secondary: #5A6978;
  --text-tertiary: #8A96A5;
  --text-white: #FFFFFF;
  --text-link: #2E7EB8;
  --border: #D0DCE6;
  --border-light: #E4EBF2;
  --accent: #4A9DD9;
  --accent-dark: #357AAF;
  --accent-light: #E3F0FA;
  --accent-50: #F0F7FD;
  --teal: #2D8B70;
  --teal-light: #E1F5EE;
  --coral: #D85A30;
  --coral-light: #FAECE7;
  --amber: #BA7517;
  --amber-light: #FAEEDA;
  --red: #C0392B;
  --red-light: #FCEBEB;
  --green: #3B8B3B;
  --green-light: #E8F4E8;
  --pink-light: #FBEAF0;
  --font-display: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
  --font-body: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  --radius: 6px;
  --radius-lg: 10px;
  --radius-pill: 100px;
  --shadow: 0 1px 4px rgba(30,50,70,0.07);
  --shadow-hover: 0 3px 10px rgba(30,50,70,0.12);
  --transition: 0.2s ease;
}

/* ==========================================================================
   1. RESET & BASE
   ========================================================================== */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-y: scroll;
}
body {
  font-family: var(--font-body);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-width: 1024px;
}
body.single-post {
  min-width: 1200px;
}
img,svg,video,canvas { display: block; max-width: 100%; height: auto; }
input,button,textarea,select { font: inherit; color: inherit; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
li { list-style: none; }
[hidden] { display: none !important; }

/* ==========================================================================
   2. HEADER
   ========================================================================== */
.site-header { background: var(--bg-header); color: var(--text-white); }

.header-top {
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 24px 14px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
}
.site-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-white);
  text-decoration: none;
  letter-spacing: 0.03em;
}
.site-title:hover { text-decoration: none; opacity: 0.9; }
.site-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  padding-bottom: 3px;
}

/* Nav bar */
.nav-bar {
  background: var(--bg-header-dark);
  border-top: 1px solid rgba(255,255,255,0.15);
}
.nav-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}
.nav-bar a {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  padding: 10px 16px;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav-bar a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
  border-bottom-color: rgba(255,255,255,0.6);
}

/* ==========================================================================
   3. PAGE LAYOUT — 2-column grid
   ========================================================================== */
.tp-wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 48px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}
.tp-sidebar { order: 1; }
.tp-main    { order: 2; min-width: 0; }

/* ==========================================================================
   4. SIDEBAR
   ========================================================================== */
.sb-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.sb-heading {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  background: var(--accent);
  padding: 8px 14px;
}
.sb-body { padding: 14px; }

/* Search */
.sb-search { position: relative; }
.sb-search input {
  width: 100%;
  font-size: 13px;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}
.sb-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.sb-search input::placeholder { color: var(--text-tertiary); }
.sb-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
}

/* Stats */
.stats-list li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border-light);
}
.stats-list li:last-child { border-bottom: none; }
.stats-val { font-weight: 700; color: var(--accent-dark); }

/* Recent comments */
.recent-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.recent-list li:last-child { border-bottom: none; }
.rc-author { font-size: 11px; font-weight: 500; color: var(--accent-dark); }
.rc-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 2px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rc-post a { font-size: 11px; color: var(--text-tertiary); }
.rc-post a:hover { color: var(--accent); }
.rc-time { font-size: 10px; color: var(--text-tertiary); }

/* Recent likes (sidebar) */
.like-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
}
.like-list li:last-child { border-bottom: none; }
.like-icon { color: #E05A6D; font-size: 12px; flex-shrink: 0; margin-top: 2px; }
.like-info {
  flex: 1;
  min-width: 0;
}
.like-info a {
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.like-info a:hover { color: var(--accent); }
.like-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}
.sb-like-count {
  font-size: 11px;
  font-weight: 500;
  color: #E05A6D;
  background: #FBEEF0;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.like-time {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Ad banner placeholder */
.sb-banner {
  background: var(--bg-accent);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px 14px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}
.sb-banner + .sb-banner { margin-top: 12px; }

/* Event banner */
.sb-event {
  background: var(--accent-light);
  border: 1px solid #B8D8F0;
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  text-align: center;
}
.sb-event-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
  margin-bottom: 4px;
}
.sb-event-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
}
.sb-event-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
}
.sb-event-btn:hover { background: var(--accent-dark); text-decoration: none; }

/* Notice box */
.sb-notice {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.sb-notice p + p { margin-top: 8px; }
.sb-notice a { color: var(--text-link); }
.sb-notice a:hover { text-decoration: underline; }

/* Tags (sidebar) */
.sb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sb-tag {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: var(--transition);
}
.sb-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
}

/* ==========================================================================
   5. MAIN CONTENT — Sections
   ========================================================================== */
.section { margin-bottom: 28px; }

.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.sec-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.sec-more {
  font-size: 12px;
  color: var(--text-link);
  font-weight: 500;
}

/* Tag icon colors (shared by accordion + sidebar) */
.gi-fantasy { background: var(--accent-light); }
.gi-modern  { background: var(--green-light); }
.gi-game    { background: var(--amber-light); }
.gi-battle  { background: var(--coral-light); }
.gi-romance { background: var(--pink-light); }
.gi-horror  { background: #ECEAEE; }
.gi-history { background: var(--teal-light); }
.gi-short   { background: var(--amber-light); }

/* Tag accordion */
.sb-body--tight { padding: 0; }

.tag-accordion {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Inside sidebar: no border/shadow on individual groups, use borders between */
.sb-body--tight .tag-group {
  background: var(--bg-card);
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
.sb-body--tight .tag-group:last-child { border-bottom: none; }
.sb-body--tight .tag-group[open] {
  background: var(--accent-50);
}
.sb-body--tight .tag-summary {
  padding: 10px 14px;
  font-size: 13px;
  gap: 8px;
}
.sb-body--tight .tag-summary-icon {
  width: 24px; height: 24px;
  font-size: 11px;
}
.sb-body--tight .work-link {
  padding: 7px 14px;
  font-size: 12px;
}
.sb-body--tight .work-stats {
  padding-right: 14px;
}
.sb-body--tight .work-ep,
.sb-body--tight .work-likes {
  font-size: 10px;
}

/* Standalone (main column) context */
.tp-main .tag-accordion { gap: 8px; }
.tp-main .tag-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tp-main .tag-group[open] {
  border-color: var(--accent);
}
.tag-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  list-style: none;
  user-select: none;
}
.tag-summary::-webkit-details-marker { display: none; }
.tag-summary::marker { content: ''; }
.tag-summary:hover {
  background: var(--accent-50);
}
.tag-summary-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.tag-summary-name {
  flex: 1;
  min-width: 0;
}
.tag-summary-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.tag-summary-arrow {
  width: 18px; height: 18px;
  flex-shrink: 0;
  position: relative;
}
.tag-summary-arrow::before,
.tag-summary-arrow::after {
  content: '';
  position: absolute;
  background: var(--text-tertiary);
  border-radius: 1px;
  transition: transform 0.25s ease;
}
.tag-summary-arrow::before {
  width: 10px; height: 2px;
  top: 8px; left: 4px;
}
.tag-summary-arrow::after {
  width: 2px; height: 10px;
  top: 4px; left: 8px;
}
.tag-group[open] .tag-summary-arrow::after {
  transform: rotate(90deg);
  opacity: 0;
}

/* Work list */
.work-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border-light);
}
.work-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border-bottom: 1px solid var(--border-light);
}
.work-item:last-child { border-bottom: none; }
.work-link {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.5;
  transition: var(--transition);
}
.work-link:hover {
  color: var(--accent);
  background: var(--accent-50);
  text-decoration: none;
}
.work-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-right: 16px;
}
.work-ep {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.work-likes {
  font-size: 11px;
  color: #E05A6D;
  background: #FBEEF0;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Tag group footer */
.tag-group-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  text-align: right;
  background: var(--accent-50);
}
.tag-group-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
.site-footer {
  background: var(--bg-header);
  color: rgba(255,255,255,0.7);
  padding: 20px 24px;
  text-align: center;
}
.footer-inner { max-width: 1600px; margin: 0 auto; }
.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
}
.footer-links a { font-size: 12px; color: rgba(255,255,255,0.75); }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-copy { font-size: 11px; color: rgba(255,255,255,0.5); }

/* ==========================================================================
/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media (max-width: 1280px) {
  .tp-wrap {
    grid-template-columns: 1fr;
    max-width: 900px;
  }
  .tp-main    { order: 1; }
  .tp-sidebar {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .tp-sidebar > * { margin-bottom: 0; }
}

@media (max-width: 860px) {
  .header-top {
    padding: 14px 16px 10px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .tp-wrap { padding: 16px; }
  .tp-sidebar { grid-template-columns: 1fr; }
  .beg-steps { flex-direction: column; }
}

@media (max-width: 520px) {
  .site-title { font-size: 20px; }
  .nav-bar a { font-size: 12px; padding: 8px 12px; }
  .work-stats { gap: 6px; padding-right: 12px; }
}

/* Mobile (is-mobile) — AA表示幅を最大化 */
body.is-mobile .header-top { padding-left: 0; padding-right: 0; max-width: none; }
body.is-mobile .nav-inner { padding-left: 0; padding-right: 0; max-width: none; }
body.is-mobile .tp-wrap {
  padding: 0;
  max-width: none;
  margin: 0;
  gap: 0;
}
body.is-mobile .tp-sidebar { display: none; }
body.is-mobile .single-head { padding-left: 8px; padding-right: 8px; }
body.is-mobile .AA-area { padding: 1rem 0; }
body.is-mobile .ad-block,
body.is-mobile .single-tag-list,
body.is-mobile .like-section,
body.is-mobile .single-nav,
body.is-mobile .related-section,
body.is-mobile .comments-area,
body.is-mobile .widget-area,
body.is-mobile .page-links { padding-left: 8px; padding-right: 8px; }
body.is-mobile .site-footer { padding-left: 0; padding-right: 0; }
body.is-mobile .footer-inner { max-width: none; }

/* ==========================================================================
   9. ANIMATION
   ========================================================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section {
  animation: fadeUp 0.4s ease both;
}
.section:nth-child(1) { animation-delay: 0.05s; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.15s; }
.section:nth-child(4) { animation-delay: 0.2s; }
.section:nth-child(5) { animation-delay: 0.25s; }

/* ==========================================================================
   9a. R18 FILTER TOGGLE
   ========================================================================== */
.sb-r18-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.r18-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.r18-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.r18-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.r18-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
  transition: 0.3s;
}
.r18-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}
.r18-switch input:checked + .r18-slider {
  background: var(--accent);
}
.r18-switch input:checked + .r18-slider::before {
  transform: translateX(18px);
}

/* ==========================================================================
   9b. SIDEBAR WIDGETS
   ========================================================================== */
.tp-sidebar .widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tp-sidebar .widget-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  padding: 8px 14px;
  margin: 0;
}
.tp-sidebar .widget > ul,
.tp-sidebar .widget > div,
.tp-sidebar .widget > p,
.tp-sidebar .widget > form {
  padding: 10px 14px;
  font-size: 13px;
}
.tp-sidebar .widget ul {
  list-style: none;
}
.tp-sidebar .widget li {
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
}
.tp-sidebar .widget li:last-child { border-bottom: none; }
.tp-sidebar .widget a { color: var(--text-primary); }
.tp-sidebar .widget a:hover { color: var(--accent); }

/* ==========================================================================
   9c. STICKY SIDEBAR + FIRST EPISODE LIST
   ========================================================================== */
.sb-sticky {
  position: sticky;
  top: 16px;
}

/* First episode random list */
.first-ep-list {
  list-style: none;
}
.first-ep-item {
  border-bottom: 1px solid var(--border-light);
}
.first-ep-item:last-child { border-bottom: none; }
.first-ep-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.4;
  transition: var(--transition);
}
.first-ep-link:hover {
  background: var(--accent-50);
  color: var(--accent);
  text-decoration: none;
}
.first-ep-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.first-ep-badge {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  line-height: 1.3;
}
.first-ep-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   10. SCROLL TO TOP
   ========================================================================== */
.jump-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background 0.2s;
}
.jump-top.is-visible {
  opacity: 1;
  visibility: visible;
}
.jump-top:hover {
  background: var(--accent-dark);
}
