/* =========================================================
   Initium — end-to-end IT infrastructure
   Design language: restrained, typographic, generous whitespace.
   Everything below comes from the token scale. No magic numbers.
   ========================================================= */

/* ---------- Tokens ---------- */

:root {
  /* Spacing scale (4px base) */
  --s-1: 0.25rem;   /*  4 */
  --s-2: 0.5rem;    /*  8 */
  --s-3: 0.75rem;   /* 12 */
  --s-4: 1rem;      /* 16 */
  --s-6: 1.5rem;    /* 24 */
  --s-8: 2rem;      /* 32 */
  --s-12: 3rem;     /* 48 */
  --s-16: 4rem;     /* 64 */
  --s-24: 6rem;     /* 96 */
  --s-32: 8rem;     /* 128 */

  /* Type scale */
  --t-xs: 0.75rem;   /* 12 */
  --t-sm: 0.875rem;  /* 14 */
  --t-base: 1rem;    /* 16 */
  --t-md: 1.25rem;   /* 20 */
  --t-lg: 1.5rem;    /* 24 */
  --t-xl: 2rem;      /* 32 */

  /* Colour — light only. Neutrals carry a trace of the accent's warmth so the
     orange reads as part of the system rather than dropped on top of grey. */
  --bg: #ffffff;
  --bg-sunken: #faf7f5;
  --bg-raised: #ffffff;
  --ink: #1d1a18;
  --ink-strong: #0c0a09;
  --ink-muted: #6b625d;
  --ink-faint: #8a807a;
  --rule: rgba(28, 20, 14, 0.12);
  --rule-soft: rgba(28, 20, 14, 0.07);

  /* #c2410c clears 4.5:1 on white in both directions, so one orange serves as
     link text and as a button fill. No second, unreadable "brand" orange. */
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-hover: #9f3409;
  --accent-wash: rgba(194, 65, 12, 0.08);

  --chrome: rgba(255, 255, 255, 0.72);
  --chrome-solid: rgba(255, 255, 255, 0.86);
  --shadow-card: 0 1px 2px rgba(28, 20, 14, 0.04), 0 8px 32px rgba(28, 20, 14, 0.06);
  --shadow-lift: 0 2px 6px rgba(28, 20, 14, 0.06), 0 18px 48px rgba(28, 20, 14, 0.10);

  /* Motion — critically damped by default, response ≈ 0.4s.
     --ease-spring carries a small, deliberate overshoot; it is used only where
     something arrives with momentum, never on a plain fade. */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur: 400ms;
  --dur-slow: 700ms;

  --measure: 34rem;
  --page: 68rem;
  --nav-h: 3.25rem;

  /* Light only — no dark variant. Declared so form controls and scrollbars
     match rather than being guessed at from the system setting. */
  color-scheme: light;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s-6));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 100%/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  color: var(--ink-strong);
  font-weight: 600;
  font-optical-sizing: auto;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--accent);
  text-decoration: none;
}

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

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

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  padding: var(--s-2) var(--s-4);
  background: var(--bg-raised);
  color: var(--ink-strong);
  border-radius: var(--s-2);
  box-shadow: var(--shadow-card);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
  z-index: 100;
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- Nav: translucent layer, content scrolls under ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  background: var(--chrome-solid);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  /* Scroll edge effect rather than a hard 1px divider. The material thickens
     as content slides under it, so the bar earns its separation instead of
     announcing it with a border. */
  box-shadow: 0 1px 0 var(--rule-soft);
  transition: box-shadow var(--dur) var(--ease-out),
              background-color var(--dur) var(--ease-out);
}

.nav[data-at-top="true"] {
  background: var(--chrome);
  box-shadow: 0 1px 0 transparent;
}

.nav__inner {
  max-width: var(--page);
  height: 100%;
  margin-inline: auto;
  padding-inline: var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-strong);
  font-size: var(--t-base);
  font-weight: 600;
  letter-spacing: -0.012em;
}

/* The mark: initium — a beginning. A sun just clear of the horizon.
   Inline SVG rather than an <img>, so it inherits the accent token and can be
   animated. */
