/* ferdi.tech — site.css v2 (editorial restyle 2026-08-12)
   DNA: Sam Potts (dark, light-weight type) · Richard Haines (giant scale) ·
   Sebastian De Deyne (text-first cleanliness) · Brian Lovin (warm personal) */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/cormorant-garamond-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/cormorant-garamond-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Tokens (warm editorial) — LIGHT default, dark via toggle ── */
:root {
  --bg: #faf8f4;
  --bg-soft: #f3efe8;
  --text: #1d1b17;
  --text-muted: #6d675c;
  --text-faint: #a39c8e;
  --accent: #9a6f26;
  --accent-soft: #7d5a1c;
  --border: #e4ddd0;
  --maxw: 960px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --dur: 240ms;
  --ease: cubic-bezier(.22,.61,.36,1);
}

[data-theme="dark"] {
  --bg: #0e0e10;
  --bg-soft: #131316;
  --text: #ece8e1;
  --text-muted: #9c968c;
  --text-faint: #6f6a61;
  --accent: #d8a84e;
  --accent-soft: #e8c07a;
  --border: #26262a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10; --bg-soft: #131316;
    --text: #ece8e1; --text-muted: #9c968c; --text-faint: #6f6a61;
    --accent: #d8a84e; --accent-soft: #e8c07a; --border: #26262a;
  }
}

/* ── Base ── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  /* film grain: noise tiled over the background colour (above bg, below content) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.25'/%3E%3C/svg%3E");
  background-repeat: repeat;
  color: var(--text);
  font: 16px/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  padding: 10px 16px; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border);
}
.skip:focus { left: 16px; top: 16px; }
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 90; transition: width 80ms linear;
}
/* ── Header ── */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.25'/%3E%3C/svg%3E");
  background-repeat: repeat;
  backdrop-filter: blur(8px);
}
.wordmark { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: .2px; }
.wordmark .dot { color: var(--accent); }
.theme-toggle {
  position: relative;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border); border-radius: 50%;
  cursor: pointer;
  transition: color var(--dur), border-color var(--dur), transform var(--dur) var(--ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(8deg); }
.theme-toggle svg {
  position: absolute; width: 18px; height: 18px;
  transition: opacity 300ms var(--ease), transform 400ms var(--ease);
}
.theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
.theme-toggle.is-dark .icon-sun { opacity: 0; transform: rotate(90deg) scale(.5); }
.theme-toggle.is-dark .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ── Hero (giant editorial type) ── */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 140px 32px 110px; }
.eyebrow {
  margin: 0 0 26px; font-size: 12px; letter-spacing: 3.5px; text-transform: uppercase;
  color: var(--accent); max-width: 640px; line-height: 1.6;
}
h1.display { font-family: var(--font-display); font-weight: 400; font-size: clamp(72px, 14vw, 148px); line-height: .92; letter-spacing: -1.5px; margin: 0 0 30px; }
.tagline { font-size: clamp(20px, 3vw, 28px); font-weight: 400; margin: 0 0 16px; color: var(--text); letter-spacing: -.2px; }
.hero-sub { max-width: 560px; color: var(--text-muted); font-size: 16.5px; margin: 0 0 44px; }
.cta-row { display: flex; gap: 30px; align-items: center; }

.btn {
  font-size: 15px; letter-spacing: .2px;
  transition: color var(--dur), border-color var(--dur), transform var(--dur) var(--ease);
}
.btn-primary {
  color: var(--text); padding-bottom: 4px;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
  transition: color var(--dur), background-size 300ms var(--ease), transform var(--dur) var(--ease);
}
.btn-primary:hover, .btn-primary:focus-visible { color: var(--accent); transform: translateY(-1px); background-size: 100% 1px; }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { color: var(--accent); }
.btn-large { font-size: 17px; }
.card-stack {
  margin: 10px 0 0; font-size: 12.5px; letter-spacing: .4px; color: var(--text-muted);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}
.card-proof {
  display: block; margin: 16px 0 0; width: 100%; max-width: 340px; height: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.card-proof.is-small { max-width: 204px; } /* 60% of 340px */
.card-proof-link { display: block; }
.card-proof-link .card-proof { transition: border-color var(--dur), transform var(--dur) var(--ease); }
.card-proof-link:hover .card-proof, .card-proof-link:focus-visible .card-proof {
  border-color: var(--accent); transform: translateY(-2px);
}
.card-proof + .card-links { margin-top: 14px; }

/* ── Proof strip (hairline row, editorial numbers) ── */
.proof { max-width: var(--maxw); margin: 0 auto; padding: 0 32px 130px; }
.proof-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); }
.proof-cell {
  display: flex; flex-direction: column; gap: 6px;
  padding: 30px 26px 26px 0; margin-right: 26px;
  border-bottom: 1px solid var(--border);
  transition: color var(--dur);
}
.proof-cell:hover { color: var(--accent); }
.proof-num { font-family: var(--font-display); font-size: 44px; font-weight: 400; letter-spacing: -.5px; line-height: 1; }
.proof-num.long { font-size: 26px; font-weight: 500; letter-spacing: 0; line-height: 1.15; white-space: nowrap; align-self: center; }
.proof-label { font-size: 12.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }

/* ── Sections ── */
section { max-width: var(--maxw); margin: 0 auto; padding: 0 32px 130px; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(38px, 6vw, 58px); letter-spacing: -.5px; margin: 0 0 14px; }
.section-lede { color: var(--text-muted); margin: 0 0 56px; max-width: 560px; font-size: 16.5px; }

