/* ============================================================
   Clint Beharry — Portfolio
   Editorial: serif headlines + sans body, neutral + 1 accent.
   All aesthetic levers are CSS variables driven by Tweaks.
   ============================================================ */

:root {
  /* —— driven by Tweaks —— */
  --accent: oklch(0.62 0.14 38);
  --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);
  --font-display: "Amethysta", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;

  /* —— neutral system (dark) —— */
  --bg: oklch(0.26 0.018 300);
  --surface: oklch(0.305 0.02 300);
  --fg: oklch(0.93 0.006 95);
  --muted: oklch(0.7 0.01 270);
  --faint: oklch(0.58 0.01 270);
  --line: oklch(0.31 0.01 270);
  --line-strong: oklch(0.41 0.012 270);

  --maxw: 1180px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 4px;

  --ease: cubic-bezier(0.4, 0, 0.1, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

#about, #contact, #work { scroll-margin-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga";
}

::selection { background: var(--accent-soft); }

a { color: inherit; text-decoration: none; }

.shell { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* —— display type —— */
.display {
  font-family: var(--font-display);
  font-weight: 420;
  letter-spacing: -0.012em;
  line-height: 1.02;
  font-optical-sizing: auto;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--faint);
  font-family: var(--font-body);
}
.mono {
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklch, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand > span:last-child { padding-left: 13px; }
.brand .dot {
  width: 4px; height: 40px; border-radius: 1px;
  display: inline-block;
  background: linear-gradient(180deg,
    oklch(0.64 0.14 30) 0 16%, transparent 16% 21%,
    oklch(0.68 0.13 55) 21% 37%, transparent 37% 42%,
    oklch(0.7 0.12 80) 42% 58%, transparent 58% 63%,
    oklch(0.62 0.15 10) 63% 79%, transparent 79% 84%,
    oklch(0.6 0.13 350) 84% 100%);
}
.topnav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 34px);
}
.topnav a {
  font-size: 14px;
  color: var(--muted);
  position: relative;
  transition: color 0.2s var(--ease);
}
.topnav a:hover { color: var(--fg); }
/* hover cue: a rule that grows downward on the left of the label — it points
   the way the page moves when you follow the link */
.topnav a::after {
  content: "";
  position: absolute; left: -9px; top: 2px; bottom: 100%;
  width: 1.5px; background: var(--fg);
  transition: bottom 0.28s var(--ease);
}
.topnav a:hover::after { bottom: -6px; }
.topnav .nav-hide { }
@media (max-width: 680px) { .topnav .nav-hide { display: none; } }
@media (max-width: 520px) {
  .brand { font-size: 16px; gap: 7px; padding-right: 14px; }
  .topnav { gap: 16px; }
  .topnav .tab, .topnav a { font-size: 13px; }
}

