/* ==========================================================================
   Pheidon — pheidon.tech
   Base styles render a complete static page (no JS / reduced motion).
   The scroll-driven landing lives under html.motion (set by main.js).
   ========================================================================== */

@font-face {
  font-family: "Pheidon Display";
  src: url("fonts/PheidonDisplay.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Pheidon Text";
  src: url("fonts/PheidonText.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Pheidon Mono";
  src: url("fonts/PheidonMono.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --ground: #0c0c0e;
  --fg: #f5f5f7;
  --muted: #a1a1aa;
  --hair: rgba(245, 245, 247, 0.12);
  --c1: #ff4d36;
  --c2: #e11d48;
  --c3: #991b1b;

  --font-display: "Pheidon Display", ui-sans-serif, system-ui, sans-serif;
  --font-text: "Pheidon Text", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Pheidon Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gut: max(24px, env(safe-area-inset-left, 0px));
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --wm-w: clamp(240px, 38vw, 560px);

  color-scheme: dark;
}

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

html {
  scrollbar-color: #3a3a40 var(--ground);
  scrollbar-width: thin;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-synthesis: none;
}
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--ground);
}
::-webkit-scrollbar-thumb {
  border: 2px solid var(--ground);
  border-radius: 10px;
  background: #3a3a40;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--c2);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--fg);
  font-family: var(--font-text);
  font-weight: normal;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip; /* clip never creates a scroll container, so the pinned landing keeps working */
}

h1,
h2,
p {
  margin: 0;
  font-weight: normal;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
}
::selection {
  background: rgba(225, 29, 72, 0.5);
  color: var(--fg);
}
:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--fg);
  color: var(--ground);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.hi {
  color: var(--c1);
}

/* static graphite grain over everything */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.03;
  mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Buttons (Palantir-style: square, outlined or solid white) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 40px;
  padding: 0 1.25rem;
  border: 1px solid rgba(245, 245, 247, 0.85);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.btn:hover {
  background: var(--fg);
  color: var(--ground);
}
.btn--solid {
  min-height: 48px;
  padding: 0 1.6rem;
  background: var(--fg);
  color: var(--ground);
  font-size: 0.875rem;
}
.btn--solid:hover {
  background: transparent;
  color: var(--fg);
}
.btn__icon {
  width: 14px;
  height: 14px;
  transition: transform 0.5s var(--ease);
}

/* ---------- Top navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: calc(64px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(24px, env(safe-area-inset-right, 0px)) 0 var(--gut);
  background: rgba(12, 12, 14, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hair);
}
.nav__home {
  display: block;
  padding: 6px 0;
}
.navwm {
  width: 118px;
  height: auto;
}

/* ---------- Landing ---------- */
.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 6rem var(--gut) 4rem;
  overflow: hidden;
  isolation: isolate;
  background: var(--ground);
}
.herobg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.herobg__base {
  position: absolute;
  inset: -40px;
  background: var(--ground);
  filter: url(#flute);
}
.herobg__mottle,
.herobg__chip {
  position: absolute;
  inset: 0;
}
.herobg__mottle {
  opacity: 0.5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}
.herobg__chip {
  opacity: 0.62;
  background: url("chip.svg") center / 640px 640px;
}
.herobg__glass {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.01) 3px,
    rgba(0, 0, 0, 0) 13px,
    rgba(0, 0, 0, 0.14) 26px,
    rgba(0, 0, 0, 0.26) 32px,
    rgba(255, 255, 255, 0.05) 34px
  );
}
.herobg__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 95% at 50% 50%, rgba(12, 12, 14, 0.1) 35%, rgba(12, 12, 14, 0.8));
}

