/* ========================
   INNER PAGES DESIGN SYSTEM
   css/inner.css — loaded after css/style.css on all inner pages
   ======================== */

/* ── 1. Color Variables ── */
:root {
  --text:        #625445;
  --text-light:  #9a8978;
  --text-dark:   #4f4337;
  --text-num:    #d4c8b9;
  --border:      rgba(95, 81, 67, 0.10);
  --border-soft: rgba(95, 81, 67, 0.06);
  --tag-bg:      rgba(147, 166, 109, 0.14);
  --tag-text:    #657446;
  --nav-text:    #a49382;
  --nav-active:  #4f4337;
  --card-bg:     #f7f2ea;
  --paper-soft:  rgba(245, 240, 232, 0.54);
  --grass:       #93a66d;
  --grass-soft:  rgba(147, 166, 109, 0.16);
  --footer-text: #fffaf0;
  --modal-bg:    #f7f2ea;
  --modal-border: rgba(95, 81, 67, 0.10);
  --modal-overlay: rgba(43, 49, 32, 0.28);
}

/* ── 2. Navbar ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 232, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.navbar {
  padding: 20px 32px;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--nav-text);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--nav-active);
}

/* ── 3. Faction Name & Quote ── */
.faction-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Noto Serif SC", serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: 0.02em;
}

.faction-icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.faction-quote-mark {
  position: absolute;
  left: 10px;
  top: -8px;
  font-family: "Cormorant Garamond", serif;
  font-size: 40px;
  line-height: 1;
  color: rgba(95, 81, 67, 0.13);
  pointer-events: none;
}

.faction-character-quote::after {
  content: '\201D';
  font-family: "Cormorant Garamond", serif;
  font-size: 40px;
  line-height: 1;
  color: rgba(95, 81, 67, 0.13);
  display: block;
  text-align: right;
  margin-top: -8px;
  pointer-events: none;
}

/* ── 4. Tags ── */
.skill-tag {
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: none;
  letter-spacing: 0.04em;
  font-weight: 400;
}

/* ── 5. Article Number ── */
.article-number {
  color: var(--text-num);
}

/* ── 6. Article block separator — remove old border, replaced by grass HTML ── */
.article-block + .article-block {
  border-top: none;
}

/* ── 7. Grass Blade base ── */
.grass-blade {
  display: inline-block;
  width: 3px;
  background: var(--grass);
  border-radius: 1px 1px 0 0;
  transform-origin: bottom center;
}

/* Shared blade variations (1–18 covers both short and long) */
.grass-blade:nth-child(1)  { height: 12px; transform: rotate(-8deg);   opacity: 0.55; }
.grass-blade:nth-child(2)  { height: 16px; transform: rotate(-3deg);   opacity: 0.72; }
.grass-blade:nth-child(3)  { height: 9px;  transform: rotate(4deg);    opacity: 0.48; }
.grass-blade:nth-child(4)  { height: 14px; transform: rotate(-6deg);   opacity: 0.65; }
.grass-blade:nth-child(5)  { height: 11px; transform: rotate(2deg);    opacity: 0.78; }
.grass-blade:nth-child(6)  { height: 16px; transform: rotate(-10deg);  opacity: 0.60; }
.grass-blade:nth-child(7)  { height: 13px; transform: rotate(5deg);    opacity: 0.50; }
.grass-blade:nth-child(8)  { height: 15px; transform: rotate(-2deg);   opacity: 0.80; }
.grass-blade:nth-child(9)  { height: 10px; transform: rotate(6deg);    opacity: 0.45; }
.grass-blade:nth-child(10) { height: 14px; transform: rotate(-7deg);   opacity: 0.68; }
.grass-blade:nth-child(11) { height: 12px; transform: rotate(3deg);    opacity: 0.55; }
.grass-blade:nth-child(12) { height: 16px; transform: rotate(-4deg);   opacity: 0.75; }
.grass-blade:nth-child(13) { height: 9px;  transform: rotate(1deg);    opacity: 0.50; }
.grass-blade:nth-child(14) { height: 13px; transform: rotate(-9deg);   opacity: 0.62; }
.grass-blade:nth-child(15) { height: 15px; transform: rotate(3deg);    opacity: 0.70; }
.grass-blade:nth-child(16) { height: 11px; transform: rotate(-5deg);   opacity: 0.58; }
.grass-blade:nth-child(17) { height: 14px; transform: rotate(6deg);    opacity: 0.50; }
.grass-blade:nth-child(18) { height: 10px; transform: rotate(-2deg);   opacity: 0.75; }