.topnav .tab {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.topnav .tab:hover { color: var(--fg); }
.topnav .tab.on { color: var(--fg); }
.topnav .tab::after {
  content: "";
  position: absolute; left: 0; right: 100%; bottom: -6px;
  height: 1.5px; background: var(--fg);
  transition: right 0.28s var(--ease);
}
.topnav .tab:hover::after, .topnav .tab.on::after { right: 0; }

/* ============================================================
   Hero / intro
   ============================================================ */
.hero { padding: clamp(24px, 3.5vw, 44px) 0 0; }
.hero-emblem {
  flex: 0 0 auto; width: clamp(95px, 9.3vw, 136px);
  margin-top: 0;
  pointer-events: none;
}
.hero-emblem img { width: 100%; height: auto; display: block; }
.hero-emblem { padding-right: 10px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
}
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 36px; } }

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.14;
  padding-bottom: 0.06em;
}
.hero h1 .accent { color: var(--accent); font-style: italic; }
.hero-sub {
  margin: 30px 0 0;
  font-size: clamp(16px, 1.7vw, 18px);
  color: var(--muted);
  max-width: 46ch;
  text-wrap: pretty;
}
.hero-meta { display: flex; flex-direction: column; gap: 18px; }
.hero-meta .row { display: flex; flex-direction: column; gap: 5px; }
.hero-meta .row .k { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.hero-meta .row .v { font-size: 15.5px; color: var(--fg); }
.hero-meta .row .v a:hover { color: var(--accent); }
.hero-links { display: flex; gap: 8px; flex-wrap: wrap; }

/* —— hero: 3-column pillar spread (Product tab) —— */
.hero3-intro {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px;
  padding-bottom: 0;
  margin-bottom: 0;
}
.hero3-headline {
  flex: 1 1 auto; min-width: 0; margin: 0;
  font-family: var(--font-display); font-weight: 430;
  font-size: clamp(21px, 2.7vw, 34px); line-height: 1.16;
  letter-spacing: -0.015em; color: var(--fg);
  text-wrap: balance;
  max-width: 620px;
}
.hero3-tagline {
  display: block; margin-top: 4px;
  font-family: var(--font-body); font-weight: 500;
  font-size: clamp(14px, 1.4vw, 17px); line-height: 1.4;
  color: var(--muted); white-space: nowrap;
  margin-left: auto; margin-right: auto;
}
.hero3-lead {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(14px, 1.8vw, 22px);
  max-width: 780px; min-width: 0;
}
.hero3-loc {
  flex: 0 0 auto;
  font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); font-weight: 400;
}
.hero-stairs { display: block; width: 96px; height: 56px; margin: -6px auto 0; overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(115deg, transparent 0, transparent 18%, black 40%, black 60%, transparent 82%, transparent 100%); mask-image: linear-gradient(115deg, transparent 0, transparent 18%, black 40%, black 60%, transparent 82%, transparent 100%); }
.hero-stairs-track { position: absolute; left: 20px; bottom: 20px; display: flex; align-items: flex-end; animation: hsClimb 12s linear infinite; }
.hs-step { display: flex; gap: 3px; align-items: flex-end; }
.hs-step i { width: 16px; height: 4px; display: block; }
.hs-step i:nth-child(1) { background: oklch(0.64 0.14 30); margin-bottom: 0; }
.hs-step i:nth-child(2) { background: oklch(0.68 0.13 55); margin-bottom: 7px; }
.hs-step i:nth-child(3) { background: oklch(0.7 0.12 80); margin-bottom: 14px; }
.hs-step i:nth-child(4) { background: oklch(0.62 0.15 10); margin-bottom: 21px; }
.hs-step i:nth-child(5) { background: oklch(0.6 0.13 350); margin-bottom: 28px; }
.hs-step:nth-child(1) { transform: translateY(0); }
.hs-step:nth-child(2) { transform: translateY(-35px); margin-left: 3px; }
.hs-step:nth-child(3) { transform: translateY(-70px); margin-left: 3px; }
@keyframes hsClimb {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-95px, 35px); }
}
.hero3-intro-side {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  gap: 14px;
}
.hero3 {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(26px, 3.6vw, 60px);
}
.hero3-col { min-width: 0; position: relative; }
.hero3-col + .hero3-col::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(-1 * clamp(13px, 1.8vw, 30px));
  width: 1px; background: var(--line);
}
.hero3-num {
  display: flex; align-items: center;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; margin-bottom: 18px;
}
.hero3-num .accent { color: var(--accent); }
.hero3-text {
  margin: 0;
  font-size: clamp(20px, 2.05vw, 27px);
  line-height: 1.32; letter-spacing: -0.01em;
  color: var(--fg); text-wrap: pretty;
}
.hero3-foot { margin-top: clamp(34px, 4.5vw, 56px); }
.tri-section { padding: clamp(70px, 9vw, 130px) 0 clamp(40px, 5vw, 70px); }
.hero3-tri {
  display: block; position: relative;
  height: clamp(200px, 19vw, 250px);
  margin: 0 auto;
}
.hero3-tri-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hero3-tri-lines line { stroke: var(--line); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.hero3-tri .hero3-col { position: absolute; width: clamp(190px, 24vw, 270px); text-align: center; }
.hero3-tri .hero3-col::before { display: none; }
.hero3-tri-biz { top: 0; left: 50%; transform: translateX(-50%); }
.hero3-tri-design { top: 62%; left: 2%; }
.hero3-tri-tech { top: 62%; right: 2%; }
.hero3-tri .hero3-num { justify-content: center; font-size: 12px; }
.hero3-tri .hero3-text { margin-left: auto; margin-right: auto; font-size: clamp(16px, 1.7vw, 20px); line-height: 1.32; }
@media (max-width: 860px) {
  .hero3 { grid-template-columns: 1fr; gap: 0; }
  .hero3-col + .hero3-col::before { display: none; }
  .hero3-col + .hero3-col {
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  }
  .hero3-tri .hero3-col + .hero3-col { margin-top: 0; padding-top: 0; border-top: none; }
  .approach-eyebrow { white-space: normal; }
  .approach-cols.hero3 { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .approach-cols .hero3-col + .hero3-col::before { display: block; left: -6px; }
  .approach-cols .hero3-col + .hero3-col { margin-top: 0; padding-top: 0; border-top: none; }
  .approach-cols .hero3-num { font-size: 9.5px; margin-bottom: 8px; gap: 4px; }
  .approach-cols .goal-col { font-size: 12px; }
  .approach-cols .goal-item { font-size: 11.5px; line-height: 1.3; }
}
@media (max-width: 860px) {
  .hero3-tri { height: clamp(180px, 30vw, 230px); margin-top: 24px; }
  .hero3-tri .hero3-col { width: clamp(110px, 32vw, 160px); }
  .hero3-tri .hero3-num { font-size: 10px; gap: 4px; margin-bottom: 8px; }
  .hero3-tri .hero3-text { font-size: clamp(12px, 3.2vw, 14px); line-height: 1.3; }
}
@media (min-width: 861px) { .approach-eyebrow { white-space: nowrap; } }

/* directly-editable text (author mode) */
.editable-line {
  outline: none; cursor: text;
  border-radius: var(--radius, 4px);
  margin-left: -8px; margin-right: -8px; padding: 4px 8px;
  transition: box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}
.editable-line:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.editable-line:focus { box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface); }
.editable-line:empty::before { content: attr(data-placeholder); color: var(--faint); font-style: italic; }

/* —— approach: transition section between hero and work —— */
.approach { padding: clamp(10px, 1.5vw, 18px) 0 clamp(20px, 3vw, 36px); }
@media (max-width: 860px) { .approach { padding-top: clamp(45px, 11vw, 65px); } }
.approach-intro { max-width: 560px; margin-bottom: clamp(34px, 4.5vw, 54px); }
.approach-eyebrow {
  display: block;
  font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 14px;
}
.approach-headline {
  margin: 0; font-weight: 430; font-size: clamp(18px, 2vw, 24px);
  line-height: 1.28; letter-spacing: -0.012em; color: var(--fg);
  text-wrap: balance;
}
.approach-cols .goal-col {
  position: relative;
  height: clamp(52px, 6vw, 64px);
  margin-top: 18px;
}
.goal-item {
  position: absolute; left: 0; right: 0; top: 0;
  font-size: clamp(16px, 1.5vw, 18.5px); line-height: 1.35;
  letter-spacing: -0.005em; color: var(--muted);
  text-wrap: pretty;
}
.goal-static { position: static; }
@media (prefers-reduced-motion: no-preference) {
  .goal-item:not(.goal-static) {
    animation: goalCycle 2600ms var(--ease) both;
  }
}
@keyframes goalCycle {
  0% { opacity: 0; transform: translateY(10px); }
  10%, 78% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}
@media (max-width: 860px) {
  .approach-cols .goal-col { height: auto; min-height: 2.8em; }
  .work .section-head { margin-top: clamp(28px, 8vw, 44px); }
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  color: var(--muted);
  transition: all 0.2s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* section heading rhythm */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; padding-bottom: 20px; margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { margin: 0; font-size: clamp(13px,2vw,14px); letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; color: var(--faint); font-family: var(--font-body); }
.section-head .count { font-size: 13px; color: var(--faint); }

/* ============================================================
   About
   ============================================================ */
.about { padding: clamp(40px, 7vw, 88px) 0; border-top: 1px solid var(--line); }
.about-grid {
  display: grid; grid-template-columns: 0.5fr 1fr; gap: clamp(24px,5vw,70px);
  margin-top: 44px; align-items: start;
}
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; gap: 24px; } }
.about-body p { margin: 0 0 20px; font-size: clamp(19px, 2.3vw, 24px); line-height: 1.5; color: var(--fg); text-wrap: pretty; }
.about-body p:last-child { margin-bottom: 0; }
.about-body .lead-em { color: var(--accent); font-family: var(--font-display); font-style: italic; }
.about-list { display: flex; flex-direction: column; gap: 18px; }
.about-list .item .k { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-bottom: 6px; }
.about-list .item .v { font-size: 15px; color: var(--muted); line-height: 1.5; }