.mark {
  width: 1.35rem;
  height: 0.84rem;
  flex: none;
  overflow: visible;   /* the horizon drops past the bottom of the box */
}

.mark__disc { fill: var(--accent); }

.mark__rays path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
}

/* Two segments that meet under the sun. Round caps overlap at the join, so at
   rest they read as one unbroken horizon. */
.mark__horizon {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  transition: transform var(--dur) var(--ease-out);
}

/* The disc is clipped by the ground rather than pre-cut, so when the ground
   drops the sun is uncovered rather than moved. */
.mark__ground {
  transition: transform var(--dur) var(--ease-out);
}

/* On hover the ground drops and parts, uncovering more of the sun. The sun
   itself never moves — it was always there. */
.nav__brand:hover .mark__horizon--l,
.footer__brand:hover .mark__horizon--l { transform: translate(-5px, 5px); }

.nav__brand:hover .mark__horizon--r,
.footer__brand:hover .mark__horizon--r { transform: translate(5px, 5px); }

.nav__brand:hover .mark__ground,
.footer__brand:hover .mark__ground { transform: translateY(5px); }

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  font-size: var(--t-sm);
}

.nav__links a {
  position: relative;
  color: var(--ink-muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.nav__links a:hover { color: var(--ink-strong); }

/* Underline grows from the side the eye is already on */
.nav__links a:not(.nav__cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.35em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}
.nav__links a:not(.nav__cta):hover::after { transform: scaleX(1); }

.nav__cta {
  color: var(--accent) !important;
  font-weight: 500;
}

@media (max-width: 40rem) {
  .nav__links a:not(.nav__cta) { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;              /* 44px touch target */
  padding: var(--s-3) var(--s-6);
  border-radius: 999px;
  font-size: var(--t-base);
  font-weight: 500;
  letter-spacing: -0.006em;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  touch-action: manipulation;
}

.btn--lg { min-height: 3.25rem; padding: var(--s-4) var(--s-8); font-size: var(--t-md); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(194, 65, 12, 0.18);
}
.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(194, 65, 12, 0.26);
}

.btn--plain {
  color: var(--accent);
  padding-inline: var(--s-2);
}
.btn--plain:hover { text-decoration: underline; text-underline-offset: 0.25em; }

.btn__chev {
  margin-left: var(--s-2);
  transition: transform var(--dur) var(--ease-out);
}
.btn--plain:hover .btn__chev { transform: translateX(0.15em); }

/* Feedback on pointer-down, not on release */
.btn:active { transform: scale(0.97); }

/* ---------- Hero ---------- */

.hero {
  padding-top: calc(var(--nav-h) + var(--s-32));
  padding-bottom: var(--s-24);
}

.hero__title {
  font-size: clamp(2.75rem, 8.5vw, 5.5rem);
  line-height: 1.03;
  letter-spacing: -0.028em;   /* negative tracking grows with size */
  font-weight: 600;
}

/* ---------- Line-mask reveal ----------
   Each line sits in its own clipping box and rises into place. The heading
   itself is not faded, so the type never renders at partial opacity — it is
   either behind the mask or fully drawn. */

.lines .line {
  display: block;
  overflow: hidden;
  /* Descenders and negative tracking both overhang the line box */
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
}

.lines .line > span { display: block; }

/* Only once JS is present does anything start off-screen. */
.anim .lines .line > span {
  transform: translate3d(0, 110%, 0);
  transition: transform var(--dur-slow) var(--ease-out);
}

.anim .reveal.lines { opacity: 1; transform: none; }
.anim .reveal.lines.is-in .line > span { transform: none; }

.anim .lines .line:nth-child(2) > span { transition-delay: 70ms; }
.anim .lines .line:nth-child(3) > span { transition-delay: 140ms; }

.hero__lede {
  margin-top: var(--s-8);
  max-width: var(--measure);
  font-size: clamp(var(--t-md), 2.2vw, 1.4rem);
  line-height: 1.45;
  letter-spacing: -0.004em;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.hero__actions {
  margin-top: var(--s-12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
}

/* ---------- Section headings ---------- */

.section-title {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
}

.section-lede {
  margin-top: var(--s-6);
  max-width: var(--measure);
  font-size: var(--t-md);
  line-height: 1.5;
  color: var(--ink-muted);
  text-wrap: pretty;
}

/* ---------- The stack: one spine, four layers ---------- */

.stack {
  padding-block: var(--s-24);
  border-top: 1px solid var(--rule-soft);
}

.spine {
  position: relative;
  margin-top: var(--s-24);
}

/* The rail runs through all four layers and fills with scroll progress —
   the page itself shows "end to end". */
/* Rail centre must land exactly on the centre of the 1.9rem index dot:
   wrap padding + half the dot − half the rail. */
.spine__rail {
  position: absolute;
  left: calc(var(--s-6) + 0.95rem - 1px);
  top: 0.6rem;
  bottom: 0.6rem;
  width: 2px;
  background: var(--rule);
  border-radius: 2px;
}

.spine__fill {
  position: relative;
  width: 100%;
  height: 0;
  background: var(--accent);
  border-radius: 2px;
}

/* The head rides the end of the fill, so the eye has something to follow */
.spine__fill::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: -0.25rem;
  margin-bottom: -0.25rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0.35rem var(--accent-wash);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.spine[data-riding="true"] .spine__fill::after { opacity: 1; }

.layer {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: var(--s-6);
  padding-block: var(--s-16);
}
.layer:first-child { padding-top: 0; }
.layer:last-child { padding-bottom: 0; }

.layer__index {
  position: relative;
  z-index: 1;
}

.layer__index span {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: var(--t-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;   /* small text: slight positive tracking */
  transition: color var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              background-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-spring);
}

/* The rail arrives at the dot; the dot answers. Overshoot is warranted here —
   something reached it. */
.layer.is-active .layer__index span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 0.4rem var(--accent-wash);
  transform: scale(1.12);
}

.layer h3,
.layer__lede,
.layer__list li {
  transition: color var(--dur) var(--ease-out);
}
.layer.is-active h3 { color: var(--ink-strong); }

.layer h3 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.018em;
}

.layer__lede {
  margin-top: var(--s-3);
  max-width: var(--measure);
  font-size: var(--t-md);
  color: var(--ink-muted);
  text-wrap: pretty;
}

.layer__list {
  margin-top: var(--s-8);
  display: grid;
  gap: var(--s-3);
  max-width: 40rem;
}

.layer__list li {
  position: relative;
  padding-left: var(--s-6);
  font-size: var(--t-base);
  color: var(--ink);
  line-height: 1.5;
}

.layer__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: var(--ink-faint);
}

@media (max-width: 40rem) {
  .layer { grid-template-columns: 2.5rem 1fr; gap: var(--s-4); padding-block: var(--s-12); }
}

/* ---------- Statement ---------- */

.statement {
  padding-block: var(--s-24);
  background: var(--bg-sunken);
}

.statement__text {
  max-width: 46rem;
  font-size: clamp(1.5rem, 3.6vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: -0.016em;
  font-weight: 600;
  color: var(--ink-strong);
  text-wrap: balance;
}

/* Scroll-linked: each word darkens as the section passes the reading line.
   Linked to position, not to a timer, so it reverses when you scroll back —
   the motion follows the user rather than playing at them. */
.word {
  color: var(--ink-faint);
  transition: color 260ms var(--ease-out);
}
.word.is-lit { color: var(--ink-strong); }
.statement__text .accent .word.is-lit { color: var(--accent); }

/* ---------- Process ---------- */

.process { padding-block: var(--s-24); }

.steps {
  margin-top: var(--s-16);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-8);
}

.step {
  position: relative;
  padding-top: var(--s-6);
}

/* A hairline over each step that draws itself in as the step arrives */
.step::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--rule);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-slow) var(--ease-out);
}
.step.is-in::before { transform: scaleX(1); }

