/* ============================================================================
   GREEN GATES — Data Engineering Portfolio
   Aesthetic: printed technical broadsheet / editorial journal on warm paper.
   Verification gates rendered as a letterpress ledger that stamps in.
   Type: Fraunces (display serif) · Schibsted Grotesk (text) · Spline Sans Mono (data)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;0,9..144,900;1,9..144,400;1,9..144,500&family=Schibsted+Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Spline+Sans+Mono:wght@400;500;600&display=swap');

/* ---------- Tokens ---------- */
:root {
  --paper:      #f2ecde;   /* warm cream */
  --paper-2:    #ece3d0;   /* panel / inset */
  --paper-3:    #e6dcc5;
  --ink:        #1d1a14;   /* warm near-black */
  --ink-2:      #4c4538;   /* secondary text */
  --ink-3:      #8a7e69;   /* captions, faint */
  --rule:       #cfc3a8;   /* hairline */
  --rule-2:     #bcad8c;

  --pine:       #2e5e45;   /* primary accent — the "green" gate */
  --pine-deep:  #214735;
  --slate:      #2c4a6e;   /* WarehouseLab */
  --terra:      #b1432a;   /* StreamPulse */
  --guard:      #2e5e45;   /* DataGuard */
  --stamp:      #b1432a;   /* editorial red */

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:    'Schibsted Grotesk', system-ui, sans-serif;
  --mono:    'Spline Sans Mono', ui-monospace, monospace;

  --maxw: 1180px;
  --measure: 64ch;
  --ease: cubic-bezier(.2,.6,.2,1);
}

/* ---------- Reset ---------- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--pine); color: var(--paper); }

/* ---------- Paper texture ---------- */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.11 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 60%, rgba(60,48,28,.08));
}
main, .masthead, .colophon { position: relative; z-index: 1; }

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2.6rem, var(--maxw)); margin-inline: auto; }
.rule { border: 0; border-top: 1px solid var(--rule); }
.rule-2 { border: 0; border-top: 2px solid var(--ink); }
.edition-rule { height: 4px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }

.kicker {
  font-family: var(--sans); font-weight: 600; font-size: .72rem;
  letter-spacing: .26em; text-transform: uppercase; color: var(--ink-2);
}
.kicker.accent { color: var(--accent, var(--pine)); }

/* ---------- Masthead ---------- */
.masthead { padding-top: 1.1rem; }
.masthead .edition-rule { margin-bottom: .5rem; }
.masthead-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; font-family: var(--mono); font-size: .72rem;
  letter-spacing: .08em; color: var(--ink-2); text-transform: uppercase;
}
.masthead-title {
  font-family: var(--display); font-weight: 900; font-optical-sizing: auto;
  font-size: clamp(2.6rem, 9vw, 6.2rem); line-height: .92; letter-spacing: -.02em;
  text-align: center; margin: .5rem 0 .35rem; font-feature-settings: "swsh" 1;
}
.masthead-sub {
  text-align: center; font-style: italic; font-family: var(--display);
  color: var(--ink-2); font-size: clamp(.95rem,1.6vw,1.15rem); margin-bottom: .9rem;
}
.masthead-meta {
  display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); padding: .55rem 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.masthead-meta b { color: var(--pine); font-weight: 600; }

