/* ============================================================
   Rob Kirkpatrick — Portfolio
   Modernist Swiss · Helvetica Neue · single-accent
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-alt: #f6f4ef;
  --ink: #111111;
  --ink-2: #2b2b2b;
  --muted: #6b6b6b;
  --rule: #d9d6cf;
  --rule-strong: #1c1c1c;
  --accent: #d83a2a;
  --accent-ink: #ffffff;

  --serif: "Times New Roman", Times, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --pad: clamp(20px, 4vw, 56px);
  --col-gap: clamp(16px, 2vw, 32px);
  --maxw: 1440px;

  --t-mono: 11px;
  --t-body: 17px;
  --t-lead: 22px;
  --t-display: clamp(64px, 13vw, 220px);
  --t-h1: clamp(40px, 7vw, 96px);
  --t-h2: clamp(28px, 4vw, 56px);
}

[data-theme="dark"] {
  --bg: #0e0e0e;
  --bg-alt: #161616;
  --ink: #f3f1ec;
  --ink-2: #d8d5cd;
  --muted: #8a8a8a;
  --rule: #2a2a2a;
  --rule-strong: #f3f1ec;
}

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

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.45;
  letter-spacing: -0.005em;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* ---------- Type ---------- */
.mono {
  font-family: var(--mono);
  font-size: var(--t-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 500;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.035em; line-height: 0.92; }

.display {
  font-size: var(--t-display);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.84;
  color: var(--ink);
}

.h1 { font-size: var(--t-h1); letter-spacing: -0.04em; line-height: 0.92; }
.h2 { font-size: var(--t-h2); letter-spacing: -0.035em; line-height: 0.96; }

.lead {
  font-size: var(--t-lead);
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--ink);
  font-weight: 400;
  max-width: 28ch;
}

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

/* ---------- Layout ---------- */
.shell { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--col-gap);
}

section { position: relative; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 24px; height: 24px; }
.brand .mark .stroke { stroke: var(--ink); }
.brand .name {
  font-family: var(--sans); font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em; color: var(--ink);
}
.nav { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); }
.nav a {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-2);
  padding: 6px 0; position: relative;
}
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--accent);
}
.nav a:hover { color: var(--ink); }

/* ---------- Hero (home) ---------- */
.hero {
  padding-top: clamp(40px, 8vw, 96px);
  padding-bottom: clamp(48px, 8vw, 120px);
  border-bottom: 1px solid var(--rule);
}
.hero-meta {
  grid-column: 1 / span 4;
  display: flex; flex-direction: column; gap: 24px;
  align-self: end;
}
.hero-meta .row {
  display: grid; grid-template-columns: 80px 1fr; gap: 12px;
  border-top: 1px solid var(--rule); padding-top: 10px;
}
.hero-display {
  grid-column: 5 / -1;
  margin: 0; align-self: end;
}
.hero-display .row-1 { display: block; }
.hero-display .row-2 { display: block; }
.hero-display .dot {
  display: inline-block; width: 0.32em; height: 0.32em;
  border-radius: 50%; background: var(--accent);
  vertical-align: 0.18em; margin-right: 0.16em;
}

.hero-strip {
  margin-top: clamp(32px, 5vw, 56px);
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center;
}
.hero-strip .lead { max-width: 38ch; }
.hero-strip .right { text-align: right; }

/* ---------- Section header ---------- */
.section {
  padding-top: clamp(56px, 8vw, 120px);
  padding-bottom: clamp(56px, 8vw, 120px);
  border-bottom: 1px solid var(--rule);
}
.section-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--col-gap);
  margin-bottom: clamp(28px, 4vw, 64px);
  align-items: end;
}
.section-head .num { grid-column: 1 / span 2; }
.section-head .label { grid-column: 3 / span 4; }
.section-head .desc {
  grid-column: 8 / span 5;
  font-size: var(--t-lead); line-height: 1.35; color: var(--ink);
  max-width: 44ch; letter-spacing: -0.012em;
}

