/* ===========================================================================
   Kai Renn — portfolio
   A spec sheet, not a showreel. Monospace structure, 8px grid, one accent.
   No gradients, no glow, no shadows. Contrast and alignment do the work.
   =========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
  /* Deepslate ground. Slightly green-black rather than neutral. */
  --bg:        #0b0c0b;
  --bg-1:      #101210;
  --bg-2:      #161916;
  --line:      #252925;
  --line-soft: #1a1d1a;

  --fg:        #e9e7e0;   /* bone */
  --fg-dim:    #9aa096;
  --fg-faint:  #6b716a;

  --accent:    #d8a34a;   /* torchlight */
  --accent-dim:#8d6a2f;
  --live:      #8fbfa8;   /* "taking commissions" dot */

  /* Project tags, low saturation on purpose. */
  --t-plugin:   #7aa2c8;
  --t-event:    #d8a34a;
  --t-mythic:   #b897c4;
  --t-shaders:  #8fbfa8;
  --t-textures: #9aa096;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;

  /* 8px scale — the texture grid, scaled. */
  --u: 8px;
  --gut: clamp(20px, 5vw, 72px);
  --max: 1280px;

  --dur: .18s;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0s; }
  * { animation: none !important; scroll-behavior: auto !important; }
}

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.02em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ol, ul, dl, dd { margin: 0; padding: 0; list-style: none; }

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

/* Paper grain instead of gradients. Keeps flat colour from looking dead. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 200;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #000;
  padding: 12px 20px; z-index: 300;
  font-family: var(--mono); font-size: 13px;
}
.skip:focus { left: 16px; top: 16px; }

/* --- Shared bits ---------------------------------------------------------- */
.eyebrow, .section-label, .chip, .tag, .stat-l, .spec dt,
.tl-when, .btn, .brand-name, .topnav a, .availability {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.btn {
  display: inline-block;
  padding: 13px 22px;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  text-decoration: none;
  transition: color var(--dur), border-color var(--dur), background var(--dur);
}
.btn:hover { color: var(--fg); border-color: var(--fg-faint); }
.btn-primary { border-color: var(--accent-dim); color: var(--accent); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #100c05; }

/* --- Top bar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: var(--gut);
  padding: 0 var(--gut);
  height: 64px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.brand-mark {
  width: 14px; height: 14px;
  border: 2px solid var(--accent);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 3px; background: var(--accent);
}
.brand-name { color: var(--fg); letter-spacing: .14em; }

.topnav { display: flex; gap: 28px; }
.topnav a { color: var(--fg-faint); text-decoration: none; transition: color var(--dur); }
.topnav a:hover { color: var(--fg); }

.availability { color: var(--fg-faint); display: flex; align-items: center; gap: 8px; }
.dot {
  width: 6px; height: 6px; background: var(--live);
  display: inline-block;
}

/* --- Hero ----------------------------------------------------------------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 11vw, 132px) var(--gut) clamp(48px, 8vw, 96px);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: end;
  position: relative;
}
/* Faint lattice — the texture grid at 8×, masked so it dissolves rather than
   ending in a hard box edge. */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: repeating-linear-gradient(to right,
    var(--line-soft) 0 1px, transparent 1px calc(var(--u) * 16));
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 76%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 76%);
}
.hero > * { position: relative; }
.eyebrow { color: var(--accent); margin-bottom: 28px; }

h1 {
  font-family: var(--mono);
  font-size: clamp(2rem, 5.6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  margin-bottom: 32px;
  text-wrap: balance;
}
h1 em {
  font-style: normal;
  color: var(--accent);
  box-shadow: inset 0 -.09em 0 var(--accent-dim);
}

.lede {
  max-width: 56ch;
  color: var(--fg-dim);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

/* --- Spec tables (the recurring motif) ------------------------------------ */
.spec { border-top: 1px solid var(--line); }
.spec > div {
  display: grid;
  grid-template-columns: minmax(96px, 34%) 1fr;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.spec dt { color: var(--fg-faint); padding-top: 2px; }
.spec dd { font-family: var(--mono); font-size: 13px; color: var(--fg); }
.spec dd a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }
.spec dd a:hover { color: var(--fg); }

/* --- Stats ---------------------------------------------------------------- */
.stats {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gut);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: clamp(24px, 4vw, 40px) 0;
  display: flex; flex-direction: column; gap: 6px;
}
.stat + .stat { border-left: 1px solid var(--line-soft); padding-left: clamp(16px, 3vw, 36px); }
.stat-n {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  letter-spacing: -.04em;
  line-height: 1;
}
.stat-l { color: var(--fg-faint); }

/* --- Section scaffolding -------------------------------------------------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 10vw, 120px) var(--gut);
  border-bottom: 1px solid var(--line-soft);
}
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  margin-bottom: clamp(36px, 6vw, 64px);
}
.section-label { color: var(--accent); padding-top: 7px; }
.section-intro h2 {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  letter-spacing: -.03em;
  margin-bottom: 12px;
}
.section-intro p { color: var(--fg-dim); max-width: 62ch; }

/* --- Work: split index ---------------------------------------------------- */
.work {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}
.registry { position: sticky; top: 96px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.chip {
  font-size: 11px;
  letter-spacing: .07em;
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--fg-faint);
  transition: color var(--dur), border-color var(--dur);
}
.chip:hover { color: var(--fg); }
.chip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-dim); }

