/* ============================================================
   HEIMDALL - heimdallreach.com
   Deep-forest black / off-white / muted biological green.
   ============================================================ */

:root {
  --bg: #070907;
  --bg-raised: #0b0e0b;
  --ink: #e9ebe4;
  --ink-dim: #99a196;
  --ink-faint: #5c645b;
  --green: #6f8f79;
  --green-deep: #3d5546;
  --metal: #b3a17c;
  --hairline: rgba(233, 235, 228, 0.09);
  --hairline-strong: rgba(233, 235, 228, 0.16);

  /* Typography system, aligned to the investor deck (Fraunces/Manrope stand
     in for the deck's The Seasons / Canva Sans - see README for why).
     --font-serif  : display headings only (h1 wordmark, section headings)
     --font-display: body copy, UI labels, nav, buttons, metadata
     --font-mono   : the technical-readout motif (rails, status, addresses) */
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-display: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Fragment Mono", "SFMono-Regular", Consolas, monospace;

  --pad: clamp(1.5rem, 5vw, 4.5rem);
  --maxw: 90rem;            /* the content grid every element aligns to */

  /* notch / rounded-corner insets (0 where unsupported) */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  /* paints the iOS rubber-band overscroll area so it never flashes white */
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: clip;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--green-deep);
  color: var(--ink);
}

a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- signal field canvas ---------- */

#field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  /* largest-viewport height: stays constant while mobile browser bars
     collapse, so the field never rebuilds or stretches mid-scroll */
  height: 100lvh;
  z-index: 0;
  pointer-events: none;
}

/* ---------- grain ---------- */

.grain {
  position: fixed;
  /* only needs to overhang by more than the animation's 3% drift; -50%
     made this a 4x-viewport composited layer for no visual gain */
  inset: -10%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.2s steps(4) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, 3%); }
  50%  { transform: translate(3%, -2%); }
  75%  { transform: translate(-3%, -3%); }
  100% { transform: translate(0, 0); }
}

/* ---------- top bar ---------- */

.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.4rem var(--pad) 2.2rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  /* a longer, denser fade so section rails dissolve as they scroll under
     the bar rather than colliding legibly with the wordmark */
  background: linear-gradient(
    to bottom,
    rgba(7, 9, 7, 0.98) 0%,
    rgba(7, 9, 7, 0.95) 42%,
    rgba(7, 9, 7, 0.72) 68%,
    rgba(7, 9, 7, 0) 100%
  );
}

.top__mark { display: inline-flex; }

.top__mark img {
  display: block;
  width: 18px;
  height: 18px;
}

.top__word { color: var(--ink); }

.top__status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-faint);
}

.top__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 3.2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 1; }
}

/* ---------- hero ---------- */

main { position: relative; z-index: 2; }

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--pad);
  position: relative;
}

.hero__inner {
  max-width: 72rem;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

.hero__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(3.2rem, 12.5vw, 11rem);
  /* a display serif wants tight tracking, not the wide spacing the old
     tracked-caps grotesque needed for character definition */
  letter-spacing: -0.01em;
  line-height: 1;
  background: linear-gradient(180deg, var(--ink) 55%, rgba(233, 235, 228, 0.55));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__statement {
  margin-top: clamp(1.75rem, 4vh, 3rem);
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.3vw, 1.55rem);
  font-weight: 500;
  letter-spacing: 0;
  color: rgba(233, 235, 228, 0.72);
}

.hero__cta {
  margin-top: clamp(2.25rem, 5.5vh, 4rem);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.05rem 2.1rem;
  border: 1px solid var(--hairline-strong);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(11, 14, 11, 0.4);
  transition: border-color 0.45s ease, background 0.45s ease;
}

.btn:focus-visible {
  border-color: var(--green);
  background: rgba(61, 85, 70, 0.14);
  outline: 1px solid var(--green);
  outline-offset: 3px;
}

/* touch feedback - replaces hover on phones */
.btn:active {
  border-color: var(--green);
  background: rgba(61, 85, 70, 0.22);
}

.btn__arrow {
  color: var(--green);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    border-color: var(--green);
    background: rgba(61, 85, 70, 0.14);
  }

  .btn:hover .btn__arrow { transform: translateX(5px); }
}