.step__num {
  display: block;
  font-size: var(--t-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.step h3 {
  margin-top: var(--s-3);
  font-size: var(--t-lg);
  letter-spacing: -0.012em;
}

.step p {
  margin-top: var(--s-3);
  color: var(--ink-muted);
  font-size: var(--t-base);
  text-wrap: pretty;
}

@media (max-width: 60rem) { .steps { grid-template-columns: repeat(2, 1fr); gap: var(--s-12) var(--s-8); } }
@media (max-width: 34rem) { .steps { grid-template-columns: 1fr; gap: var(--s-8); } }

/* ---------- Support cards ---------- */

.support {
  padding-block: var(--s-24);
  background: var(--bg-sunken);
}

.cards {
  margin-top: var(--s-16);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-6);
}

.card {
  background: var(--bg-raised);
  border-radius: var(--s-4);
  padding: var(--s-8);
  box-shadow: var(--shadow-card);
  /* `translate` rather than `transform`, so the lift composes with the
     reveal transform instead of fighting it */
  transition: box-shadow var(--dur) var(--ease-out),
              translate var(--dur) var(--ease-out);
}

@media (hover: hover) {
  .card:hover {
    translate: 0 -4px;
    box-shadow: var(--shadow-lift);
  }
}

.card h3 { font-size: var(--t-md); letter-spacing: -0.01em; }
.card p { margin-top: var(--s-3); color: var(--ink-muted); text-wrap: pretty; }

@media (max-width: 60rem) { .cards { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */

.contact {
  padding-block: var(--s-32);
  text-align: center;
}

.contact__title {
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.026em;
}

.contact__lede {
  margin: var(--s-6) auto 0;
  max-width: var(--measure);
  font-size: var(--t-md);
  color: var(--ink-muted);
  text-wrap: pretty;
}

.contact__actions {
  margin-top: var(--s-12);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-4);
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--rule-soft);
  padding-block: var(--s-8);
  font-size: var(--t-sm);
  color: var(--ink-faint);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink);
  font-weight: 600;
}

