/* =========================================================
   Valen Hu — Portfolio
   A quiet, editorial container. The colour lives in the work.
   Type: Fraunces (display) · Hanken Grotesk (text) · Spline Sans Mono (labels)
   ========================================================= */

:root {
  /* Paper & ink */
  --paper:      #F4EFE6;   /* warm page */
  --paper-2:    #FAF6EE;   /* cards / raised surfaces */
  --ink:        #1C1916;   /* near-black, warm */
  --ink-soft:   #4C463E;   /* secondary text */
  --ink-mute:   #8C8478;   /* meta / muted */
  --line:       #E1D8C8;   /* hairlines */
  --line-soft:  #ECE4D6;
  --accent:     #B5532E;   /* burnt clay — used sparingly */
  --accent-ink: #8E3F22;

  /* Brand inks for the default card logos */
  --m-blue:     #00274C;

  /* Type */
  --display: "Newsreader", Georgia, serif;
  --text:    "Hanken Grotesk", system-ui, sans-serif;
  --mono:    "Spline Sans Mono", ui-monospace, monospace;

  /* Rhythm */
  --wrap: 1180px;
  --gut: clamp(20px, 5vw, 56px);
  --r: 14px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

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

/* Subtle paper grain — atmosphere without noise */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ---------- Monogram ---------- */
.monogram { height: 16px; width: auto; }
.monogram--lg { height: 30px; width: auto; }

/* ================= NAV ================= */
.nav {
  position: sticky; top: 0; z-index: 100;
  transition: background .35s var(--ease), border-color .35s var(--ease), backdrop-filter .35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom-color: var(--line);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px;
}
.nav__brand { display: inline-flex; align-items: baseline; gap: 10px; }
.nav__name {
  font-family: var(--display);
  font-weight: 500; font-size: 18px; letter-spacing: .2px;
}
.nav__links { display: flex; align-items: center; gap: clamp(16px, 3vw, 30px); }
.nav__links > a:not(.btn) {
  font-size: 14.5px; color: var(--ink-soft);
  position: relative; padding: 4px 0;
  transition: color .2s var(--ease);
}
.nav__links > a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 0; height: 1.5px; background: var(--ink);
  transition: width .3s var(--ease);
}
.nav__links > a:not(.btn):hover { color: var(--ink); }
.nav__links > a:not(.btn):hover::after { width: 100%; }

.btn {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: .3px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent-ink);
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn--resume span { transition: transform .25s var(--ease); display: inline-block; }
.btn--resume:hover { background: var(--accent); color: var(--paper); }
.btn--resume:hover span { transform: translateY(2px); }

/* ================= HERO ================= */
.hero { padding-top: clamp(70px, 13vh, 150px); padding-bottom: clamp(60px, 10vh, 120px); }
.eyebrow {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: .6px;
  color: var(--ink-mute);
  display: inline-flex; align-items: center; gap: 9px;
  text-transform: uppercase;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3D7A4E;
  box-shadow: 0 0 0 0 rgba(61,122,78,.5);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61,122,78,.45); }
  70%  { box-shadow: 0 0 0 7px rgba(61,122,78,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,122,78,0); }
}
.hero__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(44px, 8vw, 96px);
  line-height: 1.06;
  letter-spacing: -0.005em;
  margin: 26px 0 0;
  font-optical-sizing: auto;
}
.hero__sub {
  max-width: 40ch;
  margin-top: 30px;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--ink-soft);
  line-height: 1.55;
}
.hero__scroll {
  margin-top: 52px;
  font-family: var(--mono);
  font-size: 13px; letter-spacing: .5px;
  color: var(--ink-mute);
  text-transform: uppercase;
}

/* ================= SECTIONS ================= */
.section { padding-block: clamp(56px, 9vh, 110px); }
.section__head { margin-bottom: clamp(34px, 5vh, 56px); }
.section__index {
  font-family: var(--mono);
  font-size: 13px; color: var(--accent-ink); letter-spacing: 1px;
}
.section__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05; letter-spacing: -.01em;
  margin-top: 6px;
}
.section__note {
  margin-top: 16px; max-width: 52ch;
  color: var(--ink-soft); font-size: 16px;
}

/* ================= WORK CARDS ================= */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 26px);
}
/* The <a> is a slot that always reserves the full footprint, so neighbours
   never shift when a card expands. The visible card is .card__inner. */
.card {
  position: relative;
  aspect-ratio: 5 / 6;
}
.card.reveal {
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}

.card__inner {
  position: absolute; inset: 0;          /* default (touch): fills the slot */
  border-radius: var(--r);
  background: var(--paper-2);
  border: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
  transition: inset .55s var(--ease), box-shadow .55s var(--ease), border-color .4s var(--ease);
}

