/* ============================================================
   ARTIFACT — Keyboard Build Archive
   Palette drawn from the boards themselves:
   graphite case, bone caps, burnt-sienna Enter, copper badge.
   ============================================================ */

:root {
  --bg: #131517;
  --bg-raised: #1a1d20;
  --line: #2a2e33;
  --line-strong: #3a3f45;
  --bone: #e9e4d8;
  --bone-dim: #b9b4a8;
  --gray: #878d94;
  --accent: #cf6b47;      /* the Enter key */
  --copper: #c08a63;      /* the lion badge */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Consolas", monospace;
  --pad: clamp(1.25rem, 4vw, 4rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--bone);
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bg); }

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

.accent { color: var(--accent); }

.mono-micro {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--gray);
  text-transform: uppercase;
}

/* ---- film grain wash over everything ---- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1.5%, 1%); }
  50% { transform: translate(1%, -1.5%); }
  75% { transform: translate(-1%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ============ HEADER ============ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem var(--pad);
  background: linear-gradient(to bottom, rgba(19,21,23,0.85), transparent);
  backdrop-filter: blur(2px);
}

.wordmark { display: flex; flex-direction: column; gap: 0.1rem; text-decoration: none; color: inherit; }
.wordmark-main {
  font-weight: 600;
  letter-spacing: 0.32em;
  font-size: 0.95rem;
}
.wordmark-sub {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  color: var(--gray);
}

.site-nav { display: flex; gap: 2rem; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--bone-dim);
  text-decoration: none;
  transition: color 0.25s;
}
.site-nav a:hover { color: var(--accent); }

/* ============ HERO ============ */
.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-media { position: absolute; inset: 0; overflow: hidden; }
.hero-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 40%;
  animation: hero-drift 18s ease-out both;
}
@keyframes hero-drift {
  from { transform: scale(1.08); }
  to   { transform: scale(1.0); }
}

.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgba(19,21,23,0.95) 0%, rgba(19,21,23,0.35) 40%, rgba(19,21,23,0.15) 70%, rgba(19,21,23,0.5) 100%);
}

/* faint CRT scanlines — the retro-future wink */
.scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.12) 3px, rgba(0,0,0,0.12) 4px
  );
  mix-blend-mode: overlay;
  opacity: 0.5;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 var(--pad) 1rem;
  max-width: 1400px;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--bone-dim);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: clamp(3.5rem, 12vw, 9.5rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 1.2rem;
}

.hero-tag {
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--bone-dim);
  max-width: 34em;
  margin-bottom: 1.6rem;
}

.hero-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  padding: 0.45em 0.9em;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--bone-dim);
  background: rgba(19,21,23,0.5);
}

.hero-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 1.4rem var(--pad) 1.6rem;
  border-top: 1px solid rgba(233,228,216,0.12);
  margin-top: 2.2rem;
}

.scroll-cue { animation: cue-pulse 2.4s ease-in-out infinite; }
@keyframes cue-pulse { 0%,100% { opacity: 0.9; } 50% { opacity: 0.3; } }

/* corner registration ticks */
.corner {
  position: absolute; z-index: 3;
  width: 14px; height: 14px;
  border-color: rgba(233,228,216,0.4);
  border-style: solid;
  border-width: 0;
}
.corner-tl { top: 4.2rem; left: 1rem; border-top-width: 1px; border-left-width: 1px; }
.corner-tr { top: 4.2rem; right: 1rem; border-top-width: 1px; border-right-width: 1px; }
.corner-bl { bottom: 1rem; left: 1rem; border-bottom-width: 1px; border-left-width: 1px; }
.corner-br { bottom: 1rem; right: 1rem; border-bottom-width: 1px; border-right-width: 1px; }

/* ============ SECTIONS ============ */
.build { max-width: 1400px; margin: 0 auto; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}
.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ---- specs ---- */
.specs { padding: clamp(4rem, 9vw, 7rem) var(--pad) 2rem; }

.spec-grid { display: flex; flex-direction: column; }

.spec-row {
  display: grid;
  grid-template-columns: 3.5rem 11rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.3s, padding-left 0.3s;
}
.spec-row:hover { background: var(--bg-raised); padding-left: 0.6rem; }

.spec-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.spec-row dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gray);
}

.spec-row dd {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 400;
}

.spec-note {
  display: block;
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--gray);
  margin-top: 0.15rem;
}

/* ---- gallery ---- */
.gallery { padding: clamp(3rem, 7vw, 5.5rem) var(--pad); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.g-item {
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.g-wide { grid-column: span 2; }

.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 3 / 2;
  transition: transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1), opacity 0.4s;
}
.g-wide img { aspect-ratio: 21 / 9; }
.g-item:hover img { transform: scale(1.025); }

.g-item figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2.2rem 1rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--bone-dim);
  background: linear-gradient(to top, rgba(19,21,23,0.85), transparent);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s, transform 0.35s;
}
.g-item:hover figcaption { opacity: 1; transform: translateY(0); }

.fig-no { color: var(--accent); margin-right: 0.6em; }

/* ---- notes ---- */
.notes { padding: clamp(2rem, 5vw, 4rem) var(--pad) clamp(4rem, 9vw, 7rem); }

.notes-inner {
  max-width: 46em;
  margin: 0 auto;
  text-align: center;
}
.notes-inner .mono-micro { display: block; margin-bottom: 1.4rem; color: var(--accent); }
.notes-inner p {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  color: var(--bone-dim);
}