.footer__note { color: var(--ink-faint); }

/* ---------- Reveal on scroll ---------- */

/* Hiding only ever happens once JS has confirmed it can un-hide.
   No script, no IntersectionObserver, no `.anim` — the page is just a page. */
.anim .reveal {
  opacity: 0;
  transform: translate3d(0, 1.25rem, 0);
  transition: opacity var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
  will-change: opacity, transform;
}

.anim .reveal.is-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

.anim .reveal[data-delay="1"] { transition-delay: 60ms; }
.anim .reveal[data-delay="2"] { transition-delay: 120ms; }
.anim .reveal[data-delay="3"] { transition-delay: 180ms; }

/* ---------- Accessibility preferences ---------- */

/* Reduced motion keeps every state change — only the travel is removed.
   Nothing slides, rises, scales or overshoots; colour and opacity still
   carry the meaning. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .anim .reveal {
    transform: none;
    transition: opacity 200ms ease;
  }

  .anim .lines .line > span {
    transform: none;
    transition: opacity 200ms ease;
  }
  .anim .lines .line { overflow: visible; }

  .step::before { transform: scaleX(1); transition: none; }
  .nav__links a::after { transition: none; }
  .nav__brand:hover .mark__horizon--l,
  .nav__brand:hover .mark__horizon--r,
  .nav__brand:hover .mark__ground,
  .footer__brand:hover .mark__horizon--l,
  .footer__brand:hover .mark__horizon--r,
  .footer__brand:hover .mark__ground { transform: none; }
  .layer.is-active .layer__index span { transform: none; }
  .card { transition: box-shadow var(--dur) ease; }
  .card:hover { translate: none; }
  .btn:active { transform: none; }
  .btn__chev { transition: none; }

  * { animation-duration: 0.01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .nav {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ink-muted: #3a2f29;
    --ink-faint: #45392f;
    --rule: rgba(28, 20, 14, 0.42);
    --rule-soft: rgba(28, 20, 14, 0.26);
    --accent: #9f3409;
  }
  .nav { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .card { border: 1px solid var(--rule); }
  .word { color: var(--ink-muted); }
}

@media print {
  .nav, .skip-link { display: none; }
  .anim .reveal { opacity: 1; transform: none; }
  .anim .lines .line > span { transform: none; }
  .word { color: #000; }
  body { color: #000; background: #fff; }
}