/* ============================================================
   Work / projects
   ============================================================ */
.work { padding: 35px 0 40px; }
.projects { display: flex; flex-direction: column; gap: clamp(24px, 3.5vw, 40px); }

.project {
  padding: clamp(40px, 6vw, 80px) clamp(22px, 3.4vw, 36px);
  border-left: 4px solid var(--tint, var(--accent));
  background: color-mix(in oklch, var(--tint, var(--accent)) 6%, var(--bg));
  border-radius: 0 var(--radius) var(--radius) 0;
}
.project:first-child { padding-top: clamp(28px, 4vw, 48px); }

.project-index {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 22px;
}
.project-index .num { font-size: 13px; color: var(--tint, var(--accent)); font-weight: 600; display: inline-flex; align-items: center; }
.project-index .num::after { content: "·"; margin-left: 14px; font-size: 13px; line-height: 1; color: var(--line-strong); font-weight: 400; }
.project-index .tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.project-index .tag { font-size: 12px; letter-spacing: 0.04em; color: var(--faint); }
.project-index .tag + .tag::before { content: "·"; margin-right: 8px; color: var(--line-strong); }

/* —— project hero image —— */
.project-hero { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius, 4px); overflow: hidden; background: var(--surface); }

/* —— project body —— */
.project-body { margin-top: clamp(26px, 4vw, 40px); }
.project-head {
  display: grid; grid-template-columns: 1fr auto; gap: 20px 40px;
  align-items: baseline;
}
@media (max-width: 680px) { .project-head { grid-template-columns: 1fr; } }
.project-title { margin: 0; font-size: clamp(30px, 5vw, 52px); color: var(--tint, var(--fg)); }
.project-year { font-size: 14px; color: var(--faint); white-space: nowrap; }
.project-desc {
  margin: 16px 0 0; font-size: clamp(18px, 2.3vw, 22px);
  color: var(--muted); max-width: 60ch; text-wrap: pretty; line-height: 1.45;
}