.hero__foot {
  position: absolute;
  left: var(--pad); right: var(--pad); bottom: 1.6rem;
  display: flex;
  justify-content: space-between;
  /* the scroll cue carries the descending line and is taller than its
     siblings; align tops so all three labels share one baseline */
  align-items: flex-start;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  color: var(--ink-faint);
}

.hero__scroll {
  position: relative;
  padding-bottom: 2.4rem;
}

.hero__scroll::after {
  content: "";
  position: absolute;
  left: 50%; top: 1.2rem;
  width: 1px; height: 1.6rem;
  background: linear-gradient(to bottom, var(--ink-faint), transparent);
  animation: scroll-hint 2.6s ease-in-out infinite;
}

@keyframes scroll-hint {
  0%, 100% { transform: scaleY(0.4); transform-origin: top; opacity: 0.4; }
  50%      { transform: scaleY(1);   transform-origin: top; opacity: 1; }
}

/* ---------- load-in reveal ---------- */

.reveal {
  /* Visible by default: the hero must never be lost if animations don't run.
     The "backwards" half of the fill hides it during the delay instead. */
  opacity: 1;
  animation: reveal 1.1s cubic-bezier(0.2, 0.65, 0.25, 1) both;
  animation-delay: calc(0.25s + var(--d, 0) * 0.14s);
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- scroll-observed reveal ---------- */

.observe {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s cubic-bezier(0.2, 0.65, 0.25, 1),
              transform 1s cubic-bezier(0.2, 0.65, 0.25, 1);
}

.observe.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- sections ---------- */

.section {
  border-top: 1px solid var(--hairline);
  padding: clamp(6rem, 14vh, 10rem) var(--pad);
  display: grid;
  /* fluid rail: at ~1200px and above this is the original 10rem. Below that
     it narrows, so the text measure never shrinks as the viewport grows. */
  grid-template-columns: minmax(0, clamp(6.5rem, 12vw, 10rem)) minmax(0, 1fr);
  gap: 2rem;
  max-width: var(--maxw);
  margin: 0 auto;
}

.section__rail {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  padding-top: 0.65em;
  white-space: nowrap;
}

.section__rail::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  margin-top: 1rem;
  background: linear-gradient(to right, var(--green-deep), transparent);
}

.section__body { max-width: 44rem; }

.lede {
  font-size: clamp(1.45rem, 3.1vw, 2.25rem);
  font-weight: 400;
  line-height: 1.48;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}

/* ---------- stealth ---------- */

.stealth { display: block; }

.stealth__line {
  display: block;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
  color: var(--ink);
}

.stealth__sub {
  display: block;
  margin-top: 1.1rem;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  color: var(--ink-dim);
  max-width: 34rem;
}

/* ---------- contact ---------- */

.section--contact { padding-bottom: clamp(7rem, 16vh, 12rem); }

.contact__panel {
  position: relative;
  border: 1px solid var(--hairline);
  background: rgba(11, 14, 11, 0.35);
  padding: clamp(2.25rem, 5vw, 3.75rem);
  transition: border-color 0.6s ease;
}

/* technical-drawing registration marks, opposing corners */
.contact__panel::before,
.contact__panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid var(--green);
  opacity: 0.75;
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
              height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.contact__panel::before {
  top: -1px; left: -1px;
  border-top-width: 1px;
  border-left-width: 1px;
}

.contact__panel::after {
  bottom: -1px; right: -1px;
  border-bottom-width: 1px;
  border-right-width: 1px;
}

@media (hover: hover) and (pointer: fine) {
  .contact__panel:hover { border-color: var(--hairline-strong); }

  .contact__panel:hover::before,
  .contact__panel:hover::after {
    width: 26px;
    height: 26px;
  }
}

.contact__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.36em;
  color: var(--ink-faint);
  margin-bottom: 1.75rem;
}

.contact__q {
  font-family: var(--font-serif);
  font-size: clamp(1.45rem, 3.1vw, 2.3rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
  margin-bottom: 2.25rem;
  text-wrap: balance;
}

.contact__mail {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  letter-spacing: 0.04em;
  color: var(--green);
  text-decoration: none;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--green-deep);
  transition: color 0.4s ease, border-color 0.4s ease;
}

