/* Peakirk — peakirkltd.com
   Concept: the technology stack as a mountain cross-section, bedrock (infrastructure) to summit (strategy). */

:root {
  /* palette */
  --bg: #F2EFE8;          /* survey paper */
  --bg-alt: #E9E5DB;
  --ink: #16231F;         /* deep pine */
  --ink-2: #4A5752;       /* secondary text, 7:1 on --bg */
  --line: #C9C3B5;
  --line-soft: #DCD7CB;
  --accent: #E2541B;      /* summit flag */
  --accent-ink: #B5400F;  /* accent for text on paper, 4.9:1 */
  --dark: #16231F;
  --dark-2: #20302B;
  --on-dark: #F2EFE8;
  --on-dark-2: #AEB9B3;
  --scrim: 22, 35, 31;
  --slice: #D3CDBF;

  /* type */
  --f-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --t-hero: clamp(54px, 10.4vw, 164px);
  --t-h2: clamp(34px, 4.6vw, 66px);
  --t-h3: clamp(23px, 2.1vw, 30px);
  --t-statement: clamp(22px, 2.3vw, 33px);
  --t-lead: clamp(18px, 1.45vw, 21px);
  --t-body: 17px;
  --t-small: 15px;
  --t-label: 12.5px;

  /* space */
  --pad-x: clamp(20px, 5.5vw, 80px);
  --section-py: clamp(72px, 9vw, 132px);
  --nav-h: 76px;
  --radius: 2px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  max-width: 1440px;
  margin: 0 auto;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
html { background: var(--bg); }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); font-weight: 500; line-height: 1.04; }
h3 { font-size: var(--t-h3); font-weight: 600; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.mono, .label, .eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.label { color: var(--accent-ink); margin-bottom: 22px; display: flex; align-items: center; gap: 12px; }
.label::before { content: ""; width: 28px; height: 1px; background: currentColor; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; }
.skip:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-svg { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  font-family: var(--f-body); font-size: 16px; font-weight: 600; text-decoration: none;
  border: 1.5px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: transform .2s var(--ease), background-color .2s, border-color .2s, color .2s;
}
.btn-primary { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn-primary::after { content: "↗"; font-size: 18px; line-height: 1; }
.btn-primary:hover { background: #EC6630; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); transform: translateY(-1px); }
.btn-ghost:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 var(--pad-x);
  background: rgba(242, 239, 232, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-head.scrolled { border-bottom-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 36px; height: auto; }
.brand span { font-family: var(--f-display); font-weight: 650; font-size: 23px; letter-spacing: -0.03em; }
.nav { display: flex; align-items: center; gap: clamp(20px, 3vw, 40px); }
.nav a { font-size: 15px; font-weight: 500; text-decoration: none; color: var(--ink-2); padding: 6px 0; position: relative; }
.nav a:not(.nav-cta)::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1.5px; background: var(--accent); transition: right .25s var(--ease); }
.nav a:not(.nav-cta):hover { color: var(--ink); }
.nav a:not(.nav-cta):hover::after { right: 0; }
.nav .nav-cta { color: var(--ink); border: 1.5px solid var(--ink); padding: 10px 18px; border-radius: var(--radius); transition: background-color .2s, color .2s; }
.nav .nav-cta:hover { background: var(--ink); color: var(--bg); }
.burger { display: none; }

/* ---------- hero ---------- */
.hero { position: relative; padding-top: clamp(40px, 6vw, 88px); }
.hero-copy { padding: 0 var(--pad-x); position: relative; z-index: 2; }
.eyebrow { color: var(--ink-2); margin-bottom: clamp(20px, 2.5vw, 34px); }
.hero h1 {
  font-size: var(--t-hero); font-weight: 500; line-height: .95; letter-spacing: -0.035em;
  font-variation-settings: "opsz" 96;
}
.hero h1 em { font-style: normal; color: var(--ink-2); }
.hero-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px;
  margin-top: clamp(28px, 3.5vw, 52px);
}
.lead { font-size: var(--t-lead); line-height: 1.55; max-width: 560px; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-fig { margin: clamp(8px, 2vw, 24px) 0 0; position: relative; }
.hero-ridge { width: 100%; height: clamp(230px, 30vw, 440px); }
.ridge { fill: var(--bg); stroke: var(--ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.ridge-pole { stroke: var(--ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.ridge-flag { fill: var(--accent); }
.hero-fig figcaption {
  display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap;
  padding: 16px var(--pad-x); border-top: 1px solid var(--ink);
  font-size: var(--t-small); color: var(--ink-2);
}
.hero-fig figcaption .mono { color: var(--ink); }

/* draw-in of ridge lines */
.js .ridge { stroke-dasharray: 3000; stroke-dashoffset: 3000; animation: draw 2.2s var(--ease) forwards; animation-delay: var(--d); }
.js .ridge-flag, .js .ridge-pole { opacity: 0; animation: fade .6s ease forwards 1.4s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* ---------- approach ---------- */
.approach {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px);
  padding: var(--section-py) var(--pad-x);
}
.approach-statement { font-family: var(--f-display); font-size: var(--t-statement); line-height: 1.32; letter-spacing: -0.015em; font-weight: 400; }
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.5vw, 36px); margin-top: clamp(40px, 5vw, 64px); }
.principles li { border-top: 1px solid var(--ink); padding-top: 18px; }
.principles .mono { color: var(--accent-ink); }
.principles h3 { font-size: 21px; margin: 10px 0 10px; }
.principles p { color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; }

/* ---------- stack ---------- */
.stack { background: var(--bg-alt); padding: var(--section-py) var(--pad-x); }
.stack-head { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: end; margin-bottom: clamp(44px, 5vw, 72px); }
.stack-head .label { grid-column: 1 / -1; margin-bottom: -8px; }
.stack-intro { color: var(--ink-2); font-size: var(--t-lead); max-width: 560px; }
.layers { border-top: 1.5px solid var(--ink); }
.layer {
  display: grid; grid-template-columns: 200px minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 3.5vw, 56px);
  padding: clamp(32px, 3.5vw, 48px) 0; border-bottom: 1px solid var(--line);
  transition: background-color .3s;
}
.layer:last-child { border-bottom: 1.5px solid var(--ink); }
.layer-rail { display: flex; flex-direction: column; gap: 18px; }
.layer-rail .mono { color: var(--ink-2); }
.layer-mtn { width: 120px; height: 96px; --slice: var(--line); }
.layer-mtn polygon { transition: fill .3s; }
.layer-main .slogan { font-family: var(--f-display); font-size: 19px; font-weight: 500; color: var(--accent-ink); margin: 10px 0 14px; letter-spacing: -0.01em; }
.layer-main p:last-child { color: var(--ink-2); }
.layer-list { align-self: center; border-left: 1px solid var(--line); }
.layer-list li { position: relative; padding: 7px 0 7px 24px; font-size: var(--t-small); line-height: 1.45; }
.layer-list li::before { content: ""; position: absolute; left: -1px; top: 50%; width: 12px; height: 1px; background: var(--ink); }

/* ---------- route ---------- */
.route { padding: var(--section-py) var(--pad-x); }
.route-head { max-width: 760px; margin-bottom: clamp(48px, 6vw, 84px); }
.trail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px); position: relative; }
.trail::before {
  content: ""; position: absolute; left: 7px; right: 0; top: 7px; height: 0;
  border-top: 2px dashed var(--ink); opacity: .55;
}
.trail li { position: relative; padding-top: 44px; }
.waypoint { position: absolute; top: 0; left: 0; width: 16px; height: 16px; background: var(--bg); border: 2px solid var(--ink); transform: rotate(45deg); }
.trail li:last-child .waypoint { background: var(--accent); border-color: var(--accent); }
.trail .mono { color: var(--ink-2); }
.trail h3 { margin: 8px 0 12px; font-size: clamp(26px, 2.6vw, 36px); font-weight: 600; }
.trail p { color: var(--ink-2); font-size: var(--t-small); }

/* ---------- contact ---------- */
.contact {
  background: var(--dark); color: var(--on-dark);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 6vw, 104px);
  padding: var(--section-py) var(--pad-x);
}
.contact .label { color: var(--accent); }
.contact h2 { margin-bottom: 22px; }
.contact-info > p:not(.label) { color: var(--on-dark-2); font-size: var(--t-lead); max-width: 460px; }
.details { margin: clamp(36px, 4vw, 56px) 0 0; display: grid; gap: 26px; }
.details dt { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-2); margin-bottom: 6px; }
.details dd { margin: 0; font-size: 18px; line-height: 1.5; }
.details a { text-decoration-color: var(--accent); text-underline-offset: 4px; }