/* nav */
.topnav { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.topnav-inner { display: flex; align-items: center; justify-content: space-between; padding: .6rem 0; }
.topnav .mark { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: .5rem; }
.topnav .mark .tick { color: var(--pine); }
.topnav nav { display: flex; gap: .2rem; align-items: center; }
.topnav nav a { font-family: var(--sans); font-size: .82rem; font-weight: 500; padding: .45rem .7rem; color: var(--ink-2); border-radius: 2px; transition: color .2s, background .2s; }
.topnav nav a:hover { color: var(--ink); background: var(--paper-2); }
.topnav nav a.cta { color: var(--paper); background: var(--ink); padding: .5rem .9rem; }
.topnav nav a.cta:hover { background: var(--pine); color: var(--paper); }
@media (max-width: 680px){ .topnav nav a.lnk-hide { display: none; } }

/* ---------- Hero / lede ---------- */
.lede { padding: clamp(2.4rem,5vw,4rem) 0 clamp(2rem,4vw,3rem); }
.lede-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(1.6rem,4vw,3.4rem); align-items: end; }
@media (max-width: 900px){ .lede-grid { grid-template-columns: 1fr; gap: 2rem; } }
.headline {
  font-family: var(--display); font-weight: 600; font-optical-sizing: auto;
  font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.0; letter-spacing: -.025em;
}
.headline em { font-style: italic; font-weight: 500; color: var(--pine); }
.deck {
  margin-top: 1.4rem; font-size: clamp(1.05rem,1.5vw,1.2rem); color: var(--ink-2);
  max-width: 46ch; line-height: 1.55;
}
.deck .dropcap::first-letter {
  font-family: var(--display); font-weight: 700; float: left; font-size: 3.4em;
  line-height: .72; padding: .06em .12em 0 0; color: var(--pine);
}
.byline { margin-top: 1.6rem; font-family: var(--mono); font-size: .74rem; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.lede-actions { display: flex; gap: .7rem; margin-top: 1.5rem; flex-wrap: wrap; }
.btn {
  font-family: var(--sans); font-weight: 600; font-size: .9rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.15rem;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 2px; transition: background .2s, color .2s, transform .15s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn-fill { background: var(--ink); color: var(--paper); }
.btn-fill:hover { background: var(--pine); border-color: var(--pine); }
.btn svg { width: 16px; height: 16px; }

/* code specimen figure */
.specimen { border: 1px solid var(--ink); background: var(--paper-2); box-shadow: 6px 6px 0 var(--paper-3); }
.specimen-head { display: flex; align-items: center; justify-content: space-between; padding: .55rem .85rem; border-bottom: 1px solid var(--rule-2); font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.specimen-head .stamp-pass { color: var(--pine); font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; }
.specimen-body { padding: 1rem 1.05rem 1.15rem; font-family: var(--mono); font-size: .8rem; line-height: 1.85; color: var(--ink-2); }
.specimen-body .ln { white-space: pre-wrap; }
.specimen-body .pr { color: var(--ink); font-weight: 600; }
.specimen-body .ok { color: var(--pine); font-weight: 500; }
.specimen-body .gr { color: var(--ink-3); }
.specimen-cap { font-family: var(--display); font-style: italic; font-size: .82rem; color: var(--ink-3); margin-top: .6rem; }

/* ---------- Section scaffolding ---------- */
section { padding: clamp(3rem,6vw,5.5rem) 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 2px solid var(--ink); margin-bottom: 2.4rem; flex-wrap: wrap; }
.sec-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem,3.4vw,2.7rem); letter-spacing: -.02em; line-height: 1; }
.sec-head .sec-no { font-family: var(--mono); font-size: .74rem; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; }
.sec-intro { max-width: var(--measure); color: var(--ink-2); font-size: 1.08rem; margin-top: -1rem; margin-bottom: 2.4rem; }

/* ---------- Feature articles (projects) ---------- */
.feature { display: grid; grid-template-columns: 4.2rem 1fr; gap: clamp(1rem,2.5vw,2.2rem); padding: clamp(1.8rem,3vw,2.8rem) 0; border-top: 1px solid var(--rule); }
.feature:first-of-type { border-top: 0; }
.feature .fno { font-family: var(--display); font-weight: 700; font-size: clamp(2rem,4vw,3.2rem); line-height: .85; color: var(--accent); letter-spacing: -.03em; }
.feature .fno small { display: block; font-family: var(--mono); font-size: .56rem; letter-spacing: .14em; color: var(--ink-3); margin-top: .5rem; text-transform: uppercase; font-weight: 500; }
.feature-body { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(1.2rem,2.5vw,2.4rem); }
@media (max-width: 880px){ .feature-body { grid-template-columns: 1fr; gap: 1.4rem; } .feature { grid-template-columns: 3rem 1fr; } }

.feature h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem,3.4vw,2.6rem); line-height: 1.02; letter-spacing: -.02em; }
.feature .standfirst { font-family: var(--display); font-style: italic; color: var(--ink-2); font-size: 1.12rem; margin: .5rem 0 1rem; line-height: 1.4; }
.feature p.body { color: var(--ink-2); font-size: .98rem; line-height: 1.62; max-width: 52ch; }
.feature .body code, .arch code { font-family: var(--mono); font-size: .86em; color: var(--accent); }

.spec-line { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.1rem 0 1.2rem; font-family: var(--mono); font-size: .72rem; color: var(--ink-2); }
.spec-line .k { color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.spec-line .v { color: var(--ink); }

.arch { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-family: var(--mono); font-size: .7rem; margin: 0 0 1.2rem; color: var(--ink-2); }
.arch .n { padding: .28rem .5rem; border: 1px solid var(--rule-2); background: var(--paper-2); border-radius: 2px; }
.arch .n.hot { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule-2)); }
.arch .ar { color: var(--ink-3); }

.flinks { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.3rem; }
.flink { font-family: var(--sans); font-weight: 600; font-size: .82rem; display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border: 1px solid var(--ink); border-radius: 2px; transition: background .2s, color .2s, transform .15s; }
.flink:hover { transform: translateY(-1px); background: var(--accent); color: var(--paper); border-color: var(--accent); }
.flink svg { width: 14px; height: 14px; }

