/* ==========================================================================
   Saorlin — brand tokens, reset, layout, and section styles
   ========================================================================== */

:root {
  --ink: #12141A;
  --ink-2: #191C24;
  --ink-3: #0D0F14;
  --surface: #1B1E28;
  --surface-hover: #21252F;
  --bone: #ECEAE1;
  --bone-dim: #C8C6BC;
  --muted: #888C9E;
  --brass: #C9A063;
  --brass-bright: #DDB77E;
  --hairline: rgba(236, 234, 225, 0.10);
  --hairline-strong: rgba(236, 234, 225, 0.18);
  --glow-brass: rgba(201, 160, 99, 0.18);

  --font-display: 'Space Grotesk', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ---------- */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--hairline-strong) var(--ink);
  scrollbar-width: thin;
}

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul {
  list-style: none;
}

/* Ambient warmth: faint layered radial glow + a deep bottom vignette */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(201, 160, 99, 0.14), transparent 60%),
    radial-gradient(ellipse 800px 560px at 88% 18%, rgba(224, 190, 134, 0.10), transparent 58%),
    radial-gradient(ellipse 700px 500px at 100% 110%, rgba(201, 160, 99, 0.08), transparent 60%),
    radial-gradient(ellipse 1200px 700px at 50% 120%, var(--ink-3), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Cursor-reactive glow — positioned by assets/js/cursor-glow.js, silently
   absent on touch devices and for prefers-reduced-motion users */
.cursor-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), var(--glow-color, var(--glow-brass)), transparent 78%);
}

.cursor-glow[data-active='true'] {
  opacity: 1;
}

.hero-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Film-grain texture, applied uniformly across the whole viewport */
.grain {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  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%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 400;
  background: var(--brass);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 65rem;
  margin: 0 auto;
  padding: 0 1.75rem;
}

/* Custom scrollbar (WebKit/Chromium) — degrades invisibly elsewhere */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--ink);
}

::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 8px;
  border: 2px solid var(--ink);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 160, 99, 0.35);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.site-header .header-inner {
  padding: 2rem 0;
  transition: padding 0.3s ease;
}

.site-header.scrolled {
  background: rgba(18, 20, 26, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--hairline);
}

.site-header.scrolled .header-inner {
  padding: 1.125rem 0;
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.lockup .mark {
  filter: drop-shadow(0 0 8px rgba(201, 160, 99, 0.2));
}

.lockup .wordtype {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--bone);
}

/* ---------- Hero ---------- */

.hero {
  padding: 6.75rem 0 3.25rem;
  text-align: left;
  max-width: 40rem;
}

.eyebrow,
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.eyebrow::before,
.section-label::before {
  content: '';
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
  flex-shrink: 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1.375rem;
}

.hero-mark {
  width: 72px;
  height: 72px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 28px rgba(224, 190, 134, 0.55));
}

@media (prefers-reduced-motion: no-preference) {
  .hero-mark path {
    stroke-dasharray: 72;
    stroke-dashoffset: 72;
  }

  body.is-ready .hero-mark path {
    animation: draw-gate 0.9s var(--ease) 0.18s forwards;
  }
}

@keyframes draw-gate {
  to { stroke-dashoffset: 0; }
}

/* ---------- Preloader ---------- */
/* Same draw mechanic as .hero-mark (stroke-dasharray 72, matching the gate
   path's true length), looped: hidden -> fully drawn -> hidden. */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.05rem;
}

.preloader-mark {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 20px rgba(201, 160, 99, 0.3));
}

.preloader-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brass);
  opacity: 0.75;
}

@media (prefers-reduced-motion: no-preference) {
  .preloader-mark path {
    stroke-dasharray: 72;
    stroke-dashoffset: 72;
    animation: loading-draw 1.6s var(--ease) infinite;
  }
}

@keyframes loading-draw {
  0% { stroke-dashoffset: 72; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -72; }
}

.hero h1,
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.1rem, 11vw, 6.1rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--bone);
  margin-bottom: 1.375rem;
}

.wordmark span {
  display: inline-block;
}

.hero p.motto {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  color: var(--brass-bright);
  margin-bottom: 1.125rem;
}

.hero p {
  font-size: 1.0625rem;
  color: var(--bone-dim);
  max-width: 36rem;
  line-height: 1.65;
  margin-bottom: 0.5rem;
}