/* default state: logo only, centred */
.card__logo {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  padding: 12% 14%;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.card__logo img, .card__logo svg { width: auto; height: auto; max-height: 86%; max-width: 62%; }
.card__logo .blockm { color: var(--m-blue); max-width: 50%; }
.card__logo img[src*="perch"] { max-width: 42%; }
.card__logo img[src*="flowpilot"] { max-width: 56%; }

/* reveal state: hero floods in + frosted caption */
.card__reveal {
  position: absolute; inset: 0; z-index: 1;
  opacity: 0;
  transition: opacity .45s var(--ease);
}
.card__shot {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 35%;
  transform: scale(1.04);
  transition: transform .6s var(--ease);
}
.card__caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 26px 20px 18px;
  color: var(--paper);
  text-shadow: 0 1px 10px rgba(8,7,6,.55);
  background: linear-gradient(to top,
    rgba(12,10,9,.97) 0%,
    rgba(12,10,9,.93) 32%,
    rgba(12,10,9,.62) 64%,
    rgba(12,10,9,0) 100%);
}
.card__tag {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: .5px; text-transform: uppercase;
  color: rgba(244,239,230,.8);
}
.card__name {
  font-family: var(--display);
  font-size: 22px; font-weight: 500; line-height: 1.1;
  margin-top: 2px;
}
.card__line { font-size: 13.5px; color: rgba(244,239,230,.92); line-height: 1.4; }
.card__go {
  font-family: var(--mono);
  font-size: 12px; letter-spacing: .4px;
  margin-top: 10px; color: var(--paper);
}

/* Desktop hover: rest as a compact centred tile, expand to fill on hover */
@media (hover: hover) and (pointer: fine) {
  .card__inner { inset: 23% 9%; }
  .card:hover { z-index: 3; }
  .card:hover .card__inner {
    inset: 0;
    box-shadow: 0 26px 54px -24px rgba(28,25,22,.42);
    border-color: var(--line-soft);
  }
  .card:hover .card__logo { opacity: 0; transform: scale(.9); }
  .card:hover .card__reveal { opacity: 1; }
  .card:hover .card__shot { transform: scale(1); }
}
/* Touch / no-hover: full size, show the informative reveal state */
@media (hover: none), (pointer: coarse) {
  .card { aspect-ratio: 4 / 5; }
  .card__logo { display: none; }
  .card__reveal { opacity: 1; }
  .card__shot { transform: scale(1); }
}

/* ================= ABOUT ================= */
.about {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(34px, 6vw, 86px);
  align-items: start;
}
.about__body p {
  font-size: clamp(17px, 1.6vw, 19px);
  line-height: 1.62;
  color: var(--ink-soft);
}
.about__body p + p { margin-top: 18px; }
.about__body p:first-child { color: var(--ink); }
.about__meta {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--line);
}
.meta-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.meta-label {
  font-family: var(--mono);
  font-size: 11.5px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent-ink);
}
.meta-value { font-size: 15px; color: var(--ink); line-height: 1.4; text-wrap: pretty; }
.meta-sub {
  font-family: var(--mono);
  font-size: 12px; letter-spacing: .3px;
  color: var(--ink-mute);
}

/* ================= GARAGE ================= */
.garage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 24px);
}
.ghost {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  padding: 26px 24px 30px;
  background:
    repeating-linear-gradient(135deg, transparent 0 13px, rgba(140,132,120,.045) 13px 14px);
  min-height: 190px;
  display: flex; flex-direction: column;
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.ghost:hover { border-color: var(--ink-mute); transform: translateY(-3px); }
.ghost__meta {
  font-family: var(--mono);
  font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--ink-mute);
}
.ghost__title {
  font-family: var(--display);
  font-weight: 500; font-size: 21px; line-height: 1.12;
  margin-top: 22px; color: var(--ink);
}
.ghost__note { font-size: 14px; color: var(--ink-soft); margin-top: 8px; }

/* ================= FOOTER ================= */
.footer {
  margin-top: clamp(40px, 8vh, 90px);
  border-top: 1px solid var(--line);
  padding-block: clamp(48px, 8vh, 80px) 30px;
}
.footer__inner {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 40px; flex-wrap: wrap;
}
.footer__lead { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.footer__cta {
  font-family: var(--display);
  font-weight: 400; font-size: clamp(26px, 4vw, 40px);
  line-height: 1.05; letter-spacing: -.01em;
  max-width: 16ch;
}
.footer__links { display: flex; flex-direction: column; gap: 10px; text-align: right; }
.footer__links a {
  font-size: 15px; color: var(--ink-soft);
  position: relative; transition: color .2s var(--ease);
}
.footer__links a:hover { color: var(--accent-ink); }
.footer__base {
  margin-top: clamp(40px, 7vh, 70px);
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px; color: var(--ink-mute); letter-spacing: .2px;
}

/* ================= REVEAL ANIMATION ================= */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ================= RESPONSIVE ================= */
@media (max-width: 860px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .garage { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .footer__inner { align-items: flex-start; }
  .footer__links { text-align: left; }
}
@media (max-width: 580px) {
  body { font-size: 16px; }
  .cards { grid-template-columns: 1fr; }
  .nav__name { display: none; }
  .nav__links { gap: 18px; }
  .hero__title { font-size: clamp(40px, 13vw, 60px); }
}

/* ================= MOTION SAFETY ================= */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