/* ledger / gates */
.ledger { border: 1px solid var(--ink); background: var(--paper-2); align-self: start; }
.ledger-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .85rem; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.ledger-head .seal { font-family: var(--sans); font-weight: 700; font-size: .64rem; letter-spacing: .18em; color: var(--accent); border: 1px solid var(--accent); padding: .12rem .4rem; border-radius: 2px; }
.gate { display: grid; grid-template-columns: 1.4rem 1fr; gap: .6rem; align-items: start; padding: .6rem .85rem; border-top: 1px solid var(--rule); font-size: .85rem; color: var(--ink-2); }
.gate:first-of-type { border-top: 0; }
.gate .mark { width: 1.4rem; height: 1.4rem; }
.gate .mark svg { width: 100%; height: 100%; }
.gate .mark .tick-path { stroke: var(--accent); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; transition: stroke-dashoffset .5s var(--ease); }
.gate.checked .mark .tick-path { stroke-dashoffset: 0; }
.gate.checked .gtext { color: var(--ink); }
.gate .gtext code { font-family: var(--mono); font-size: .82em; color: var(--accent); }

/* pull quote */
.pull { padding: clamp(2rem,5vw,3.5rem) 0; }
.pull blockquote { font-family: var(--display); font-weight: 500; font-style: italic; font-size: clamp(1.5rem,3.6vw,2.6rem); line-height: 1.2; letter-spacing: -.01em; max-width: 22ch; margin-inline: auto; text-align: center; position: relative; }
.pull blockquote::before { content: "“"; font-size: 2.4em; color: var(--pine); line-height: 0; position: absolute; left: -.5em; top: .35em; }
.pull cite { display: block; text-align: center; margin-top: 1.3rem; font-family: var(--mono); font-style: normal; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

/* specs / shared stack */
.specs { display: grid; grid-template-columns: repeat(4,1fr); gap: 0; border: 1px solid var(--ink); }
@media (max-width: 820px){ .specs { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 460px){ .specs { grid-template-columns: 1fr; } }
.spec { padding: 1.3rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.spec .k { font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.spec .v { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin: .5rem 0 .6rem; line-height: 1.1; }
.spec ul { list-style: none; display: grid; gap: .3rem; }
.spec li { font-size: .85rem; color: var(--ink-2); display: flex; gap: .45rem; }
.spec li::before { content: "—"; color: var(--pine); }

/* method */
.method { display: grid; grid-template-columns: repeat(6,1fr); gap: 0; border-top: 2px solid var(--ink); }
@media (max-width: 860px){ .method { grid-template-columns: repeat(2,1fr); } }
.step { padding: 1.3rem 1.1rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.step .n { font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: var(--pine); }
.step .t { font-family: var(--sans); font-weight: 600; margin-top: .35rem; font-size: 1rem; }
.step .d { font-size: .82rem; color: var(--ink-3); margin-top: .25rem; }

/* ---------- Colophon footer ---------- */
.colophon { border-top: 4px double var(--ink); margin-top: 2rem; padding: 3rem 0 2.4rem; }
.colophon-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 760px){ .colophon-grid { grid-template-columns: 1fr; gap: 1.4rem; } }
.colophon h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem,3vw,2.3rem); letter-spacing: -.02em; max-width: 16ch; line-height: 1.05; }
.colophon .set { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); line-height: 1.9; margin-top: 1rem; }
.colophon .set b { color: var(--ink-2); font-weight: 600; }
.colophon-links { display: flex; flex-direction: column; gap: .4rem; }
.colophon-links a { font-family: var(--display); font-style: italic; font-size: 1.2rem; color: var(--ink); border-bottom: 1px solid var(--rule); padding: .4rem 0; transition: color .2s, padding-left .2s; }
.colophon-links a:hover { color: var(--pine); padding-left: .4rem; }
.foot-base { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.2rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Reveal ---------- */
.reveal { transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.js .reveal { opacity: 0; transform: translateY(16px); }
html.js .reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"]{ transition-delay: .08s; } .reveal[data-d="2"]{ transition-delay: .16s; }
.reveal[data-d="3"]{ transition-delay: .24s; } .reveal[data-d="4"]{ transition-delay: .32s; }
/* hairline rules draw in */
html.js .draw { transform: scaleX(0); transform-origin: left; transition: transform .9s var(--ease); }
html.js .draw.in { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.js .reveal, html.js .draw { opacity: 1; transform: none; }
  .gate .mark .tick-path { stroke-dashoffset: 0 !important; }
  html { scroll-behavior: auto; }
}