.contact__mail:focus-visible {
  color: var(--ink);
  border-color: var(--metal);
  outline: 1px solid var(--green);
  outline-offset: 4px;
}

.contact__mail:active {
  color: var(--ink);
  border-color: var(--metal);
}

@media (hover: hover) and (pointer: fine) {
  .contact__mail:hover {
    color: var(--ink);
    border-color: var(--metal);
  }
}

/* ---------- brand note ---------- */

.brandstory {
  margin-top: clamp(3rem, 7vh, 4.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
}

.brandnote {
  max-width: 30rem;
  font-size: 0.82rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
}

.brandnote::before {
  content: "";
  display: block;
  width: 2rem;
  height: 1px;
  margin-bottom: 1.4rem;
  background: var(--green-deep);
}

/* the detailed sentinel-and-roots emblem: a quiet artifact beside the myth,
   discovered rather than announced - never a second logo */
.brandstory__mark {
  width: clamp(84px, 9vw, 120px);
  height: auto;
  flex: none;
  opacity: 0.34;
  filter: saturate(0.85);
  transition: opacity 1.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .brandstory:hover .brandstory__mark { opacity: 0.7; }
}

/* ---------- footer ---------- */

.footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--hairline);
  /* same grid as the sections, so its rule lines up with theirs */
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem var(--pad) 2.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.footer__social {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.4s ease;
  /* enlarge the touch target without altering footer rhythm */
  padding: 0.7rem 0;
  margin: -0.7rem 0;
}

.footer__social svg { opacity: 0.85; transition: opacity 0.4s ease; }

.footer__social:focus-visible {
  color: var(--green);
  outline: 1px solid var(--green);
  outline-offset: 4px;
}

.footer__social:active { color: var(--green); }

.footer__social:focus-visible svg,
.footer__social:active svg { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  .footer__social:hover { color: var(--green); }
  .footer__social:hover svg { opacity: 1; }
}

/* ---------- responsive ---------- */

/* ===== phones / narrow portrait ===== */
@media (max-width: 720px) {

  :root { --pad: 1.5rem; }

  /* -- top bar: clears the notch, slightly larger for legibility -- */
  .top {
    padding-top: calc(1rem + var(--safe-t));
    padding-bottom: 1.7rem;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
  }

  /* -- hero: reserve space for the fixed bar and the footer meta row,
        so the centred block can never collide with either -- */
  .hero {
    padding-top: calc(5.5rem + var(--safe-t));
    padding-bottom: calc(6.5rem + var(--safe-b));
  }

  /* the wordmark is the hero - let it fill the measure deliberately.
     Tracking tightens as the type grows so it never crowds the edges. */
  .hero__title {
    /* 15vw fills the measure on phones; the cap only engages on wider
       tablets, where it meets the desktop scale without a visible jump */
    font-size: min(15vw, 5.6rem);
    letter-spacing: -0.01em;
  }

  .hero__statement {
    margin-top: 1.6rem;
    font-size: 1.06rem;
    color: rgba(233, 235, 228, 0.78);
    text-wrap: balance;
  }

  .hero__cta { margin-top: 2.5rem; }

  .btn {
    padding: 1.15rem 2.1rem;
    font-size: 0.7rem;
    letter-spacing: 0.24em;
  }

  .hero__foot {
    bottom: calc(1.5rem + var(--safe-b));
    font-size: 0.58rem;
    letter-spacing: 0.2em;
    gap: 0.75rem;
  }

  .hero__scroll { padding-bottom: 2rem; }

  .hero__scroll::after { top: 1rem; height: 1.3rem; }

  /* -- sections: tighter vertical rhythm so the page doesn't feel sparse -- */
  .section {
    grid-template-columns: 1fr;
    gap: 1.6rem;
    padding-top: clamp(4.5rem, 9vh, 6rem);
    padding-bottom: clamp(4.5rem, 9vh, 6rem);
  }

  .section__rail {
    padding-top: 0;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
  }

  .section__rail::after {
    margin-top: 0.7rem;
    width: 2rem;
  }

  .lede {
    font-size: 1.32rem;
    line-height: 1.5;
  }

  .stealth__line { font-size: 1.2rem; }

  .stealth__sub {
    margin-top: 0.9rem;
    font-size: 0.97rem;
    line-height: 1.6;
  }

  /* -- contact -- */
  .section--contact { padding-bottom: clamp(5rem, 11vh, 7rem); }

  .contact__panel {
    padding: 1.75rem 1.5rem 2rem;
    /* a touch more opaque on small screens so the signal field reads behind
       the panel rather than through the address */
    background: rgba(11, 14, 11, 0.55);
  }

  .contact__label {
    font-size: 0.57rem;
    letter-spacing: 0.3em;
    margin-bottom: 1.25rem;
  }

  .contact__q {
    font-size: 1.32rem;
    line-height: 1.4;
    margin-bottom: 1.75rem;
  }

  /* sized in vw so the full address always fits the panel, never wraps */
  .contact__mail {
    font-size: clamp(0.86rem, 3.9vw, 1.2rem);
    letter-spacing: 0.02em;
    /* >=44px touch target without disturbing the underline */
    padding-top: 0.95rem;
    margin-top: -0.95rem;
    padding-bottom: 0.5rem;
  }

  .brandstory {
    margin-top: 2.75rem;
    /* mark drops below the note, right-aligned - a faint signature,
       not a competing element in the narrow column */
    flex-direction: column;
    align-items: flex-end;
    gap: 1.9rem;
  }

  .brandnote {
    font-size: 0.86rem;
    line-height: 1.7;
    color: #6b736a; /* nudged up for small-screen legibility */
    align-self: stretch;
  }

  .brandnote::before { margin-bottom: 1.15rem; }

  .brandstory__mark {
    width: 76px;
    opacity: 0.3;
  }

  /* -- footer -- */
  .footer {
    padding-top: 1.75rem;
    padding-bottom: calc(1.9rem + var(--safe-b));
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    row-gap: 1.1rem;
  }

  .footer__social {
    padding: 0.95rem 0;
    margin: -0.95rem 0;
  }

}