/* ── Projects: responsive card grid, image-top cards (2026 standard) ── */
.card-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 32px; align-items: start;
}
.card {
  display: flex; flex-direction: column; gap: 12px; padding: 0 0 30px;
}
.card-title { font-family: var(--font-display); font-size: 26px; font-weight: 400; letter-spacing: -.2px; margin: 0; }
.card-proof-link { display: block; }
.card-proof {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: 250px; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color var(--dur), transform var(--dur) var(--ease);
}
.card-proof.is-small { max-height: 170px; }
.slideshow { position: relative; width: 100%; max-width: 340px; margin: 0 auto; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; }
.slideshow img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 900ms ease; border-radius: 12px; }
.slideshow img.is-active { opacity: 1; }
.card-proof-link:hover .card-proof, .card-proof-link:focus-visible .card-proof {
  border-color: var(--accent); transform: translateY(-2px);
}
.card-desc { color: var(--text-muted); font-size: 14.5px; margin: 0; line-height: 1.5; }
.card-stack {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 0;
}
.card-stack { /* badges */ }
.card-stack::before { content: none; }
.card-stack { font-family: inherit; font-size: 0; }
.card-stack { /* stack line -> badges */ }
.card-stack {
  font-size: 0; /* hide literal separator text, badges below */
}
.card-stack .tag {
  font-size: 11.5px; letter-spacing: .3px; color: var(--text-muted);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.card-metric { font-size: 13.5px; color: var(--text-muted); margin: 0; letter-spacing: .3px; }
.card-metric strong { color: var(--accent); font-weight: 500; }
.card-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.card-links .card-link + .card-link { margin-left: 0; }
.card-link { font-size: 13.5px; color: var(--text-muted); background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px; transition: color var(--dur), background-size 300ms var(--ease); }
.card-link:hover, .card-link:focus-visible { color: var(--accent); background-size: 100% 1px; }
.card-link.is-static { color: var(--text-faint); background-image: none; }

@media (max-width: 980px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ── Pipeline: Problem → Process → Proof ── */
.pipeline { text-align: left; }
.ppp-grid {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 20px; align-items: center;
}
.ppp-col {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px 26px 24px;
}
.ppp-pain { border-left: 4px solid #c0392b; }
.ppp-process { border-left: 4px solid var(--accent); }
.ppp-proof { border-left: 4px solid #2e9e5b; }
.ppp-head {
  font-family: var(--font-display); font-size: 22px; font-weight: 400;
  margin: 0 0 14px;
}
.ppp-pain .ppp-head { color: #c0392b; }
.ppp-process .ppp-head { color: var(--accent); }
.ppp-proof .ppp-head { color: #2e9e5b; }
.ppp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ppp-list li { font-size: 15px; line-height: 1.4; color: var(--text); padding-left: 22px; position: relative; }
.ppp-pain .ppp-list li::before { content: "✕"; position: absolute; left: 0; color: #c0392b; font-size: 13px; }
.ppp-proof .ppp-list li::before { content: "✓"; position: absolute; left: 0; color: #2e9e5b; font-size: 14px; }
.ppp-proof .ppp-list strong { color: var(--text); font-weight: 600; }
.ppp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ppp-steps li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--text); }
.ppp-steps li span {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.ppp-arrow { font-size: 28px; color: var(--text-faint); }

@media (max-width: 860px) {
  .ppp-grid { grid-template-columns: 1fr; }
  .ppp-arrow { transform: rotate(90deg); justify-self: center; }
}
/* ── About / Contact ── */
.about { max-width: 720px; }
.about .section-title { line-height: 1.08; }
.about-lede { color: var(--text-muted); font-size: 17px; }
.contact { text-align: left; padding-bottom: 140px; }
.contact .section-title { margin-bottom: 14px; }
.contact-lede { color: var(--text-muted); max-width: 520px; margin: 0 0 34px; }
.contact-note { color: var(--text-faint); font-size: 13.5px; margin-top: 18px; }

/* ── Footer / social ── */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 0 32px 60px; border-top: 1px solid var(--border); }
.social-row { display: flex; gap: 34px; align-items: center; padding: 40px 0 20px; }
.social-row-link { color: var(--text-muted); transition: color var(--dur), transform var(--dur) var(--ease); }
.social-row-link:hover, .social-row-link:focus-visible { color: var(--accent); transform: translateY(-2px); }
.social-row svg { width: 22px; height: 22px; display: block; }
.footer-note { color: var(--text-faint); font-size: 12.5px; letter-spacing: 1px; margin: 0 0 40px; }

/* ── Underline draw (inline links in prose) ── */
main a:not([class]) {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
  transition: color var(--dur), background-size 300ms var(--ease);
}
main a:not([class]):hover, main a:not([class]):focus-visible { background-size: 100% 1px; }

/* ── Letter-spacing settle (headings) ── */
h1.display { animation: settle-display 800ms var(--ease) both; }
.section-title { animation: settle-section 800ms var(--ease) both; }
@keyframes settle-display { from { letter-spacing: -2.5px; } }
@keyframes settle-section { from { letter-spacing: -1.5px; } }

/* ── Reveal motion ── */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 400ms var(--ease), transform 400ms var(--ease); }
.reveal.visible { opacity: 1; transform: none; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ── Mobile ── */
@media (max-width: 720px) {
  .hero { padding-top: 90px; padding-left: 22px; padding-right: 22px; }
  section, .proof { padding-left: 22px; padding-right: 22px; }
  .proof-grid { grid-template-columns: repeat(2, 1fr); }
  .card { grid-template-columns: 1fr; gap: 10px; }
  .card-link { grid-column: 1; grid-row: auto; }
  .tagline { font-size: 21px; }
}

/* Card link rows: spread links horizontally instead of overlapping */
@media (max-width: 720px) {
  .card-links { grid-column: 1; }
}
