/* ============================================================
   Forgotten Kittens — site styles (minimal)
   ============================================================

   RESPONSIVE BREAKPOINT MAP
   -------------------------
     mobile  : <  600px   — phones (.social-btn, .jam-item compact)
     small   : <  720px   — phones / very narrow tablets
                            (hero clears the floating lang-switcher,
                             carousel arrows hide and lean on swipe)
     tablet  : <  992px   — tablets and narrow laptops
                            (.featured-card stacks vertically,
                             team grid is 1 column, ≥ 992 → 2 cols)
     desktop : < 1200px   — modal grid stacks (gallery on top of side panel);
                            ≥ 1200 → modal goes 2-column
     wide    : ≥ 1200px   — full multi-column layout everywhere
   ------------------------------------------------------------ */

/* Animatable CSS custom properties for the vertical auto-scroll mask.
   With @property, the browser can interpolate the lengths between keyframes
   instead of snapping discrete values. */
@property --fk-fade-top {
  syntax: '<length>';
  inherits: false;
  initial-value: 0px;
}
@property --fk-fade-bottom {
  syntax: '<length>';
  inherits: false;
  initial-value: 24px;
}

@font-face {
  font-family: 'UpheavalPro';
  src: url('../font/UpheavalPro.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Born2bSporty';
  src: url('../font/Born2bSportyFS.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:           #14110f;
  --bg-elevated:  #1c1815;
  --bg-card:      #221d19;
  --text:         #f0e6d8;
  --text-muted:   #8a7d6c;
  --accent:       #d97a3c;
  --accent-hover: #e8915a;
  --border:       #2a241f;

  --radius:       12px;
  --radius-sm:    8px;

  --font-display: 'UpheavalPro', 'Impact', sans-serif;
  --font-body:    'Born2bSporty', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --max-w: 1440px;
  --gutter: clamp(1rem, 4vw, 2rem);

  /* unified game-card width — single source of truth */
  --card-w: 460px;
  --card-gap: 1.25rem;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 30px;            /* ~1.9x of the typical 16px default — scales all rem */
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  font-size: 1rem;            /* = 22px */
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: normal;
  line-height: 1.05;
  margin: 0 0 0.5em;
  letter-spacing: 0.02em;
}

button { font: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ----------------------- Floating lang switcher ----------------------- */

.lang-switch {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 50;
  display: flex;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  background: rgba(20, 17, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: #1a1310;
}

/* Collapsed state: only the active language is shown (acts as a button).
   Expanded state: all languages are visible. JS toggles .expanded. */
.lang-switch:not(.expanded) button:not([aria-pressed="true"]) {
  display: none;
}

/* ----------------------- Buttons ----------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  transition: transform 0.1s ease, background 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #1a1310;
}
/* Explicit color on :hover so the global `a:hover { color: var(--accent-hover) }`
   rule doesn't win when .btn-primary is applied to an <a> element — without this,
   text turns orange and becomes unreadable on the orange background. */
.btn-primary:hover { background: var(--accent-hover); color: #1a1310; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text); }

/* ----------------------- Section base ----------------------- */

.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(0.25rem, 50%, 0.85rem) var(--gutter);
}
.section-heading {
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  margin-bottom: 0.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.95rem;
  color: var(--accent);
  font-family: var(--font-display);
  margin: 0 0 0.6rem;
}

.prose {
  max-width: 60ch;
  margin: 0;
  color: var(--text);
}

.copy {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 2rem var(--gutter);
  margin: 0;
}

/* ----------------------- Hero ----------------------- */

.hero {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) clamp(1rem, 2vw, 2rem);
  max-width: var(--max-w);
  margin: 0 auto;
}

/* On narrow screens the floating lang switcher in the top-right corner sits
   over the hero. Push the hero down enough to clear it (the switcher pill is
   ~50px tall including its top offset). */
@media (max-width: 720px) {
  .hero {
    padding-top: 4rem;
  }
}

.hero-logo {
  flex: 0 0 auto;
  width: clamp(90px, 14vw, 200px);
  height: auto;
  border-radius: 18px;
}

.hero-text {
  flex: 1 1 0;
  min-width: 0;          /* lets a flex child shrink below its content size */
  overflow: hidden;      /* belt-and-braces with nowrap on children */
}

.hero-title {
  font-size: clamp(2rem, 6vw, 4.5rem);    /* JS may scale this down further to fit one line */
  margin: 0 0 0.15em;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1;
}

.hero-tagline {
  color: var(--text-muted);
  font-size: clamp(0.9rem, 1.6vw, 1.15rem);
  margin: 0;
  line-height: 1.3;
  /* allow wrap, but cap at 2 lines (rest gets cut with ellipsis) */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* ----------------------- Social strip (under hero) ----------------------- */

.social-strip {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.25rem var(--gutter) clamp(1.5rem, 4vw, 3rem);
}

.social-btn {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.social-btn:hover,
.social-btn:focus-visible {
  background: var(--accent);
  color: #1a1310;
  border-color: var(--accent);
  transform: translateY(-2px);
  outline: none;
}
.social-btn svg {
  width: 50%;
  height: 50%;
  display: block;
}

@media (max-width: 600px) {
  .social-btn { width: 54px; height: 54px; }
}

/* ----------------------- Featured ----------------------- */

/* Featured card: background image pinned to the left, gradient fades to the
   card colour on the right; text block sits on top of the faded area. */
.featured-card {
  position: relative;
  background-color: var(--bg-elevated);
  background-image:
    linear-gradient(to right,
      transparent 0%,
      transparent 30%,
      var(--bg-elevated) 80%),
    var(--bg-image, none);
  background-size: auto, cover;
  background-position: center, left center;
  background-repeat: no-repeat, no-repeat;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: clamp(280px, 28vw, 420px);
}

.featured-info {
  width: clamp(40%, 50%, 60%);
  max-width: 640px;
  position: relative;
  z-index: 1;
}

.featured-info h2 {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  margin: 0.3rem 0 0.5rem;
}

.featured-desc {
  margin: 0 0 1.2rem;
  font-size: 1rem;
  /* No more ellipsis line-clamp — the auto-scroll utility handles overflow.
     Cap the height so it doesn't push the card down arbitrarily; the marquee
     animation slides any content beyond this through the container. */
  max-height: calc(1.5em * 4);
  overflow: hidden;
}

.tag {                                  /* still used inside the modal */
  display: inline-block;
  padding: 0.25rem 0.65rem;
  background: rgba(217, 122, 60, 0.12);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

@media (max-width: 991px) {
  /* Stack on narrow screens: dedicated 16:9 image area on top (wider than the
     4:3 minimum so the original card images aren't cropped left/right), text
     below. Above 991px the desktop side-by-side layout (image bleeds left,
     gradient fades into the text panel on the right) applies. */
  .featured-card {
    display: block;
    padding: 0;
    background-image: none;       /* image moves to ::before */
    min-height: 0;
  }
  .featured-card::before {
    content: '';
    display: block;
    aspect-ratio: 16 / 9;
    background-image:
      linear-gradient(to bottom, transparent 70%, var(--bg-elevated) 100%),
      var(--bg-image, none);
    background-size: auto, cover;
    background-position: center, center;
    background-repeat: no-repeat;
  }
  .featured-info {
    width: 100%;
    max-width: none;
    padding: 1.25rem 1.25rem 1.5rem;
  }
}

/* ----------------------- Carousel ----------------------- */

.carousel { position: relative; }

.carousel-track {
  display: flex;
  align-items: flex-start;        /* don't stretch cells vertically — they should already be identical */
  gap: var(--card-gap);
  list-style: none;
  margin: 0;
  padding: 4px 0 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

/* uniform card cell — flex item lives here, button just fills it.
   We pin the width hard: flex-basis alone isn't enough because the default
   min-width: auto lets a long nowrap title push the cell wider. */
.game-card-cell {
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  max-width: var(--card-w);
  min-width: 0;
  scroll-snap-align: start;
}

.game-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
  text-align: left;
  color: inherit;
  font: inherit;
  padding: 0;
  display: block;
}
.game-card:hover, .game-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  outline: none;
}

.game-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.game-card-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.4s ease;
}
.game-card:hover .game-card-img img { transform: scale(1.04); }

.game-card-body {
  padding: 0.75rem 0.9rem 1rem;
  display: grid;                  /* grid columns with minmax(0,...) prevent ellipsis text from expanding the cell */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.15rem;
}
/* Both lines are strict single-line + nowrap so card heights stay identical
   regardless of title length, presence of status, etc. */
.game-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.game-card-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  min-height: 1.3em;             /* reserve the line even when meta is empty */
}

.carousel-arrow {
  position: absolute;
  top: calc((var(--card-w) * 9 / 16) / 2 + 4px);  /* center on the 16:9 image */
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 2;
}
.carousel-arrow svg { width: 18px; height: 18px; display: block; }
.carousel-arrow:hover { background: var(--accent); color: #1a1310; }
.carousel-arrow-left  { left: -12px; }
.carousel-arrow-right { right: -12px; }

@media (max-width: 720px) {
  .carousel-arrow { display: none; }
}

/* ----------------------- Team ----------------------- */

.team-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;                              /* ≤991px: single column */
}
@media (min-width: 992px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }  /* ≥992px: two columns */
}

/* Horizontal card — avatar on the left, info+links on the right.
   Card height is fixed so the avatar can be a static 190×190 square that
   never shrinks or feedback-loops on narrow viewports. */
.team-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 190px;
}

/* Avatar — locked to 190×190 regardless of viewport width or card content. */
.team-avatar {
  flex: 0 0 190px;
  width: 190px;
  height: 190px;
  background: linear-gradient(135deg, #3a2f28, #1f1b18);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.team-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.team-avatar-letter {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--accent);
}

/* Info column — name / nickname / role / links stacked vertically, left-aligned, tight spacing */
.team-info {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.55rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  text-align: left;
}
.team-name {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.15;
}
.team-nickname {
  color: var(--accent);
  font-size: 0.82rem;
  font-family: var(--font-body);
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.team-role {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

/* Social buttons pinned to the bottom of the info column, left-aligned */
.team-links {
  margin-top: auto;
  padding-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem;
  min-height: 46px;
}
.team-link-btn {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.team-link-btn:hover,
.team-link-btn:focus-visible {
  background: var(--accent);
  color: #1a1310;
  border-color: var(--accent);
  transform: translateY(-1px);
  outline: none;
}
.team-link-btn svg { width: 20px; height: 20px; display: block; }

/* ----------------------- Jam list ----------------------- */

.jam-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 0.5rem;
}
.jam-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.jam-date {
  color: var(--accent);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}
.jam-name { font-family: var(--font-display); letter-spacing: 0.03em; }
.jam-result { color: var(--text-muted); font-size: 0.9rem; margin-left: 0.5rem; }
.jam-link { font-size: 0.85rem; white-space: nowrap; }

@media (max-width: 600px) {
  .jam-item { grid-template-columns: 1fr; }
  .jam-result { margin-left: 0; }
}

/* ----------------------- Devlog ----------------------- */

.devlog-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.devlog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  display: flex; flex-direction: column;
  gap: 0.3rem;
}
.devlog-date {
  color: var(--accent);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}
.devlog-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0;
  letter-spacing: 0.03em;
}
.devlog-excerpt { color: var(--text-muted); margin: 0; font-size: 0.92rem; }
.devlog-link { margin-top: auto; font-size: 0.85rem; }

/* ----------------------- Contact ----------------------- */

.contact-actions {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 1.2rem;
  margin-top: 1rem;
}
/* social-strip when inlined inside the contact section (no full-width padding,
   no big bottom space — it sits next to the mailto button) */
.social-strip-inline {
  padding: 0;
  margin: 0;
  justify-content: flex-start;
}

/* ----------------------- Modal ----------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(0.5rem, 3vw, 1.5rem);
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: min(1380px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.75rem);
  animation: modal-pop 0.18s ease-out;
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.6rem; right: 0.6rem;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  display: grid; place-items: center;
  padding: 0;
}
.modal-close svg { width: 16px; height: 16px; display: block; }
.modal-close:hover { background: var(--accent); color: #1a1310; }

.modal-title {
  font-size: clamp(1.9rem, 3.5vw, 2.6rem);
  margin: 0 0 1rem;
  padding-right: 2.5rem;
  letter-spacing: 0.03em;
}

/* Steam-style two-column body */
.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin: 0 0 1.25rem;
}
.modal-grid-no-media {
  grid-template-columns: 1fr;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.modal-media {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.modal-side {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  /* default align-self: stretch in grid → matches the gallery column height */
  min-height: 0;
  overflow: hidden;
}
.modal-side .modal-desc {
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  /* overflow is managed by .auto-scroll — animation kicks in when text exceeds height */
}

/* Tag row in modal-side — no heading, small pills.
   Capped to 2 rows; extras get visually clipped by overflow: hidden. */
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-height: calc(2 * (1em + 0.6em) + 0.3rem);   /* 2 tag rows + 1 gap */
  overflow: hidden;
}
.tag-sm {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  background: rgba(217, 122, 60, 0.10);
  letter-spacing: 0.03em;
}

/* "Submission to <jam>" line above buttons */
.modal-jam-line {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.modal-jam-line a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Facts list — definition list with two columns (label / value) */
.modal-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.85rem;
  margin: 0;
}
.modal-facts dt {
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  align-self: center;
  text-transform: uppercase;
}
.modal-facts dd {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

/* Action buttons below the grid */
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.75rem;
}

/* Optional collapsible blocks: patch notes, devlog, etc. */
.modal-extras {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.modal-extra {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.modal-extra summary {
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: 1rem;
  padding: 0.7rem 1rem;
  list-style: none;
  position: relative;
  padding-right: 2.4rem;
  user-select: none;
}
.modal-extra summary::-webkit-details-marker,
.modal-extra summary::marker { display: none; content: ''; }
.modal-extra summary::after {
  content: '+';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--text-muted);
  transition: transform 0.18s ease;
}
.modal-extra[open] summary::after { content: '−'; }
.modal-extra summary:hover { color: var(--accent); }
.modal-extra-body {
  padding: 0 1rem 0.9rem;
  font-size: 0.93rem;
  color: var(--text);
  line-height: 1.5;
}
.modal-extra-body p { margin: 0 0 0.6rem; }
.modal-extra-body p:last-child { margin-bottom: 0; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Below 1200px the modal switches to a single-column mobile layout: gallery
   stacks on top of the side panel, and the description takes its natural
   full height (no auto-scroll needed since there's no parallel column to
   match height against). */
@media (max-width: 1199px) {
  .modal-grid { grid-template-columns: 1fr; }
  .modal-side {
    overflow: visible;       /* let description grow without clipping */
  }
  .modal-side .modal-desc {
    flex: 0 0 auto;          /* override flex: 1 1 0 — natural content height */
  }
}

.gallery { display: flex; flex-direction: column; gap: 0.4rem; }
.gallery-main {
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  position: relative;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Video plays right inside the gallery-main area when a video item is selected */
.gallery-main .gallery-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Empty gallery: subtle dotted border + faint label, so it's clearly a placeholder */
.gallery-main-empty {
  background:
    radial-gradient(circle at center, rgba(217, 122, 60, 0.05), transparent 60%),
    #000;
  border: 1px dashed rgba(168, 154, 135, 0.18);
}

/* Thumbnails strip with slider arrows on the sides */
.gallery-thumbs-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.gallery-thumbs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  flex: 1 1 0;
  min-width: 0;
  min-height: 56px;            /* keeps the strip the same height when empty */
  align-items: center;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

/* Empty thumbs strip → subtle dashed-bordered placeholder so the row is still visible */
.gallery-thumbs-wrap-empty .gallery-thumbs {
  border: 1px dashed rgba(168, 154, 135, 0.18);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at center, rgba(217, 122, 60, 0.04), transparent 60%),
    #000;
}

.thumbs-arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 56px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-sm);
  display: none;            /* shown only when the strip overflows */
  place-items: center;
  margin: 0 0.25rem;
  padding: 0;
}
.gallery-thumbs-wrap.thumbs-overflow .thumbs-arrow { display: grid; }
.thumbs-arrow svg { width: 14px; height: 14px; display: block; }
.thumbs-arrow:hover { background: var(--accent); color: #1a1310; border-color: var(--accent); }
.gallery-thumb {
  flex: 0 0 84px;
  height: 56px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: #000;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb[aria-current="true"] { border-color: var(--accent); }

/* Video thumbnail — image with a centered play-icon overlay */
.gallery-thumb-video { position: relative; }
.thumb-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  pointer-events: none;
  transition: background 0.15s;
}
.gallery-thumb-video:hover .thumb-play { background: rgba(0, 0, 0, 0.25); }
.thumb-play svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.gallery-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  display: grid; place-items: center;
  padding: 0;
}
.gallery-nav svg { width: 18px; height: 18px; display: block; }
.gallery-nav:hover { background: var(--accent); color: #1a1310; }
.gallery-prev { left: 6px; }
.gallery-next { right: 6px; }

/* Fullscreen button (top-right of main gallery image) */
.gallery-fullscreen {
  position: absolute;
  top: 8px; right: 8px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  display: grid; place-items: center;
  z-index: 2;
}
.gallery-fullscreen svg { width: 18px; height: 18px; }
.gallery-fullscreen:hover { background: var(--accent); color: #1a1310; }

/* Gallery in fullscreen — the image fills the screen */
.gallery:fullscreen {
  background: #000;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.gallery:fullscreen .gallery-main {
  flex: 1 1 auto;
  aspect-ratio: auto;
  width: 100%;
  border-radius: 0;
}
.gallery:fullscreen .gallery-main img { object-fit: contain; }
.gallery:fullscreen .gallery-thumbs-wrap { flex: 0 0 auto; }

.modal-links {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  list-style: none; margin: 0; padding: 0;
}

body.modal-open { overflow: hidden; }

/* ============================================================
   Auto-scroll marquee for truncated text
   ============================================================
   A target element gets .auto-scroll + .auto-scroll-(x|y); its
   text is wrapped in .auto-scroll-inner by JS. When the inner
   overflows the parent, JS adds .is-overflowing and sets
   --scroll-distance / --scroll-duration; the keyframes below
   then loop: hold → slide → hold → fade → snap → fade-in.
   Pause on hover and respect prefers-reduced-motion. */

.auto-scroll                       { overflow: hidden; position: relative; }
.auto-scroll-x .auto-scroll-inner  { display: inline-block; white-space: nowrap; }
.auto-scroll-y .auto-scroll-inner  { display: block; }

.auto-scroll.is-overflowing .auto-scroll-inner {
  animation-duration: var(--scroll-duration, 12s);
  animation-iteration-count: infinite;
}

/* X-axis: slow zigzag. animation-direction: alternate flips the keyframes
   on every other iteration, giving back-and-forth motion with natural holds
   at both ends. No fade/reset jump. */
.auto-scroll-x.is-overflowing .auto-scroll-inner {
  animation-name: fk-marquee-x;
  animation-direction: alternate;
  animation-timing-function: ease-in-out;
}

/* Y-axis: linear scroll-down with an extended pause at the last line before
   fading out and snapping back to the start. */
.auto-scroll-y.is-overflowing .auto-scroll-inner {
  animation-name: fk-marquee-y;
  animation-timing-function: linear;
}

/* Dynamic top + bottom fade for vertical scroll: top fades in once text has
   scrolled past the start, bottom fades out once we reach the end of the text.
   Uses two animatable custom properties driven by the fk-fade-y keyframes. */
.auto-scroll-y.is-overflowing {
  --fk-fade-top: 0px;
  --fk-fade-bottom: 1.5em;
  -webkit-mask-image: linear-gradient(to bottom,
    transparent 0,
    black var(--fk-fade-top),
    black calc(100% - var(--fk-fade-bottom)),
    transparent 100%);
          mask-image: linear-gradient(to bottom,
    transparent 0,
    black var(--fk-fade-top),
    black calc(100% - var(--fk-fade-bottom)),
    transparent 100%);
  animation-name: fk-fade-y;
  animation-duration: var(--scroll-duration, 12s);
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

@keyframes fk-fade-y {
  0%, 10%   { --fk-fade-top: 0px;     --fk-fade-bottom: 1.5em; }   /* hold at top — no top fade, bottom fade ON */
  25%       { --fk-fade-top: 1.5em;   --fk-fade-bottom: 1.5em; }   /* both fades during motion */
  65%       { --fk-fade-top: 1.5em;   --fk-fade-bottom: 1.5em; }   /* still both fades — reached end */
  85%       { --fk-fade-top: 1.5em;   --fk-fade-bottom: 0px; }     /* hold at end — bottom fade gone */
  93%       { --fk-fade-top: 1.5em;   --fk-fade-bottom: 0px; }
  93.01%    { --fk-fade-top: 0px;     --fk-fade-bottom: 1.5em; }   /* snap back to start state (invisible — inner opacity 0) */
  100%      { --fk-fade-top: 0px;     --fk-fade-bottom: 1.5em; }
}

/* Pause when the user hovers — lets them stop and read */
.auto-scroll:hover .auto-scroll-inner { animation-play-state: paused; }

@keyframes fk-marquee-x {
  0%, 18%   { transform: translateX(0); }
  82%, 100% { transform: translateX(calc(-1 * var(--scroll-distance))); }
}

@keyframes fk-marquee-y {
  0%, 10%   { transform: translateY(0);                                 opacity: 1; }
  65%       { transform: translateY(calc(-1 * var(--scroll-distance))); opacity: 1; }
  90%       { transform: translateY(calc(-1 * var(--scroll-distance))); opacity: 1; }  /* longer pause at last line */
  93%       { transform: translateY(calc(-1 * var(--scroll-distance))); opacity: 0; }
  93.01%    { transform: translateY(0);                                 opacity: 0; }
  98%, 100% { transform: translateY(0);                                 opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .auto-scroll.is-overflowing .auto-scroll-inner {
    animation: none !important;
  }
}
