/* ============================================================
   PROJECT PAGE — shared template for the "case study" pages
   (blitz-ball, deep-dive-repair, over-the-garden)
   Link AFTER base.css. Page-specific CSS stays inline.
   ============================================================ */

/* fixed background grid, like the home page */
.grid-bg{
  position:fixed; inset:-10% 0; z-index:0; pointer-events:none;
  background-image:
    linear-gradient(to right,  rgba(76,130,240,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(76,130,240,.06) 1px, transparent 1px);
  background-size:48px 48px;
  mask-image:radial-gradient(120% 80% at 50% 0%, #000 18%, transparent 75%);
}
.page{ position:relative; z-index:1; }

/* ============================================================
   NAV
   ============================================================ */
.nav{
  position:sticky; top:0; z-index:50;
  backdrop-filter:blur(10px);
  background:rgba(14,17,22,.72);
  border-bottom:1px solid var(--line);
}
.nav-inner{ display:flex; align-items:center; gap:16px; height:60px; }
.brand{
  font-family:var(--font-display); font-weight:700; letter-spacing:-.02em;
  font-size:21.5px; display:flex; align-items:center; gap:9px;
}
.brand .dot{ width:9px; height:9px; border-radius:2px; background:var(--accent); box-shadow:0 0 12px var(--accent); }
.back{
  margin-left:auto; font-size:18px; color:var(--muted); padding:7px 12px; border-radius:8px;
  display:inline-flex; align-items:center; gap:7px;
  transition:color .2s var(--ease), background .2s var(--ease);
}
.back:hover{ color:var(--text); background:var(--surface); }
/* small phones: brand + "Back to projects" + language toggle don't fit on one line →
   smaller brand, and the back link collapses to an arrow (text kept for screen readers) */
@media (max-width:560px){
  .nav-inner{ gap:8px; }
  .brand{ font-size:17px; white-space:nowrap; }
  .back{ font-size:0; gap:0; padding:8px 10px; }
  .back svg{ display:none; }            /* the FR version has no svg anyway (i18n swaps the text) */
  .back::before{ content:'←'; font-size:20px; line-height:1; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero{ padding:84px 0 56px; }
.eyebrow{
  font-family:'JetBrains Mono',monospace; font-size:17.5px; color:var(--accent);
  letter-spacing:.04em; margin-bottom:18px;
}
.eyebrow::before{ content:'// '; color:var(--muted-2); }
.hero h1{
  font-family:var(--font-display); font-weight:700; letter-spacing:-.03em;
  font-size:clamp(38px, 8vw, 92px); line-height:1.0; margin-bottom:18px;
  overflow-wrap:break-word;             /* long titles ("Deep Dive Repair") must never overflow on phones */
}
.hero h1 .accent{ color:var(--accent); }
.role-line{
  font-family:'JetBrains Mono',monospace; font-size:clamp(20px,2.4vw,26px); font-weight:500;
  color:var(--cyan);
  text-transform:uppercase; letter-spacing:.06em; margin-bottom:28px;
}
.lead{ font-size:clamp(23px,2.6vw,27px); color:var(--text); max-width:none; }
.lead p{ margin-bottom:14px; color:var(--text-2); font-weight:400; }
.lead p strong{ color:var(--text); font-weight:700; }

.tags{ display:flex; flex-wrap:wrap; gap:7px; margin-top:26px; }
.tag{
  font-family:'JetBrains Mono',monospace; font-size:15.5px; color:var(--muted);
  padding:4px 9px; border:1px solid var(--line); border-radius:6px; background:var(--bg-2);
}

/* main media banner */
.cover{
  margin-top:40px; position:relative; aspect-ratio:16/9; overflow:hidden;
  background:var(--surface-2); border:1px solid var(--line); border-radius:var(--radius);
}
.cover img, .cover video{ width:100%; height:100%; object-fit:cover; }

/* ============================================================
   SECTIONS
   ============================================================ */
.section{ padding:72px 0; border-top:1px solid var(--line); }
.section-head{ display:flex; align-items:baseline; gap:16px; margin-bottom:18px; }
.section-num{ font-family:'JetBrains Mono',monospace; font-size:17.5px; color:var(--accent); }
.section-head h2{
  font-family:var(--font-display); font-weight:700; letter-spacing:-.02em;
  font-size:clamp(32px,4.8vw,46px);
}
.section > .wrap > p{ color:var(--text-2); max-width:none; margin-bottom:16px; font-weight:400; }
.section > .wrap > p strong{ color:var(--text); font-weight:700; }
.credit{
  display:inline-flex; align-items:center; gap:9px; margin-bottom:28px;
  font-size:19px; color:var(--muted);
  padding:8px 14px; border:1px solid var(--line); border-radius:10px; background:var(--surface);
}
.credit b{ color:var(--text); font-weight:600; }

/* ============================================================
   MEDIA SLOT (GIF / mp4 / png to replace)
   ============================================================ */
.media-slot{
  position:relative; aspect-ratio:16/9; overflow:hidden;
  background:var(--surface-2); border:1px solid var(--line); border-radius:12px;
}
.media-slot img, .media-slot video{ width:100%; height:100%; object-fit:cover; }
/* .fit: show the whole image (letterboxed) when cropping would cut important content */
.cover .fit, .media-slot img.fit, .media-slot video.fit{ object-fit:contain; }
a.media-slot{ display:block; text-decoration:none; cursor:zoom-in; }
.media-zoom{
  position:absolute; bottom:8px; right:8px;
  font-family:'JetBrains Mono',monospace; font-size:15px;
  background:rgba(0,0,0,.62); color:#fff; padding:4px 9px; border-radius:6px;
  opacity:0; transition:opacity .15s ease;
}
a.media-slot:hover .media-zoom{ opacity:1; }

/* Lightbox (full-screen pop-up on the same page) */
.lightbox{
  position:fixed; inset:0; z-index:100;
  display:none; align-items:center; justify-content:center;
  padding:32px; background:rgba(8,10,14,.88); backdrop-filter:blur(4px);
  cursor:zoom-out;
}
.lightbox.open{ display:flex; }
.lightbox img, .lightbox video{
  max-width:95%; max-height:92%; object-fit:contain;
  border-radius:10px; box-shadow:0 20px 60px rgba(0,0,0,.6);
}
.lightbox video{ cursor:default; }
/* any clickable media → magnifier cursor */
.zoomable{ cursor:zoom-in; }
.lightbox-close{
  position:absolute; top:18px; right:22px;
  font-size:40px; line-height:1; color:#fff; opacity:.8;
  background:none; border:none; cursor:pointer;
}
.lightbox-close:hover{ opacity:1; }
.media-empty{
  position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:8px; color:var(--muted-2);
  background:repeating-linear-gradient(45deg, #181d25 0 12px, #161a21 12px 24px);
}
.player-hud{
  display:block; width:100%; height:auto;
  background:var(--surface-2); border:1px solid var(--line); border-radius:12px;
}
.media-empty .mono{ font-size:16px; }
.media-empty svg{ opacity:.5; }

/* ============================================================
   TASKS — media on one side, text on the other (alternating)
   ============================================================ */
.task{
  display:grid; grid-template-columns:1fr 1fr; gap:32px; align-items:center;
  padding:28px 0;
}
.task + .task{ border-top:1px solid var(--line); }
.task:nth-child(even) .task-media{ order:2; }      /* alternates the media side */
.task-label{
  font-family:'JetBrains Mono',monospace; font-size:15.5px; color:var(--accent);
  text-transform:uppercase; letter-spacing:.05em; margin-bottom:8px;
}
.task h3{ font-family:var(--font-display); font-weight:700; font-size:30px; margin-bottom:12px; }
.task p{ color:var(--text-2); margin-bottom:16px; font-weight:400; }
.task p strong, .task li strong{ color:var(--text); font-weight:700; }
.task ul{ list-style:none; display:flex; flex-direction:column; gap:9px; }
.task li{ font-size:20px; color:var(--text); position:relative; padding-left:20px; font-weight:400; }
.task li::before{ content:'▸'; color:var(--accent); font-size:16px; position:absolute; left:0; top:0; }
.task li.warn::before{ content:'!'; color:var(--cyan); font-weight:700; }

@media (max-width:760px){
  .task{ grid-template-columns:1fr; gap:18px; }
  .task:nth-child(even) .task-media{ order:0; }
}

/* ============================================================
   FOOTER + CTA
   ============================================================ */
.cta{
  margin-top:8px;
  background:linear-gradient(180deg,var(--surface),var(--bg-2));
  border:1px solid var(--line); border-radius:var(--radius); padding:40px; text-align:center;
}
.cta h2{ font-family:var(--font-display); font-weight:700; font-size:clamp(30px,4.8vw,40px); margin-bottom:10px; letter-spacing:-.02em; }
.cta p{ color:var(--muted); margin-bottom:24px; }
.btn{
  font-family:var(--font-display); font-weight:600; font-size:19.5px;
  padding:13px 22px; border-radius:11px; cursor:pointer; border:1px solid transparent;
  transition:transform .15s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
  display:inline-flex; align-items:center; gap:9px;
}
.btn:hover{ transform:translateY(-2px); }
.btn-primary{ background:var(--accent); color:#0B0D11; }
.btn-primary:hover{ background:#6E9BF5; }
.btn-ghost{ background:transparent; color:var(--text); border-color:var(--line); }
.btn-ghost:hover{ border-color:var(--accent); }

.footer{
  border-top:1px solid var(--line); padding:32px 0; margin-top:8px;
  display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap;
  color:var(--muted-2); font-size:17.5px;
}
.footer .mono{ font-size:16px; }

/* ============================================================
   CODE SNIPPETS (collapsible, highlighted by highlight.js)
   <details class="code-block"><summary>…</summary><div class="code-meta">…</div><pre><code class="language-csharp">…</code></pre></details>
   ============================================================ */
.task-body{ min-width:0; }            /* grid item: let long code lines scroll inside the block */
.code-block{
  min-width:0; max-width:100%;
  margin-top:22px; border:1px solid var(--line); border-radius:12px;
  background:var(--bg-2); overflow:hidden;
}
.code-block summary{
  list-style:none; cursor:pointer; user-select:none;
  display:flex; align-items:center; gap:10px; padding:12px 16px;
  font-family:'JetBrains Mono',monospace; font-size:15px; color:var(--text);
  transition:background .2s var(--ease);
}
.code-block summary::-webkit-details-marker{ display:none; }
.code-block summary::before{
  content:'▸'; color:var(--accent); transition:transform .2s var(--ease); display:inline-block;
}
.code-block[open] summary::before{ transform:rotate(90deg); }
.code-block summary:hover{ background:var(--surface); }
.code-block summary .file{ color:var(--muted); margin-left:auto; font-size:13.5px; }
.code-meta{
  display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap;
  padding:8px 16px; border-top:1px solid var(--line); border-bottom:1px solid var(--line);
  font-size:14px; color:var(--muted-2); background:var(--surface);
}
.code-meta a{ color:var(--accent); }
.code-block pre{ margin:0; padding:16px 18px; overflow-x:auto; font-size:14px; line-height:1.6; }   /* own line box: the body line-height is far too tall for code */

/* slider built by code-viewer.js: tabs + ‹ › on top, one fixed-height pane below */
.code-head{
  display:flex; align-items:center; gap:8px; padding:8px 10px 0;
  border-bottom:1px solid var(--line); background:var(--bg-2);
}
.code-tabs{ display:flex; gap:2px; overflow-x:auto; scrollbar-width:none; flex:1; min-width:0; }
.code-tabs::-webkit-scrollbar{ display:none; }
.code-tab{
  flex:none; cursor:pointer; white-space:nowrap;
  font-family:'JetBrains Mono',monospace; font-size:13px; color:var(--muted);
  background:none; border:1px solid transparent; border-bottom:none; border-radius:8px 8px 0 0;
  padding:7px 12px; margin-bottom:-1px;
  transition:color .2s var(--ease), background .2s var(--ease);
}
.code-tab:hover{ color:var(--text); }
.code-tab.active{ color:var(--text); background:var(--surface); border-color:var(--line); }
.code-tab.active::after{ content:''; display:block; height:2px; margin-top:5px; border-radius:2px; background:var(--accent); }
.code-nav{ display:flex; align-items:center; gap:6px; flex:none; padding-bottom:6px; }
.code-arrow{
  width:28px; height:28px; border-radius:7px; cursor:pointer;
  border:1px solid var(--line); background:var(--surface); color:var(--text);
  font-size:18px; line-height:1; display:flex; align-items:center; justify-content:center;
  transition:border-color .2s var(--ease);
}
.code-arrow:hover{ border-color:var(--accent); }
.code-count{ font-family:'JetBrains Mono',monospace; font-size:12.5px; color:var(--muted-2); min-width:38px; text-align:center; }
.code-stage{ background:var(--surface); }
.code-pane{ max-height:340px; overflow:auto; }           /* the "allocated zone": long slides scroll inside */
.code-pane[hidden]{ display:none; }
/* dark, thin scrollbars instead of the browser's white ones */
.code-pane{ scrollbar-width:thin; scrollbar-color:#37404f transparent; }
.code-pane::-webkit-scrollbar{ width:8px; height:8px; }
.code-pane::-webkit-scrollbar-thumb{ background:#37404f; border-radius:8px; }
.code-pane::-webkit-scrollbar-track, .code-pane::-webkit-scrollbar-corner{ background:transparent; }
@media (max-width:560px){
  .code-block code{ font-size:12.5px; }
  .code-pane{ max-height:300px; padding:12px 14px; }
}
.code-pane:focus-visible, .code-tab:focus-visible, .code-arrow:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }
.code-block code{
  font-family:'JetBrains Mono',monospace; font-size:14px; line-height:1.6; color:var(--text-2);
  white-space:pre; tab-size:4;
}
/* token colours, tuned to the site palette */
.hljs-keyword, .hljs-meta .hljs-keyword{ color:#7FA6F5; }
.hljs-built_in, .hljs-type{ color:#57D7E6; }
.hljs-title, .hljs-title.function_, .hljs-title.class_{ color:#E8C77A; }
.hljs-string{ color:#9DD69B; }
.hljs-number, .hljs-literal{ color:#E59A73; }
.hljs-comment{ color:#6E7889; font-style:italic; }
.hljs-meta, .hljs-attr{ color:#B79CEB; }
.hljs-params{ color:var(--text-2); }