/* ── 8. Grass Divider — Short (5–7 blades, ~40px wide) ── */
.grass-divider-short {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 18px;
  gap: 4px;
  margin: 16px auto;
}

/* ── 9. Grass Divider — Long (18 blades, ~120px wide) ── */
.grass-divider-long {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 18px;
  gap: 4px;
  margin: 32px auto;
}

/* Grass dividers are special pauses between major sections or work groups.
   Ordinary content separation should use spacing, soft rules, or heading hierarchy. */

/* ── 10. Faction overview image ── */
.faction-overview-image-block {
  width: 100%;
  max-width: 720px;
  margin: 48px 0 64px;
}

.faction-overview-image-block + .faction-card {
  margin-top: 0;
}

.faction-overview-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* ── 11. Worldbuilding diagrams ── */
.worldbuilding-section .diagram-block:has(+ .diagram-block) {
  margin-bottom: 72px;
}

.worldbuilding-section .diagram-block:has(+ .highlights-section) {
  margin-bottom: 56px;
}

.worldbuilding-section .diagram-block + .highlights-section {
  margin-top: 0;
}

.worldbuilding-section .diagram-block + .highlights-section .highlights-intro {
  margin-top: 0;
}

.worldbuilding-section .diagram-caption {
  margin-bottom: 28px;
}

.worldbuilding-section .worldbuilding-poi-flow .diagram-img + .diagram-img {
  margin-top: 24px;
}

.related-work-note {
  max-width: 600px;
  margin-top: 40px;
  padding: 16px 0 16px 20px;
  border-left: 2px solid var(--grass-soft, rgba(147, 166, 109, 0.16));
  background: linear-gradient(90deg, var(--paper-soft, rgba(245, 240, 232, 0.54)), rgba(255, 255, 255, 0));
  color: var(--text-light);
}

.related-work-note p {
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 2;
}

/* ── 12. Diagram image lightbox ── */
body.lightbox-open {
  overflow: hidden;
}

.diagram-block img.diagram-img.diagram-img-zoomable {
  cursor: zoom-in;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 40px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.image-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 31, 27, 0.72);
}

.image-lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(92vw, 1440px);
  max-height: 92vh;
  margin: 0;
}

.image-lightbox-img {
  display: block;
  max-width: min(92vw, 1440px);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-out;
  box-shadow: 0 18px 52px rgba(18, 15, 12, 0.22);
}