/* ============ FOOTER ============ */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.6rem var(--pad);
  border-top: 1px solid var(--line);
}

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed; inset: 0;
  z-index: 9500;
  background: rgba(10,11,12,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

.lb-img {
  max-width: min(92vw, 1600px);
  max-height: 86vh;
  object-fit: contain;
  border: 1px solid var(--line-strong);
}

.lightbox button {
  position: absolute;
  z-index: 2;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  width: 2.6rem; height: 2.6rem;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s;
}
.lightbox button:hover { border-color: var(--accent); color: var(--accent); }

.lb-close { top: 1.2rem; right: 1.2rem; }
.lb-prev { left: 1.2rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1.2rem; top: 50%; transform: translateY(-50%); }

.lb-caption {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ============ REVEAL ON SCROLL ============ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-media img { animation: none; }
  .grain { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============ PER-BUILD ACCENT THEMES ============ */
/* Each build re-tints the accent to a color pulled from the board itself. */
.theme-shi       { --accent: #cf6b47; --copper: #c08a63; }  /* burnt sienna Enter */
.theme-daji      { --accent: #c9784f; --copper: #b98a63; }  /* coral anodize */
.theme-kaze      { --accent: #b85c4a; --copper: #9aa4ad; }  /* dolch red / smoke steel */
.theme-diversity { --accent: #d1782f; --copper: #8f9d84; }  /* PANIC orange / sage */
.theme-spyder    { --accent: #9179b5; --copper: #b39968; }  /* anodized purple / gold badge */
.theme-geon      { --accent: #aebf2b; --copper: #6f5faf; }  /* volt green / nervewrecker purple */
.theme-rukia     { --accent: #c0503f; --copper: #9aa4ad; }  /* novelty red / steel */
.theme-rubrejane { --accent: #b89a5e; --copper: #c2a86a; }  /* gold PVD weight / beige */
.theme-gentian   { --accent: #d4a83f; --copper: #c9b98c; }  /* serika gold / gentian blue */
.theme-pangea    { --accent: #9fa6ad; --copper: #8a9198; }  /* machined steel / murdered-out */
.theme-flybeck   { --accent: #2a9c73; --copper: #b8a06a; }  /* peacock green / brass */
.theme-float     { --accent: #4a6ea5; --copper: #b8b096; }  /* striker navy / silver */
.theme-cw87      { --accent: #8a7ae0; --copper: #b09a5b; }  /* lilac purple / brass */
.theme-jane      { --accent: #e0913f; --copper: #b9bec4; }  /* windbreaker orange / silver */
.theme-kazedenim { --accent: #5a82b4; --copper: #b9c2cc; }  /* denim blue / mirror steel */
.theme-kohaku    { --accent: #d1483c; --copper: #b9bdc1; }  /* redacted red X / stainless */
.theme-cw88      { --accent: #9fb0c3; --copper: #a87b53; }  /* cosmos steel-blue / neutral */
.theme-ocho      { --accent: #d1673c; --copper: #a89079; }  /* burnt orange / greige */
.theme-forever65 { --accent: #c2a24e; --copper: #6a5f9a; }  /* gold stripe / purple */
.theme-manta     { --accent: #8dc63f; --copper: #c89a8b; }  /* gmk lime / rose-gold */
.theme-unikorn   { --accent: #94a05f; --copper: #b98862; }  /* reseda green / copper */
.theme-janeog    { --accent: #6f88ad; --copper: #beb6a4; }  /* blue-gray / champagne */
.theme-janece    { --accent: #b8432f; --copper: #a98763; }  /* re-ano red / carbon */

/* ============ ARCHIVE INDEX ============ */
.archive { max-width: 1400px; margin: 0 auto; padding: clamp(4rem, 9vw, 7rem) var(--pad) 2rem; }

.hero-archive .hero-media img { object-position: center 55%; }

.index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.build-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s;
}
.build-card:hover { border-color: var(--accent); transform: translateY(-3px); }

.card-media { overflow: hidden; aspect-ratio: 4 / 3; }
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.build-card:hover .card-media img { transform: scale(1.04); }

.card-body {
  position: relative;
  padding: 1.3rem 1.3rem 1.5rem;
  border-top: 1px solid var(--line);
}
/* accent hairline that grows on hover */
.card-body::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  height: 2px; width: 0;
  background: var(--accent);
  transition: width 0.4s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.build-card:hover .card-body::before { width: 100%; }

.card-no {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.card-body h3 {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 500;
  margin: 0.35rem 0 0.5rem;
}
.card-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--gray);
  line-height: 1.5;
}
.card-cue {
  display: block;
  margin-top: 1rem;
  color: var(--bone-dim);
  transition: color 0.3s;
}
.build-card:hover .card-cue { color: var(--accent); }

/* ============ BUILD-PAGE NAV ============ */
.back-link {
  display: inline-block;
  margin-bottom: 1.2rem;
  color: var(--bone-dim);
  text-decoration: none;
  transition: color 0.25s;
}
.back-link:hover { color: var(--accent); }

.build-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(2.5rem, 6vw, 4rem) var(--pad);
  border-top: 1px solid var(--line);
}
.build-nav a { color: var(--bone-dim); text-decoration: none; transition: color 0.25s; }
.build-nav a:hover { color: var(--accent); }
.build-nav .disabled { color: var(--line-strong); }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .site-nav { display: none; }
  .spec-row { grid-template-columns: 2.2rem 1fr; }
  .spec-row dd { grid-column: 2; }
  .gallery-grid { grid-template-columns: 1fr; }
  .g-wide { grid-column: span 1; }
  .g-wide img { aspect-ratio: 3 / 2; }
  .index-grid { grid-template-columns: 1fr; }
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
}

@media (min-width: 721px) and (max-width: 980px) {
  .index-grid { grid-template-columns: repeat(2, 1fr); }
}