/* ---------- Currently (home) ---------- */
.currently { display: contents; }
.currently .card {
  grid-column: span 4;
  border-top: 1px solid var(--rule-strong);
  padding-top: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.currently .card h3 { font-size: 26px; letter-spacing: -0.02em; line-height: 1.05; }
.currently .card p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.currently .card .tag { display: flex; gap: 10px; align-items: center; }
.currently .card .tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }

/* ---------- Work list ---------- */
.work-list { grid-column: 1 / -1; }
.work-row {
  display: grid;
  grid-template-columns: 56px 1fr 1.4fr 110px 80px;
  gap: 24px;
  align-items: baseline;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
  position: relative;
}
.work-row:last-child { border-bottom: 1px solid var(--rule); }
.work-row .idx { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }
.work-row .title { font-size: clamp(22px, 2.4vw, 32px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.04; }
.work-row .desc { font-size: 15px; color: var(--ink-2); line-height: 1.45; }
.work-row .year { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); text-align: right; }
.work-row .arrow { text-align: right; font-size: 18px; transition: transform 200ms ease; }
.work-row:hover .arrow { transform: translateX(6px); color: var(--accent); }
.work-row:hover .title { color: var(--accent); }

/* ---------- Photo gallery (home strip) ---------- */
.photo-strip {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--col-gap);
}
.photo-strip .ph { display: flex; flex-direction: column; gap: 10px; }
.photo-strip .cap {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase;
}
.photo-strip .cap b { color: var(--ink); font-weight: 500; }

/* ---------- Placeholder image ---------- */
.ph-box {
  position: relative; width: 100%; background: var(--bg-alt);
  overflow: hidden; isolation: isolate;
}
.ph-box .ph-fill {
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(135deg,
      color-mix(in oklab, var(--ink) 6%, transparent) 0 1px,
      transparent 1px 10px);
}
.ph-box .ph-label {
  position: absolute; left: 14px; bottom: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink);
  background: var(--bg); padding: 4px 8px;
  border: 1px solid var(--rule);
}
.ph-box[data-ratio="3:4"] { aspect-ratio: 3 / 4; }
.ph-box[data-ratio="4:3"] { aspect-ratio: 4 / 3; }
.ph-box[data-ratio="1:1"] { aspect-ratio: 1 / 1; }
.ph-box[data-ratio="16:9"] { aspect-ratio: 16 / 9; }
.ph-box[data-ratio="2:3"] { aspect-ratio: 2 / 3; }
.ph-box[data-ratio="3:2"] { aspect-ratio: 3 / 2; }
.ph-box[data-ratio="21:9"] { aspect-ratio: 21 / 9; }
.ph-box[data-ratio="hero"] { aspect-ratio: 16 / 10; }

/* Real image uploaded through /admin — fills the placeholder box */
.ph-box > img.ph-img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
}

/* ---------- Footer ---------- */
.footer {
  padding: clamp(40px, 6vw, 80px) 0 32px;
  border-top: 1px solid var(--rule-strong);
}
.footer-inner {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--col-gap);
  align-items: start;
}
.footer .col { grid-column: span 3; display: flex; flex-direction: column; gap: 10px; }
.footer .col .h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.footer .col a { display: inline-block; padding: 2px 0; }
.footer .col a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.footer .big {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(180px, 36vw, 560px);
  letter-spacing: -0.07em; line-height: 0.82;
  color: var(--ink); text-transform: none;
  margin: clamp(40px, 6vw, 80px) 0 0;
  display: block;
  overflow: hidden;
}