/* static grain on touch devices: same texture, no continuous compositing
   of a viewport-sized layer (frame budget + battery) */
@media (pointer: coarse) {
  .grain {
    inset: 0;
    animation: none;
    opacity: 0.05;
  }
}

/* ===== very small phones (360px and under) ===== */
@media (max-width: 380px) {
  :root { --pad: 1.25rem; }

  .hero__statement { font-size: 1rem; }

  .btn {
    padding: 1.1rem 1.6rem;
    letter-spacing: 0.2em;
  }

  .hero__foot { font-size: 0.55rem; letter-spacing: 0.16em; }

  .lede,
  .contact__q { font-size: 1.24rem; }

  .contact__panel { padding: 1.5rem 1.25rem 1.75rem; }
}

/* ===== short viewports (landscape phones) ===== */
@media (max-height: 520px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding-top: calc(6rem + var(--safe-t));
    padding-bottom: 5rem;
  }

  .hero__title { font-size: min(11vw, 4rem); }

  .hero__foot { position: static; margin-top: 2.5rem; }

  .hero__scroll { display: none; }
}

/* ---------- gutters: content grid + notch safety (must win over shorthands) ----------
   Beyond --maxw the viewport-spanning elements (fixed header, hero) would
   otherwise sit flush to the screen edge while the capped sections float in
   the middle. The third term re-creates the section's own inset so every
   element starts on the same vertical line at any width. */

/* already capped at --maxw by their own max-width: they only need notch safety */
.section,
.footer {
  padding-left: max(var(--pad), var(--safe-l));
  padding-right: max(var(--pad), var(--safe-r));
}

/* viewport-spanning: add the grid inset so they start on the section line.
   (percentages here resolve against the viewport-width containing block) */
.top,
.hero {
  padding-left: max(var(--pad), var(--safe-l), calc((100% - var(--maxw)) / 2 + var(--pad)));
  padding-right: max(var(--pad), var(--safe-r), calc((100% - var(--maxw)) / 2 + var(--pad)));
}

.hero__foot {
  left: max(var(--pad), var(--safe-l), calc((100% - var(--maxw)) / 2 + var(--pad)));
  right: max(var(--pad), var(--safe-r), calc((100% - var(--maxw)) / 2 + var(--pad)));
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal,
  .observe {
    animation: none;
    transition: none;
    opacity: 1;
    transform: none;
  }

  .grain,
  .top__dot,
  .hero__scroll::after {
    animation: none;
  }
}