.contact-form { display: grid; gap: 30px; align-content: start; }
.field { display: grid; gap: 8px; }
.field label { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-2); }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 18px; color: var(--on-dark);
  background: transparent; border: 0; border-bottom: 1.5px solid #4C5D57; border-radius: 0;
  padding: 10px 0 12px; transition: border-color .2s;
}
.field textarea { resize: vertical; min-height: 128px; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent); }
.field input:focus-visible, .field textarea:focus-visible { box-shadow: 0 2px 0 0 var(--accent); }
.field.invalid input, .field.invalid textarea { border-bottom-color: #FF8A5C; }
.field.invalid label::after { content: " — required"; color: #FF8A5C; text-transform: none; letter-spacing: 0; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.form-note { font-size: 14px; color: var(--on-dark-2); max-width: 300px; }
.form-note a, .form-fallback a { color: var(--on-dark); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.form-fallback, .form-error { font-size: var(--t-small); color: var(--on-dark); border-left: 2px solid var(--accent); padding: 4px 0 4px 16px; }
.form-success { border: 1.5px solid var(--accent); padding: 18px 20px; font-size: 16px; }
.form-success strong { display: block; font-family: var(--f-display); font-size: 20px; margin-bottom: 4px; }
.contact :focus-visible { outline-color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- footer ---------- */
.site-foot { padding: clamp(56px, 6vw, 88px) var(--pad-x) 32px; }
.foot-top { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; padding-bottom: 40px; border-bottom: 1.5px solid var(--ink); }
.brand-foot img { width: 56px; }
.brand.brand-foot span { font-size: clamp(38px, 5vw, 64px); }
.foot-tag { font-family: var(--f-display); font-size: var(--t-lead); color: var(--ink-2); }
.foot-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; padding: 40px 0 48px; }
.foot-cols .mono { color: var(--ink-2); margin-bottom: 14px; }
.foot-cols p:not(.mono), .foot-cols li { font-size: var(--t-small); line-height: 1.7; }
.foot-cols a { text-decoration: none; }
.foot-cols a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.foot-legal { font-size: 13px; color: var(--ink-2); }

/* ---------- secondary pages ---------- */
.doc { padding: clamp(48px, 7vw, 104px) var(--pad-x) var(--section-py); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); }
.doc-head h1 { font-size: var(--t-h2); font-weight: 500; line-height: 1.04; }
.doc-head .meta { margin-top: 20px; color: var(--ink-2); font-size: var(--t-small); }
.doc-body { max-width: 720px; }
.doc-body h2 { font-size: var(--t-h3); font-weight: 600; margin: 44px 0 12px; line-height: 1.2; }
.doc-body h2:first-child { margin-top: 0; }
.doc-body p, .doc-body li { color: var(--ink-2); margin-bottom: 12px; }
.doc-body ul { list-style: none; }
.doc-body ul li { position: relative; padding-left: 22px; }
.doc-body ul li::before { content: ""; position: absolute; left: 0; top: .8em; width: 10px; height: 1.5px; background: var(--accent); }
.doc-body a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }

.notfound { min-height: 70vh; display: grid; align-content: center; padding: var(--section-py) var(--pad-x); }
.notfound .code { font-family: var(--f-mono); font-size: var(--t-small); color: var(--accent-ink); }
.notfound h1 { font-size: var(--t-h2); font-weight: 500; line-height: 1.02; letter-spacing: -0.03em; margin: 18px 0 28px; }
.notfound p { color: var(--ink-2); font-size: var(--t-lead); max-width: 520px; margin-bottom: 32px; }

/* ---------- reveal ---------- */
.reveal, .reveal-stagger > * { opacity: 0; transform: translateY(40px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in, .reveal-stagger.in > * { opacity: 1; transform: none; }
.reveal-stagger.in > *:nth-child(2) { transition-delay: .1s; }
.reveal-stagger.in > *:nth-child(3) { transition-delay: .2s; }
.reveal-stagger.in > *:nth-child(4) { transition-delay: .3s; }
html:not(.js) .reveal, html:not(.js) .reveal-stagger > * { opacity: 1; transform: none; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  :root { --nav-h: 68px; }
  .hero-row { grid-template-columns: 1fr; gap: 28px; }
  .approach, .stack-head, .contact, .doc { grid-template-columns: 1fr; }
  .stack-head .label { margin-bottom: 0; }
  .layer { grid-template-columns: 150px minmax(0, 1fr); }
  .layer-list { grid-column: 2; }
  .layer-mtn { width: 96px; height: 77px; }
  .trail { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 48px; }
  .trail::before { display: none; }
  .trail li { border-top: 2px dashed rgba(22, 35, 31, .55); padding-top: 36px; }
  .trail .waypoint { top: -9px; }
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 7px;
    width: 46px; height: 46px; padding: 0 11px; margin-right: -11px;
    background: none; border: 0; cursor: pointer;
  }
  .burger span { display: block; height: 2px; background: var(--ink); transition: transform .25s var(--ease); }
  .burger[aria-expanded="true"] span:first-child { transform: translateY(4.5px) rotate(45deg); }
  .burger[aria-expanded="true"] span:last-child { transform: translateY(-4.5px) rotate(-45deg); }
  .nav {
    position: fixed; inset: var(--nav-h) 0 auto 0; z-index: 49;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1.5px solid var(--ink);
    padding: 8px var(--pad-x) 24px;
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity .2s, transform .2s var(--ease), visibility .2s;
  }
  .nav.open { transform: none; opacity: 1; visibility: visible; }
  .nav a { font-family: var(--f-display); font-size: 26px; color: var(--ink); padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
  .nav a:not(.nav-cta)::after { display: none; }
  .nav .nav-cta { margin-top: 20px; text-align: center; font-family: var(--f-body); font-size: 17px; padding: 14px; }
  .brand span { font-size: 21px; }
  .actions .btn { flex: 1 1 auto; }
  .hero-ridge { height: 220px; }
  .principles { grid-template-columns: 1fr; }
  .layer { grid-template-columns: 1fr; gap: 20px; }
  .layer-rail { flex-direction: row; align-items: center; justify-content: space-between; }
  .layer-mtn { width: 70px; height: 56px; }
  .layer-list { grid-column: auto; }
  .trail { grid-template-columns: 1fr; }
  .foot-cols { grid-template-columns: 1fr 1fr; }
  .foot-cols > div:first-child { grid-column: 1 / -1; }
  .form-foot .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-stagger > * { opacity: 1 !important; transform: none !important; transition: none !important; }
  .js .ridge, .js .ridge-flag, .js .ridge-pole { animation: none !important; stroke-dasharray: none; opacity: 1; }
  .btn:hover, .btn:active { transform: none !important; }
  *, *::before, *::after { transition-duration: 0s !important; }
}