/* ---------- Reveal on scroll (hidden only after JS confirms ready) ---------- */
.js-ready [data-reveal] {
  opacity: 0; transform: translateY(18px);
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.7,.2,1);
}
.js-ready [data-reveal].in { opacity: 1; transform: none; }
.js-ready [data-reveal="up-lg"] { transform: translateY(40px); }
.js-ready [data-reveal="up-lg"].in { transform: none; }
.js-ready [data-reveal="char"] { display: inline-block; transform: translateY(110%); transition: transform 800ms cubic-bezier(.2,.7,.2,1); opacity: 1; }
.js-ready [data-reveal="char"].in { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js-ready [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- Tweaks panel ---------- */
.tweaks {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--rule-strong);
  width: 280px;
  padding: 16px;
  font-family: var(--sans);
  display: none; flex-direction: column; gap: 14px;
  box-shadow: 0 18px 40px -20px rgba(0,0,0,0.25);
}
.tweaks.open { display: flex; }
.tweaks .head { display: flex; justify-content: space-between; align-items: center; }
.tweaks .head .h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.tweaks .head .close { font-family: var(--mono); font-size: 12px; cursor: pointer; }
.tweaks .row { display: flex; flex-direction: column; gap: 8px; }
.tweaks .row .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tweaks .swatches { display: flex; gap: 8px; }
.tweaks .swatches button { width: 28px; height: 28px; border: 2px solid var(--rule); cursor: pointer; }
.tweaks .swatches button[data-active="true"] { border-color: var(--ink); outline: 2px solid var(--bg); outline-offset: -4px; }
.tweaks .seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--rule-strong); }
.tweaks .seg button {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 8px 10px;
}
.tweaks .seg button[data-active="true"] { background: var(--ink); color: var(--bg); }

/* ---------- About page ---------- */
.about-hero { padding: clamp(60px, 10vw, 140px) 0 clamp(40px, 6vw, 80px); border-bottom: 1px solid var(--rule); }
.about-hero .label { grid-column: 1 / span 4; align-self: end; }
.about-hero .heading { grid-column: 5 / -1; }
.about-bio { padding: clamp(56px, 8vw, 120px) 0; border-bottom: 1px solid var(--rule); }
.about-bio .stick { grid-column: 1 / span 4; position: sticky; top: 90px; align-self: start; }
.about-bio .copy { grid-column: 6 / span 7; display: flex; flex-direction: column; gap: 24px; }
.about-bio .copy p { margin: 0; font-size: 19px; line-height: 1.55; max-width: 60ch; color: var(--ink-2); }
.about-bio .copy p:first-of-type { font-size: 26px; line-height: 1.35; letter-spacing: -0.018em; color: var(--ink); max-width: 24ch; }
.about-bio .portrait { width: 100%; }