.hero p.sub {
  font-size: 1.0625rem;
  color: var(--bone-dim);
}

@media (prefers-reduced-motion: no-preference) {
  .eyebrow,
  .hero-mark,
  .hero p.motto,
  .hero p,
  .facts-row,
  .wordmark span {
    opacity: 0;
  }

  .wordmark span {
    transform: translateY(16px);
  }

  body.is-ready .eyebrow,
  body.is-ready .hero-mark,
  body.is-ready .hero p.motto,
  body.is-ready .hero p,
  body.is-ready .facts-row {
    animation: rise 0.8s var(--ease) forwards;
  }

  body.is-ready .eyebrow { animation-delay: 0.05s; }
  body.is-ready .hero-mark { animation-delay: 0.12s; }
  body.is-ready .hero p.motto { animation-delay: 0.42s; }
  body.is-ready .hero p { animation-delay: 0.5s; }
  body.is-ready .hero p.sub { animation-delay: 0.58s; }
  body.is-ready .facts-row { animation-delay: 0.7s; }

  body.is-ready .wordmark span {
    animation: rise 0.75s var(--ease) forwards;
  }

  body.is-ready .wordmark span:nth-child(1) { animation-delay: 0.16s; }
  body.is-ready .wordmark span:nth-child(2) { animation-delay: 0.19s; }
  body.is-ready .wordmark span:nth-child(3) { animation-delay: 0.22s; }
  body.is-ready .wordmark span:nth-child(4) { animation-delay: 0.25s; }
  body.is-ready .wordmark span:nth-child(5) { animation-delay: 0.28s; }
  body.is-ready .wordmark span:nth-child(6) { animation-delay: 0.31s; }
  body.is-ready .wordmark span:nth-child(7) { animation-delay: 0.34s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Facts row ---------- */

.facts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.875rem;
  padding-bottom: 4.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

.facts-row li + li {
  position: relative;
  padding-left: 0.9375rem;
}

.facts-row li + li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 10px;
  background: var(--hairline-strong);
}

/* ---------- Scroll reveal ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }

  .reveal.in-view {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- About ---------- */

.about {
  padding-bottom: 6.75rem;
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--hairline-strong) 50%, transparent) 1;
  padding-top: 4.5rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.pull {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.025em;
  line-height: 1.28;
  color: var(--bone);
  max-width: 36rem;
  margin-bottom: 2.5rem;
}

.about-body {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about-body p {
  font-size: 1rem;
  color: var(--bone-dim);
  line-height: 1.7;
  max-width: 30rem;
}

.about-body p + p {
  margin-top: 1rem;
}

.principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem 1.4rem;
}

.principle {
  display: flex;
  gap: 0.875rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--hairline);
}

.principle .num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--brass);
  padding-top: 0.1875rem;
  flex-shrink: 0;
}

.principle h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.96875rem;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.principle p {
  font-size: 0.9375rem;
  color: var(--bone-dim);
  line-height: 1.6;
}

@media (max-width: 42.5em) {
  .about-body {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }

  .principles {
    grid-template-columns: 1fr;
  }
}

/* ---------- Structure glyph ---------- */
/* Org spider between About and Products: Saorlin holds Vigorix and QAT.
   Reuses the existing .reveal scroll-in system. */

.structure-glyph {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 0 0;
  margin: 0;
  border: 0;
}

.structure-glyph svg,
.structure-svg {
  width: 100%;
  max-width: 42rem;
  height: auto;
}

.structure-caption {
  margin: 1.15rem 0 0;
  max-width: 34rem;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
  opacity: 0;
}

.reveal.in-view .structure-caption {
  opacity: 1;
  transition: opacity 0.5s ease 1.95s;
}

@media (prefers-reduced-motion: no-preference) {
  .structure-glyph.reveal {
    opacity: 1;
    transform: none;
  }
}

