/* ============================================================
   JASON NITTI — PORTFOLIO INDEX
   Hand-rolled. No frameworks. Edit freely.
   Theme: monospace index aesthetic, light/dark.
   ============================================================ */

:root {
  --mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", monospace;
  --bg: #f2efe9;
  --ink: #141414;
  --ink-2: #6b6b66;
  --line: #d8d4cb;
  --card: #faf8f4;
  --accent: #ff4d00;
  --maxw: 1280px;
  --chip: rgba(20, 20, 20, .05);        /* soft index-card chip fill (light) */
  --chip-accent: rgba(255, 77, 0, .10);
  /* Writing nav link — ghostwriter microsite's near-black slate reads legibly
     on cream; the phosphor green only shows up on hover/dark mode. */
  --writing-rest: #1d2529;
}
html[data-theme="dark"] {
  --bg: #0f0f0e;
  --ink: #e8e6df;
  --ink-2: #8b8b84;
  --line: #2a2a27;
  --card: #171716;
  --accent: #ff5c14;
  --writing-rest: rgba(52, 245, 178, .55);
  --chip: rgba(255, 255, 255, .06);     /* soft index-card chip fill (dark) */
  --chip-accent: rgba(255, 92, 20, .15);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
}
.brand { font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.brand .dim { color: var(--ink-2); font-weight: 400; }
nav.main { display: flex; gap: 18px; align-items: center; text-transform: uppercase; font-size: 12px; }
nav.main a { color: var(--ink-2); }
nav.main a:hover, nav.main a.active { color: var(--ink); }
nav.main a.writing { color: var(--writing-rest); }
nav.main a.writing:hover { color: #34f5b2; text-shadow: 0 0 10px rgba(52, 245, 178, .5); }
#themeToggle {
  cursor: pointer; background: none; border: 1px solid var(--line);
  color: var(--ink-2); font-family: var(--mono); font-size: 11px;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
#themeToggle:hover { color: var(--ink); border-color: var(--ink-2); }

/* ---------- masthead ---------- */
.masthead { position: relative; border-bottom: 1px solid var(--line); overflow: hidden; }
.masthead video { width: 100%; height: min(62vh, 640px); object-fit: cover; }
.masthead .scrim {
  position: absolute; inset: auto 0 0 0; padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  color: #fff; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.masthead .scrim h1 { margin: 0; font-size: clamp(20px, 4vw, 40px); letter-spacing: .01em; line-height: 1; }
.masthead .scrim .sub { text-align: right; color: rgba(255,255,255,.75); line-height: 1; }

/* ---------- filter bar ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px 6px; align-items: center;
  padding: 16px 0 6px;
}
.filters .label { color: var(--ink-2); font-size: 11px; text-transform: uppercase; margin-right: 6px; }
.fbtn {
  cursor: pointer; font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  background: none; border: 1px solid var(--line); color: var(--ink-2);
  padding: 5px 12px; border-radius: 999px;
  transition: all .15s ease;
}
.fbtn:hover { color: var(--ink); border-color: var(--ink-2); }
.fbtn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fbtn .n { opacity: .55; margin-left: 5px; }
.searchbox {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
}
.searchbox input {
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 5px 2px; width: 160px; outline: none;
}
.searchbox input:focus { border-color: var(--accent); }
.count-line { color: var(--ink-2); font-size: 11px; padding: 6px 0 0; text-transform: uppercase; }

/* ---------- index grid ---------- */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding: 22px 0 60px;
}
.card {
  border: 1px solid var(--line); background: var(--card);
  transition: transform .18s ease, border-color .18s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--ink-2); }
.card .thumb { aspect-ratio: 16/10; overflow: hidden; background: #000; }
.card .thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease, opacity .3s ease;
}
.card:hover .thumb img { transform: scale(1.03); }
.card .body { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .id { color: var(--ink-2); font-size: 10px; letter-spacing: .1em; }
.card h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.card .meta { color: var(--ink-2); font-size: 11px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 6px; }
.tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid var(--line); color: var(--ink-2);
  padding: 2px 8px; border-radius: 999px;
}
.tag.accent { border-color: var(--accent); color: var(--accent); }
/* index cards: soft-filled chips read as intentional metadata without the
   visual weight of an outline (the project-page header keeps its outline) */
.card .tag { border-color: transparent; background: var(--chip); padding: 3px 9px; }
.card .tag.accent { border-color: transparent; background: var(--chip-accent); color: var(--accent); }
.empty { color: var(--ink-2); padding: 40px 0; }

/* ---------- project page ---------- */
.crumbs {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 16px 0; font-size: 12px; text-transform: uppercase; color: var(--ink-2);
}
.crumbs a:hover { color: var(--ink); }
.proj-head { padding: 8px 0 4px; max-width: 900px; }
.proj-head h1 { margin: 0 0 10px; font-size: clamp(24px, 4vw, 40px); line-height: 1.15; }
.proj-head .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.proj-head .summary { font-size: 15px; line-height: 1.65; margin: 0 0 8px; }
.proj-head .summary p { margin: 0 0 10px; }
.proj-links { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; }
.proj-links a {
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--accent); color: var(--accent);
  padding: 7px 16px; border-radius: 999px; transition: all .15s ease;
}
.proj-links a:hover { background: var(--accent); color: var(--bg); }
.details {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 18px 0; margin: 22px 0;
}
.details .d .label { color: var(--ink-2); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.details .d .text { font-size: 12.5px; line-height: 1.5; }

/* ---------- story carousel ---------- */
.story { padding: 8px 0 20px; }
.story .head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding-bottom: 10px;
}
.story .head .t { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.story .counter { font-size: 12px; color: var(--ink-2); }
.story .counter b { color: var(--ink); }

/* media + caption live in one grid: stacked on mobile, side-by-side on wide
   screens so the keyframe text is always visible without scrolling */
.story-grid { display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .story-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .story-grid .caption {
    border-top: 1px solid var(--line); border-left: none;
    display: flex; flex-direction: column; justify-content: flex-start;
    overflow-y: auto;
  }
}
/* keyframe without copy: media takes the full width, panel disappears */
.story-grid.nocap { grid-template-columns: 1fr; }
.story-grid.nocap .caption { display: none; }
.stage {
  position: relative; border: 1px solid var(--line); background: #000;
  min-width: 0;
}
.stage .media {
  aspect-ratio: 16/9; max-height: 62vh; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.stage .media img, .stage .media video { width: 100%; height: 100%; object-fit: contain; }
.navbtn {
  position: absolute; top: 50%; transform: translateY(-50%);
  cursor: pointer; border: none; font-family: var(--mono);
  background: rgba(0,0,0,.45); color: #fff; font-size: 20px;
  width: 44px; height: 64px; z-index: 5;
  transition: background .15s ease;
}
.navbtn:hover { background: var(--accent); }
.navbtn.prev { left: 0; }
.navbtn.next { right: 0; }
/* on the last keyframe the next-arrow becomes a "restart" cue */
.navbtn.restart { background: var(--accent); font-size: 17px; }
.caption {
  border: 1px solid var(--line); border-top: none; background: var(--card);
  padding: 16px 18px; min-height: 84px;
}
.caption .ct { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; }
.caption .cd { margin: 0; color: var(--ink); font-size: 13.5px; line-height: 1.65; max-width: 860px; white-space: pre-line; }
.caption .cd:empty::before { content: "—"; color: var(--ink-2); }
.thumbs {
  display: flex; gap: 8px; padding: 12px 0 0; overflow-x: auto; scrollbar-width: thin;
}
.thumbs button {
  cursor: pointer; padding: 0; border: 2px solid transparent; background: none;
  flex: 0 0 auto; width: 92px; aspect-ratio: 16/10; overflow: hidden; opacity: .55;
  transition: opacity .15s ease, border-color .15s ease;
}
.thumbs button img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button:hover { opacity: .85; }
.thumbs button.active { opacity: 1; border-color: var(--accent); }
.thumbs .vbadge { position: relative; }
.thumbs .vbadge::after {
  content: "▶"; position: absolute; right: 4px; bottom: 2px;
  color: #fff; font-size: 10px; text-shadow: 0 0 4px #000;
}

.proj-footer {
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line); margin-top: 30px; padding: 18px 0 60px;
  font-size: 12px; text-transform: uppercase;
}
.proj-footer a { color: var(--ink-2); max-width: 45%; }
.proj-footer a:hover { color: var(--ink); }

/* ---------- about ---------- */
.about { max-width: 1080px; padding: 40px 0 80px; }
.about-grid { display: grid; grid-template-columns: 1fr; gap: 32px; }
@media (min-width: 820px) { .about-grid { grid-template-columns: 360px 1fr; gap: 48px; } }
.about .portrait img { width: 100%; border: 1px solid var(--line); }
.about .bio { max-width: 640px; }
.about h1 { font-size: clamp(24px, 4vw, 36px); margin: 0 0 24px; }
.about p { font-size: 15px; line-height: 1.8; margin: 0 0 20px; }
.about .links { margin-top: 30px; display: flex; gap: 14px; font-size: 12px; text-transform: uppercase; }
.about .links a { border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px; color: var(--ink-2); }
.about .links a:hover { color: var(--ink); border-color: var(--ink-2); }

/* ---------- footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px; color: var(--ink-2); font-size: 11px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  text-transform: uppercase; letter-spacing: .04em;
}
footer.site a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .masthead video { height: 46vh; }
  .searchbox { margin-left: 0; width: 100%; }
  .searchbox input { width: 100%; }
  .navbtn { width: 36px; height: 52px; font-size: 16px; }
}