.timeline { padding: clamp(56px, 8vw, 120px) 0; border-bottom: 1px solid var(--rule); }
.timeline .row {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 80px 110px 1fr 1fr; gap: 24px;
  padding: 22px 0; border-top: 1px solid var(--rule);
  align-items: baseline;
}
.timeline .row:last-child { border-bottom: 1px solid var(--rule); }
.timeline .row .idx { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.timeline .row .yr { font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em; }
.timeline .row .role { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.timeline .row .place { font-size: 15px; color: var(--ink-2); line-height: 1.45; }

.factstrip { padding: clamp(40px, 6vw, 80px) 0; border-bottom: 1px solid var(--rule); }
.factstrip .item { grid-column: span 3; display: flex; flex-direction: column; gap: 8px; }
.factstrip .item .n {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(40px, 6vw, 84px); letter-spacing: -0.04em; line-height: 0.9;
}
.factstrip .item .l { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Work page ---------- */
.work-hero { padding: clamp(60px, 10vw, 140px) 0 clamp(40px, 6vw, 80px); border-bottom: 1px solid var(--rule); }
.work-hero .label { grid-column: 1 / span 4; align-self: end; }
.work-hero .h { grid-column: 5 / -1; }

.case {
  padding: clamp(40px, 6vw, 80px) 0;
  border-bottom: 1px solid var(--rule);
}
.case .num { grid-column: 1 / span 2; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; color: var(--muted); }
.case .meta { grid-column: 1 / span 4; display: flex; flex-direction: column; gap: 16px; align-self: start; position: sticky; top: 90px; }
.case .meta .yr { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }
.case .meta .role { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }
.case .body { grid-column: 5 / -1; display: flex; flex-direction: column; gap: 24px; }
.case .body h2 { font-size: clamp(34px, 5vw, 64px); letter-spacing: -0.035em; line-height: 0.96; }
.case .body p { margin: 0; font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.case .body .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.case .body .tags span {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 9px; border: 1px solid var(--rule-strong); color: var(--ink);
}
.case .body .frame { width: 100%; margin-top: 12px; }

/* ---------- Photo page ---------- */
.photo-hero { padding: clamp(60px, 10vw, 140px) 0 clamp(40px, 6vw, 80px); border-bottom: 1px solid var(--rule); }
.photo-hero .label { grid-column: 1 / span 4; align-self: end; }
.photo-hero .h { grid-column: 5 / -1; }
.photo-hero .desc { grid-column: 1 / span 6; margin-top: 28px; }

.gallery { padding: clamp(40px, 6vw, 80px) 0 clamp(56px, 8vw, 120px); border-bottom: 1px solid var(--rule); }
.gallery-grid {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--col-gap) calc(var(--col-gap) * 1.5);
}
.gallery-item { display: flex; flex-direction: column; gap: 10px; }
.gallery-item .cap {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase;
}
.gallery-item .cap b { color: var(--ink); font-weight: 500; }
.gallery-item .cap .right { color: var(--muted); }

/* size variants */
.gi-6 { grid-column: span 6; }
.gi-7 { grid-column: span 7; }
.gi-5 { grid-column: span 5; }
.gi-4 { grid-column: span 4; }
.gi-8 { grid-column: span 8; }
.gi-12 { grid-column: 1 / -1; }
.gi-3 { grid-column: span 3; }

/* ---------- Contour SVG divider ---------- */
.contour-divider {
  grid-column: 1 / -1;
  width: 100%; height: 80px; opacity: 0.55;
}
.contour-divider path { fill: none; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* ---------- Marquee / status line ---------- */
.statusline {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink);
}
.statusline .pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 50%, transparent);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 50%, transparent); }
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .hero-meta { grid-column: 1 / -1; }
  .hero-display { grid-column: 1 / -1; margin-top: 24px; }
  .hero-strip { grid-template-columns: 1fr; }
  .hero-strip .right { text-align: left; }
  .section-head .num { grid-column: 1 / -1; }
  .section-head .label { grid-column: 1 / -1; }
  .section-head .desc { grid-column: 1 / -1; }
  .currently .card { grid-column: 1 / -1; }
  .work-row { grid-template-columns: 40px 1fr 60px; gap: 12px; }
  .work-row .desc, .work-row .year { display: none; }
  .photo-strip .ph[data-mobile-hide="true"] { display: none; }
  .about-hero .label, .about-hero .heading, .about-bio .stick, .about-bio .copy { grid-column: 1 / -1; }
  .about-bio .stick { position: static; }
  .timeline .row { grid-template-columns: 50px 1fr; }
  .timeline .row .place { display: none; }
  .factstrip .item { grid-column: span 6; }
  .footer .col { grid-column: span 6; }
  .case .meta, .case .body, .work-hero .label, .work-hero .h, .photo-hero .label, .photo-hero .h, .photo-hero .desc { grid-column: 1 / -1; position: static !important; }
  .gi-3, .gi-4, .gi-5, .gi-6, .gi-7, .gi-8, .gi-12 { grid-column: 1 / -1; }
}

/* Tweaks toggle FAB */
.tweaks-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: none; align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,0.35);
}
.tweaks-fab.show { display: flex; }
.tweaks-fab svg { width: 18px; height: 18px; }