.registry-list { border-top: 1px solid var(--line); }
.registry-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 15px 14px 15px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  border-left: 2px solid transparent;
  transition: background var(--dur), border-color var(--dur);
}
.registry-item:hover { background: var(--bg-1); }
.registry-item[aria-current="true"] {
  border-left-color: var(--accent);
  background: var(--bg-1);
}
.ix-num { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); }
.registry-item[aria-current="true"] .ix-num { color: var(--accent); }
.ix-name { font-size: 15px; color: var(--fg-dim); transition: color var(--dur); }
.registry-item:hover .ix-name,
.registry-item[aria-current="true"] .ix-name { color: var(--fg); }
.ix-type { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

.tag[data-type="Plugin"],        .ix-type[data-type="Plugin"]        { color: var(--t-plugin); }
.tag[data-type="Event"],         .ix-type[data-type="Event"]         { color: var(--t-event); }
.tag[data-type="Custom Mythic"], .ix-type[data-type="Custom Mythic"] { color: var(--t-mythic); }
.tag[data-type="Core Shaders"],  .ix-type[data-type="Core Shaders"]  { color: var(--t-shaders); }
.tag[data-type="Texture Packs"], .ix-type[data-type="Texture Packs"] { color: var(--t-textures); }

/* --- Work: detail panel --------------------------------------------------- */
.detail:focus { outline: none; }
.detail-inner { animation: rise var(--dur) ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.d-head { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 28px; }
.d-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.d-index { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); letter-spacing: .1em; }
.tag {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid currentColor; padding: 3px 8px;
}
.d-title {
  font-family: var(--mono);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  letter-spacing: -.04em;
  line-height: 1.05;
  margin-bottom: 14px;
}
.d-tagline { font-size: clamp(1.05rem, 1.7vw, 1.25rem); color: var(--fg); max-width: 54ch; }

.d-body { max-width: 66ch; margin-bottom: 36px; }
.d-body p { color: var(--fg-dim); }
.d-body p + p { margin-top: 16px; }

.d-sub {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-faint);
  padding-bottom: 10px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.d-block { margin-bottom: 40px; }

.highlights { max-width: 66ch; }
.highlights li {
  display: grid; grid-template-columns: 20px 1fr; gap: 12px;
  color: var(--fg-dim); padding: 9px 0;
}
.highlights li::before {
  content: ""; width: 7px; height: 7px;
  background: var(--accent); margin-top: 9px;
}

/* Video facade — nothing loads until the visitor asks for it. */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: var(--bg-1);
  overflow: hidden;
}
.video-poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; opacity: .3;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play, .video-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px;
  transition: background var(--dur);
}
.video-play:hover { background: rgba(216,163,74,.06); }
.play-mark {
  width: 62px; height: 62px;
  border: 1px solid var(--accent-dim);
  display: grid; place-items: center;
  color: var(--accent); font-size: 17px;
  transition: background var(--dur), color var(--dur);
}
.video-play:hover .play-mark { background: var(--accent); color: #100c05; }
.play-label { font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
              text-transform: uppercase; color: var(--fg-dim); }
.play-mark.is-idle { border-color: var(--line); color: var(--fg-faint); }
.video-empty .play-label { color: var(--fg-faint); }
.video-empty code {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  border: 1px solid var(--line); padding: 3px 8px;
}

/* Screenshot strip */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shot {
  padding: 0; border: 1px solid var(--line);
  aspect-ratio: 16 / 9; overflow: hidden;
  transition: border-color var(--dur);
}
.shot img { width: 100%; height: 100%; object-fit: cover;
            transition: opacity var(--dur), transform var(--dur); opacity: .82; }
.shot:hover { border-color: var(--accent-dim); }
.shot:hover img { opacity: 1; transform: scale(1.03); }

.d-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* --- Approach cards ------------------------------------------------------- */
.cards {
  display: grid;
  /* 320px caps this at 3 columns, so the 6 cards always tile into full
     rows (6 divides by 3, 2 and 1) instead of leaving a ragged half-row. */
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line-soft);
}
.card {
  padding: clamp(24px, 3vw, 34px);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.card h3 {
  font-family: var(--mono); font-size: 14px; letter-spacing: -.01em;
  margin-bottom: 14px; color: var(--fg);
}
.card p { color: var(--fg-dim); font-size: 15px; }
.card-negative h3 { color: var(--accent); }

/* --- Timeline ------------------------------------------------------------- */
.timeline { border-top: 1px solid var(--line); }
.timeline li {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  padding: clamp(22px, 3vw, 32px) 0;
  border-bottom: 1px solid var(--line-soft);
}
.tl-when { color: var(--accent); padding-top: 5px; }
.tl-what h3 { font-size: 1.05rem; margin-bottom: 10px; }
.tl-org { color: var(--fg-faint); font-weight: 400; }
.tl-what p { color: var(--fg-dim); max-width: 62ch; }

/* --- Contact -------------------------------------------------------------- */
.section-contact { border-bottom: 0; }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.contact-primary { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.mailto {
  font-family: var(--mono);
  font-size: clamp(1.25rem, 3.4vw, 2.1rem);
  letter-spacing: -.03em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  word-break: break-all;
}
.mailto:hover { color: var(--fg); border-color: var(--fg); }

/* Rate card: the spec motif again, set off from the contact grid above. */
.rates { margin-top: clamp(40px, 6vw, 72px); margin-bottom: 0; }
.rates-note { color: var(--fg-dim); font-size: 15px; max-width: 62ch; margin-top: 20px; }

/* Price is the datum a buyer scans for, so it leads the row instead of
   sitting mid-sentence. The three figures then read as a ladder. */
.px {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.1rem, 1.9vw, 1.4rem);
  letter-spacing: -.03em;
  color: var(--accent);
}
.px-note {
  display: block;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--fg-faint);
  margin: 3px 0 12px;
}