.image-lightbox-caption {
  max-width: min(92vw, 920px);
  margin-top: 14px;
  color: rgba(255, 250, 240, 0.72);
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.image-lightbox-caption[hidden] {
  display: none;
}

.image-lightbox-close {
  position: fixed;
  z-index: 2;
  top: 22px;
  right: 24px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 250, 240, 0.24);
  border-radius: 50%;
  background: rgba(245, 240, 232, 0.10);
  color: rgba(255, 250, 240, 0.86);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.image-lightbox-close:hover,
.image-lightbox-close:focus-visible {
  background: rgba(245, 240, 232, 0.18);
  border-color: rgba(255, 250, 240, 0.46);
  transform: translateY(-1px);
  outline: none;
}

/* ── 13. Section padding ── */
.about-section {
  padding-bottom: 104px;
}

.work-section,
.contact-section {
  padding-bottom: 40px;
}

.method-notes-section,
.narrative-section,
.worldbuilding-section,
.faction-section,
.creative-section {
  padding-bottom: 40px;
}

@media (max-width: 768px) {
  .about-section {
    padding-bottom: 76px;
  }

  .worldbuilding-section .diagram-block:has(+ .diagram-block),
  .worldbuilding-section .diagram-block:has(+ .highlights-section) {
    margin-bottom: 48px;
  }

  .worldbuilding-section .diagram-caption {
    margin-bottom: 24px;
  }

  .worldbuilding-section .worldbuilding-poi-flow .diagram-img + .diagram-img {
    margin-top: 20px;
  }

  .image-lightbox {
    padding: 22px;
  }

  .image-lightbox-content,
  .image-lightbox-img {
    max-width: 94vw;
  }

  .image-lightbox-img {
    max-height: 80vh;
  }

  .image-lightbox-caption {
    max-width: 90vw;
    margin-top: 10px;
  }

  .image-lightbox-close {
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
  }
}

/* ── 14. Footer ── */
.site-footer {
  position: relative;
  margin: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
  flex-shrink: 0;
  overflow: hidden;
}

.site-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      to bottom,
      rgba(46, 50, 26, 0.02),
      rgba(46, 50, 26, 0.18)
    );
}

.footer-img {
  width: 100%;
  height: 62px;
  object-fit: cover;
  display: block;
}

.footer-slogan,
.footer-email {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92%, 720px);
  color: var(--footer-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: normal;
  font-family: "Noto Sans SC", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  text-shadow: 0 1px 8px rgba(34, 41, 20, 0.42);
}

/* ── Cards Modal: Tarot Deck Layout (creative-lab.html) ── */

.cards-modal {
  max-width: 960px;
  width: 90vw;
}

/* overflow: visible so hover-elevated cards aren't clipped by the original overflow-y: auto */
.cards-grid-view {
  overflow: visible;
  padding-top: 0;
}

.cards-grid {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  padding: 48px 60px 40px;
  overflow: visible;
}

.card-item {
  width: 120px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

/* 120px × 30% = 36px overlap */
.card-item + .card-item {
  margin-left: -36px;
}

.card-item:hover {
  transform: translateY(-24px);
  z-index: 10;
}

.card-name {
  white-space: nowrap;
  overflow: visible;
  text-align: center;
}

/* ── Card selection animation ── */

/* Other cards fade out while one is being chosen */
.card-item.card-fading {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

/* Selected card: smooth move + scale to centre */
.card-item.card-selected {
  z-index: 20;
  transition: transform 0.4s ease;
}

/* Selected card fades out before detail view appears */
.card-item.card-exit {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* During animation: block all card interactions and suppress hover lift */
.cards-grid.cards-animating .card-item {
  pointer-events: none;
}

.cards-grid.cards-animating .card-item:hover {
  transform: none;
}

.card-thumb-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.card-detail-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .footer-img {
    height: 64px;
  }

  .footer-slogan,
  .footer-email {
    width: min(88%, 420px);
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  /* Mobile: 2 rows (5 + 4), no hover */
  .cards-grid {
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px 0;
    padding: 32px 20px 24px;
  }

  .card-item {
    width: 80px;
  }

  .card-item + .card-item {
    margin-left: -24px;
  }

  /* Row 2 first card: reset margin so that row centres independently */
  .card-item:nth-child(6) {
    margin-left: 0;
  }

  .card-item:hover {
    transform: none;
  }
}

/* ── Script sample link wrap ── */
.script-sample-link-wrap {
  margin-top: 40px;
}

/* ── Script narration (non-dialogue prose within modal) ── */
.script-narration {
  font-family: "Noto Serif SC", serif;
  font-size: 15px;
  line-height: 2;
  color: var(--text-light);
  margin: 18px 0;
}