.wordmark {
  position: relative;
  z-index: 4;
  width: var(--wm-w);
}
.wm {
  width: 100%;
  height: auto;
  overflow: visible;
}
.wm__l {
  fill: var(--fg);
  stroke: var(--c1);
  stroke-width: 1.25;
  stroke-opacity: 0;
}
.wm__l--mark {
  fill: url(#wmGrad);
}

.hero {
  position: relative;
  z-index: 2;
  max-width: 10.5em;
  font-family: var(--font-display);
  font-size: clamp(2rem, 0.8rem + 4.5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-align: center;
  text-wrap: balance;
}
.shield {
  display: none;
}
.facet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.facet__shape {
  stroke: var(--c1);
  stroke-width: 1.25;
  stroke-opacity: 0;
}
.facet__flat {
  fill: #d4183f;
  opacity: 0;
}

/* scroll signal: a short rail with a pulse that runs into a chevron (it never moves) */
.cue {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
  width: 28px;
  height: 52px;
  transform: translateX(-50%);
  pointer-events: none;
}
.cue__svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.cue__rail,
.cue__pulse,
.cue__chev {
  fill: none;
  stroke: var(--c1);
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}
.cue__rail {
  stroke-opacity: 0.42;
}
.cue__pulse {
  stroke-width: 2;
  stroke-dasharray: 0.28 1.4;
  stroke-dashoffset: 0.28;
  opacity: 0;
}
.cue__chev {
  stroke-width: 2;
}

/* ---------- Sections ---------- */
.sec {
  position: relative;
  border-top: 1px solid var(--hair);
  padding-block: clamp(6rem, 18vh, 11rem);
  padding-left: var(--gut);
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  overflow-x: clip;
}
.sec__in {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.mission__text {
  max-width: 46rem;
  font-family: var(--font-text);
  font-size: clamp(1.4rem, 0.9rem + 2vw, 2.4rem);
  line-height: 1.42;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.contact .sec__in {
  gap: 2rem;
}
.status {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------- Inquiry form ---------- */
.inquiry {
  width: 100%;
  max-width: 34rem;
}
.inquiry > summary {
  list-style: none;
}
.inquiry > summary::-webkit-details-marker {
  display: none;
}
.inquiry[open] .btn__icon {
  transform: rotate(180deg);
}
.panel {
  margin-top: 1.75rem;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid var(--hair);
  background: #111114;
  text-align: left;
}
.form {
  display: grid;
  gap: 1.5rem;
}
.form__row {
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 34rem) {
  .form__row {
    grid-template-columns: 1fr 1fr;
  }
}
.field {
  position: relative;
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}
.field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--c1);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.field:focus-within::after {
  transform: scaleX(1);
}
.field label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.field .optional {
  color: var(--muted);
}
.field input,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0 0.65rem;
  border: 0;
  border-bottom: 1px solid rgba(245, 245, 247, 0.22);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.4;
}
.field textarea {
  min-height: 6.5rem;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: none;
}
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}
.form__alt {
  font-size: 0.875rem;
  color: var(--muted);
}
.form__alt a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: rgba(245, 245, 247, 0.35);
  text-underline-offset: 0.22em;
}
.form__alt a:hover {
  text-decoration-color: var(--c1);
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.5rem max(24px, env(safe-area-inset-right, 0px)) calc(1.75rem + env(safe-area-inset-bottom, 0px)) var(--gut);
  border-top: 1px solid var(--hair);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Simple pages (thanks / 404) ---------- */
.simple {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 4rem var(--gut);
  text-align: center;
}
.simple .hero {
  font-size: clamp(2rem, 1rem + 3.5vw, 3.5rem);
}
.simple .lede {
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
}

/* ==========================================================================
   MOTION MODE — html.motion (JS on, no reduced-motion preference)
   ========================================================================== */

/* hide until the typefaces are ready, with a failsafe */
.motion body {
  opacity: 0;
  animation: failsafe 0s linear 2.5s forwards;
}
.motion.is-anim body {
  opacity: 1;
  transition: opacity 0.5s ease;
}
@keyframes failsafe {
  to {
    opacity: 1;
  }
}

/* nav slides in once you are past the landing */
.motion .nav {
  transform: translateY(-101%);
  transition: transform 0.7s var(--ease);
}
.motion .nav.on {
  transform: none;
}

/* pinned landing */
.motion .opening {
  height: 260vh;
  height: 260svh;
}
.motion .stage {
  position: sticky;
  top: 0;
  display: block;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding: 0;
}
/* everything except the logo's gap shows the glass; the gap shows the plain ground */
.motion .herobg {
  clip-path: polygon(
    evenodd,
    0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    calc(var(--xl, 0) * 1px) calc(var(--yt, 0) * 1px),
    calc(var(--xr, 0) * 1px) calc(var(--yt, 0) * 1px),
    calc(var(--xr, 0) * 1px) calc(var(--yb, 0) * 1px),
    calc(var(--xl, 0) * 1px) calc(var(--yb, 0) * 1px),
    calc(var(--xl, 0) * 1px) calc(var(--yt, 0) * 1px)
  );
}
.motion .opening .wordmark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.motion .opening .wm__l--mark {
  opacity: 0; /* the real logo sits exactly here instead */
}
.motion .opening .wm__l:nth-of-type(-n + 3) {
  transform: translateX(calc(var(--lift, 0) * -1500px));
  opacity: calc(1 - var(--lift, 0) * 1.2);
}
.motion .opening .wm__l:nth-of-type(n + 5) {
  transform: translateX(calc(var(--lift, 0) * 1500px));
  opacity: calc(1 - var(--lift, 0) * 1.2);
}
.motion .opening .hero {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  width: min(88vw, 10.5em);
  font-size: clamp(2.5rem, 0.8rem + 6.4vw, 6rem);
  transform: translate(-50%, -50%);
  opacity: var(--hop, 0);
  clip-path: inset(-30% calc(var(--hcr, 9999) * 1px) -30% calc(var(--hcl, 9999) * 1px));
}
.motion .shield {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  height: calc(var(--fh, 3000) * 1px);
  aspect-ratio: 200 / 240;
  transform:
    translate(-50%, -50%)
    translateX(calc((1 - var(--grow, 0)) * var(--x0, 0) * 1px))
    scale(calc(var(--s0, 0.02) + (1 - var(--s0, 0.02)) * var(--grow, 0)));
  filter: drop-shadow(0 10px 30px rgba(225, 29, 72, calc(0.28 * (1 - var(--grow, 0))))) brightness(var(--dimv, 1));
}
.motion .facet--l {
  transform: translateX(calc(var(--slx, 0) * -1px));
}
.motion .facet--r {
  transform: translateX(calc(var(--slx, 0) * 1px));
}
.motion .facet__flat {
  opacity: var(--flat, 0);
}

/* intro: the wordmark and logo draw in as outlines, centre outward, then fill */
.motion.is-anim .wm__l,
.motion.is-anim .facet__shape {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  stroke-opacity: 1;
  fill-opacity: 0;
  animation:
    draw 1.1s var(--ease) var(--wd, 0.55s) forwards,
    flood 0.8s ease calc(var(--wd, 0.55s) + 0.55s) forwards,
    unstroke 0.8s ease calc(var(--wd, 0.55s) + 1.1s) forwards;
}
.wm__l:nth-of-type(3),
.wm__l:nth-of-type(5) {
  --wd: 0.68s;
}
.wm__l:nth-of-type(2),
.wm__l:nth-of-type(6) {
  --wd: 0.81s;
}
.wm__l:nth-of-type(1),
.wm__l:nth-of-type(7) {
  --wd: 0.94s;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes flood {
  to {
    fill-opacity: 1;
  }
}
@keyframes unstroke {
  to {
    stroke-opacity: 0;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* scroll signal: draws in after the intro, then pulses; fades as you scroll */
.motion .cue {
  opacity: var(--cue, 1);
}
.motion.is-anim .cue__rail,
.motion.is-anim .cue__chev {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}
.motion.is-anim .cue__rail {
  animation: draw 0.7s var(--ease) 2.3s forwards;
}
.motion.is-anim .cue__chev {
  animation:
    draw 0.5s var(--ease) 2.85s forwards,
    cue-chev 2.4s ease-in-out 4.19s infinite;
}
.motion.is-anim .cue__pulse {
  animation: cue-pulse 2.4s cubic-bezier(0.55, 0, 0.45, 1) 3.35s infinite;
}
@keyframes cue-pulse {
  0% {
    stroke-dashoffset: 0.28;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  45% {
    stroke-dashoffset: -1;
    opacity: 1;
  }
  46%,
  100% {
    stroke-dashoffset: -1;
    opacity: 0;
  }
}
@keyframes cue-chev {
  0%,
  100% {
    stroke-opacity: 0.55;
  }
  10% {
    stroke-opacity: 1;
  }
}

/* mission: words resolve in sequence */
.motion .lw {
  display: inline-block;
  opacity: 0.08;
  filter: blur(6px);
}
.motion .mission.is-in .lw {
  animation: word-in 0.9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 34ms);
}
@keyframes word-in {
  from {
    opacity: 0.08;
    filter: blur(6px);
    transform: translateY(0.25em);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

/* contact */
.motion .contact .status,
.motion .contact .inquiry {
  opacity: 0;
  transform: translateY(20px);
}
.motion .contact.is-in .status {
  animation: rise 1s var(--ease) 0.1s both;
}
.motion .contact.is-in .inquiry {
  animation: rise 1s var(--ease) 0.3s both;
}
.motion .inquiry[open] .panel {
  animation: rise 0.7s var(--ease) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* simple pages */
.motion .simple .hero,
.motion .simple .lede,
.motion .simple .btn {
  opacity: 0;
}
.motion.is-anim .simple .hero {
  animation: rise 1s var(--ease) 1.5s both;
}
.motion.is-anim .simple .lede {
  animation: rise 1s var(--ease) 1.7s both;
}
.motion.is-anim .simple .btn {
  animation: rise 1s var(--ease) 1.9s both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