/* Capability index — the .highlights square bullet, tiled into columns.
   12 items divide evenly by 4/3/2/1, so every column count gives full rows. */
.caps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  column-gap: clamp(16px, 3vw, 40px);
  border-top: 1px solid var(--line);
}
.caps li {
  display: grid; grid-template-columns: 18px 1fr; gap: 10px;
  font-family: var(--mono); font-size: 13px; color: var(--fg-dim);
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.caps li::before {
  content: ""; width: 7px; height: 7px;
  background: var(--accent-dim); margin-top: 7px;
}

/* Closing line. The last thing before the footer, so it gets a rule above it. */
.creed {
  font-family: var(--mono);
  font-size: clamp(1rem, 2.1vw, 1.45rem);
  letter-spacing: -.02em;
  line-height: 1.45;
  max-width: 34ch;
  margin-top: clamp(48px, 7vw, 88px);
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--line);
}

/* --- Footer --------------------------------------------------------------- */
.footer {
  max-width: var(--max); margin: 0 auto;
  padding: 32px var(--gut) 56px;
  display: flex; flex-wrap: wrap; gap: 12px 32px;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .08em; color: var(--fg-faint);
}

/* --- Lightbox ------------------------------------------------------------- */
.lightbox {
  border: 0; padding: 0; max-width: 100vw; max-height: 100vh;
  width: 100%; height: 100%;
  background: transparent; color: var(--fg);
}
.lightbox::backdrop { background: rgba(6,7,6,.95); }
.lightbox[open] {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding: clamp(16px, 4vw, 48px);
}
.lb-img {
  grid-column: 2; grid-row: 1;
  max-width: 100%; max-height: 78vh;
  margin: 0 auto; object-fit: contain;
  border: 1px solid var(--line);
}
.lb-nav { font-size: 30px; color: var(--fg-faint); padding: 20px 0; transition: color var(--dur); }
.lb-nav:hover { color: var(--accent); }
.lb-prev { grid-column: 1; grid-row: 1; }
.lb-next { grid-column: 3; grid-row: 1; }
.lb-close { position: absolute; top: 18px; right: 22px; font-size: 18px; color: var(--fg-faint); }
.lb-close:hover { color: var(--accent); }
.lb-caption {
  grid-column: 2; grid-row: 2; text-align: center; padding-top: 18px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--fg-faint);
}

/* --- Scroll reveal -------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero-spec { margin-top: 8px; }
  .work { grid-template-columns: 1fr; }
  .registry { position: static; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .topnav { display: none; }
  .availability { margin-left: auto; }
  .section-head, .timeline li { grid-template-columns: 1fr; gap: 10px; }
  .section-label, .tl-when { padding-top: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .shots {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-inline: calc(var(--gut) * -1); padding-inline: var(--gut);
  }
  .shot { flex: 0 0 78%; scroll-snap-align: start; }
  .lightbox[open] { grid-template-columns: 40px 1fr 40px; }
}

/* --- Print: the CV falls out of it ---------------------------------------- */
@media print {
  :root { --bg: #fff; --fg: #111; --fg-dim: #333; --fg-faint: #666;
          --line: #bbb; --line-soft: #ddd; --accent: #7a5510; }
  body { background: #fff; color: #111; }
  body::after, .topbar, .filters, .hero-actions,
  .video, .shots, .btn-copy, .lightbox, .footer-note { display: none !important; }
  .work { grid-template-columns: 1fr; }
  .section, .hero { padding-block: 24px; page-break-inside: avoid; }
  a { text-decoration: none; }
}