.cols {
  margin-top: clamp(30px, 4vw, 44px);
  display: flex; flex-direction: column;
  gap: 0;
}
.col { display: grid; grid-template-columns: 2fr 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; padding-top: clamp(40px, 6vw, 64px); }
.col:first-child { padding-top: 0; }
@media (max-width: 760px) { .col { grid-template-columns: 1fr; } }
.col .col-label {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; color: var(--fg);
  grid-column: 1 / -1;
  padding-bottom: 0; margin-bottom: -14px;
}
.col .col-label .ix { color: var(--tint, var(--accent)); }
.col-image { width: 100%; aspect-ratio: 4/3; margin-bottom: 0; }
.col p { margin: 0; font-size: 16.5px; color: var(--muted); line-height: 1.6; text-wrap: pretty; }

/* ============================================================
   Footer
   ============================================================ */
.footer { border-top: 1px solid var(--line); padding: clamp(56px, 9vw, 110px) 0 56px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: end; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 40px; } }
.footer h3 { margin: 0; font-size: clamp(30px, 6vw, 60px); }
.footer h3 a { color: var(--accent); font-style: italic; }
.footer h3 a:hover { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1.5px; }
.footer-links { display: flex; flex-direction: column; gap: 11px; }
.footer-links a { font-size: 15.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 9px; width: fit-content; transition: color 0.2s; }
.footer-links a:hover { color: var(--fg); }
.footer-links a .ext { width: 13px; height: 13px; stroke: var(--faint); }
.footer-base { margin-top: clamp(40px,7vw,72px); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--faint); }

/* hero text swaps instantly on tab change (no opacity animation — must stay visible everywhere) */

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* project reveal — React owns the `in` class via state, so a re-render on
   expand/collapse can never strip it and re-hide the project. */
.project-reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.project-reveal.in { opacity: 1; transform: none; }
/* Safeguard: an expanded project is ALWAYS instantly visible — no transition
   that could freeze at opacity 0 and hide the content you just expanded. */
.project-reveal.open { opacity: 1 !important; transform: none !important; transition: none; }
@media (prefers-reduced-motion: reduce) {
  .project-reveal { opacity: 1; transform: none; transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