.structure-seg {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.structure-root,
.structure-mid {
  opacity: 0;
}

.reveal.in-view .structure-root {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.reveal.in-view .structure-stem {
  transition: stroke-dashoffset 0.42s var(--ease) 0.32s;
  stroke-dashoffset: 0;
}

.reveal.in-view .structure-arm-l,
.reveal.in-view .structure-arm-r {
  transition: stroke-dashoffset 0.46s var(--ease) 0.74s;
  stroke-dashoffset: 0;
}

.reveal.in-view .structure-drop-l,
.reveal.in-view .structure-drop-r {
  transition: stroke-dashoffset 0.38s var(--ease) 1.2s;
  stroke-dashoffset: 0;
}

.reveal.in-view .structure-mid {
  opacity: 1;
  transition: opacity 0.4s ease 1.55s;
}

.structure-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  fill: var(--bone-dim);
}

.structure-role {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .structure-seg { stroke-dashoffset: 0; }
  .structure-root,
  .structure-mid,
  .structure-caption { opacity: 1; }
}

/* ---------- Products ---------- */

.products {
  padding-bottom: 7.5rem;
  padding-top: 4rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1rem;
}

.card {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  text-align: left;
  width: 100%;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--hairline-strong), transparent 60%) border-box;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  background:
    linear-gradient(var(--surface-hover), var(--surface-hover)) padding-box,
    linear-gradient(135deg, rgba(201, 160, 99, 0.55), rgba(201, 160, 99, 0.04) 65%) border-box;
  box-shadow:
    0 20px 44px -20px rgba(201, 160, 99, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.card .product-kicker {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.4rem;
}

.card .product-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.625rem;
}

.card .product-desc {
  font-size: 1rem;
  color: var(--bone-dim);
  line-height: 1.6;
  margin-bottom: 1.75rem;
  flex-grow: 1;
}

.card .visit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--brass-bright);
}

.card .visit-link svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.card:hover .visit-link svg,
.card:focus-visible .visit-link svg {
  transform: translate(2px, -2px);
}

/* Card slated for a future product: same footprint, quietly inert */
.card.card-placeholder {
  border-style: dashed;
  align-items: flex-start;
  justify-content: center;
  min-height: 11rem;
}

.card.card-placeholder .product-desc {
  margin-bottom: 0;
  flex-grow: 0;
}

@media (max-width: 42.5em) {
  .hero {
    padding: 4.75rem 0 2.5rem;
  }

  .facts-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding-bottom: 3.25rem;
  }

  .facts-row li + li {
    padding-left: 0;
  }

  .facts-row li + li::before {
    display: none;
  }
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--hairline-strong) 50%, transparent) 1;
  padding: 2rem 0 2.5rem;
  background: linear-gradient(180deg, transparent, rgba(13, 15, 20, 0.4));
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Reusable lockup — copy this block as-is onto product sites. */
.footer-lockup {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.footer-lockup .mark {
  width: 15px;
  height: 15px;
  opacity: 0.65;
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
}

/* ---------- Threshold overlay ---------- */

.threshold {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 9, 12, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.threshold[data-open='true'] {
  opacity: 1;
  pointer-events: auto;
}

.threshold-panel {
  background: var(--ink-2);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  max-width: 24rem;
  width: 100%;
  padding: 2.25rem 2rem 1.875rem;
  text-align: center;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.35s var(--ease);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
}

.threshold[data-open='true'] .threshold-panel {
  transform: translateY(0) scale(1);
}

.threshold-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 0 16px rgba(201, 160, 99, 0.3));
}

@media (prefers-reduced-motion: no-preference) {
  .threshold[data-open='true'] .threshold-mark .gate-gap {
    animation: unlatch 0.7s var(--ease) 0.15s both;
  }
}

@keyframes unlatch {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-14deg); }
}

.threshold-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.75rem;
}

.threshold h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3125rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.625rem;
}

.threshold p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.625rem;
}

.threshold-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.btn-continue {
  background: var(--brass);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.90625rem;
  padding: 0.75rem 1.25rem;
  border-radius: 9px;
  position: relative;
  overflow: hidden;
  transition: background 0.2s ease;
}

.btn-continue::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-160%) skewX(-15deg);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.btn-continue:hover {
  background: var(--brass-bright);
}

.btn-continue:hover::before {
  transform: translateX(220%) skewX(-15deg);
}

.btn-stay {
  font-size: 0.84375rem;
  color: var(--muted);
  padding: 0.5rem;
  transition: color 0.2s ease;
}

.btn-stay:hover {
  color: var(--bone-dim);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .wordmark span,
  .eyebrow,
  .hero-mark,
  .hero p.motto,
  .hero p,
  .facts-row {
    opacity: 1;
    transform: none;
  }
}
