/* ==========================================================================
   Fluxis Studio — base.css
   Design tokens, reset, typography, buttons, utilities
   Direction: warm bone paper, ink rules, hard offset shadows, serif display
   ========================================================================== */

:root {
  /* Tie native UI (scrollbars, form controls, autofill) to the site theme
     rather than the OS, so a visitor on a dark OS still gets light scrollbars
     on the light site. */
  color-scheme: light;

  /* Surfaces */
  --paper:      #FBF7F0;
  --paper-2:    #F3ECE0;
  --paper-3:    #EAE0CF;
  --card:       #FFFDF9;

  /* Ink */
  --ink:        #14110E;
  --ink-2:      #4B443B;
  --ink-3:      #6B6358; /* darkened to clear 4.5:1 on --paper for small labels */

  /* Accents */
  --vermilion:  #E8452A;
  --vermilion-d:#C3351D;
  --forest:     #16513F;
  --amber:      #F0B429;
  --sky:        #2F6DB5;

  /* Inverted panels (footer, dark cards, featured package).
     These stay dark in BOTH themes so those blocks never flip to a glaring
     light slab in dark mode. Anything on an inverted panel reads from these. */
  --inv-bg:     #14110E;
  --inv-bg-2:   #211B15;
  --inv-fg:     #FBF7F0;
  --inv-fg-2:   rgba(251, 247, 240, 0.76);
  --inv-fg-3:   rgba(251, 247, 240, 0.58);
  --inv-line:   rgba(251, 247, 240, 0.22);

  /* Readable foreground for the saturated accents. */
  --on-verm:    #FFF6F2;
  --on-forest:  #F2FBF7;
  --on-amber:   #14110E;

  /* Solid vermilion fills that carry small text need to be a shade deeper than
     the display accent, otherwise near-white label text lands around 3.7:1. */
  --verm-solid: #CE3A1E;

  /* Lines + shadow */
  --line:       #14110E;
  --line-soft:  rgba(20, 17, 14, 0.16);
  --shadow:     5px 5px 0 var(--ink);
  --shadow-lg:  9px 9px 0 var(--ink);
  --shadow-sm:  3px 3px 0 var(--ink);

  /* Type */
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing + rhythm */
  --shell: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-y: clamp(4.5rem, 9vw, 8.5rem);
  --radius: 6px;
  --radius-lg: 20px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.5s;

  --header-h: 76px;
}

/* ------------------------------ Dark theme ------------------------------ */
/* Neutral charcoal, not warm. The light theme gets its character from warm
   paper; in dark mode that same warmth reads as brown, so the surfaces here are
   near-neutral greys and the colour comes from the accents instead. */
[data-theme="dark"] {
  color-scheme: dark;

  --paper:      #0D0D0F;
  --paper-2:    #151518;
  --paper-3:    #1F1F23;
  --card:       #131316;

  --ink:        #F3F3F5;
  --ink-2:      #B6B6BC;
  --ink-3:      #8B8B93;

  --vermilion:  #FF6A46;
  --vermilion-d:#FF8663;
  --forest:     #57C39C;
  --amber:      #FFC94D;
  --sky:        #6FA8E8;

  /* Panels lift slightly off the page instead of inverting to cream. */
  --inv-bg:     #17171B;
  --inv-bg-2:   #212126;
  --inv-fg:     #F3F3F5;
  --inv-fg-2:   rgba(243, 243, 245, 0.74);
  --inv-fg-3:   rgba(243, 243, 245, 0.56);
  --inv-line:   rgba(243, 243, 245, 0.18);

  /* The accents are lighter in dark mode, so they need dark text on top and the
     display accent is already high-contrast enough to use for solid fills. */
  --on-verm:    #2E0D04;
  --on-forest:  #06231A;
  --on-amber:   #1A1204;
  --verm-solid: var(--vermilion);

  --line:       #F3F3F5;
  --line-soft:  rgba(243, 243, 245, 0.2);
  --shadow:     5px 5px 0 var(--ink);
  --shadow-lg:  9px 9px 0 var(--ink);
  --shadow-sm:  3px 3px 0 var(--ink);
}

/* ------------------------------ Reset ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

body.is-locked { overflow: hidden; }

img, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul, ol { padding: 0; list-style: none; }

hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--vermilion);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--amber);
  color: var(--on-amber);
}

/* ------------------------------ Typography ------------------------------ */
h1, h2, h3, h4, h5 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-variation-settings: "SOFT" 0, "WONK" 1;
  text-wrap: balance;
}

.display-1 {
  font-family: var(--display);
  font-size: clamp(2.9rem, 8.4vw, 6.75rem);
  font-weight: 600;
  line-height: 0.94;
  letter-spacing: -0.035em;
}

.display-2 {
  font-family: var(--display);
  font-size: clamp(2.3rem, 5.6vw, 4.25rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.display-3 {
  font-family: var(--display);
  font-size: clamp(1.75rem, 3.4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.display-4 {
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.1vw, 1.65rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
}

/* Italic "wonk" flourish for emphasised words inside headings */
.ital {
  font-style: italic;
  font-variation-settings: "SOFT" 40, "WONK" 1;
  color: var(--verm-solid);
}

.underline-swash {
  position: relative;
  white-space: nowrap;
}
.underline-swash::after {
  content: "";
  position: absolute;
  left: -1%;
  right: -1%;
  bottom: 0.03em;
  height: 0.28em;
  background: var(--amber);
  z-index: -1;
  transform: skewX(-12deg);
}

.lead {
  font-size: clamp(1.06rem, 1.55vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 62ch;
  text-wrap: pretty;
}

.prose-muted { color: var(--ink-2); text-wrap: pretty; }

/* Small uppercase label used throughout */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--vermilion);
  flex: none;
}

.eyebrow--plain::before { display: none; }

.num {
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ------------------------------ Buttons -------------------------------- */
.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.95em 1.6em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.925rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease),
              background-color 0.22s var(--ease), color 0.22s var(--ease);
}

.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

.btn--primary { --btn-bg: var(--verm-solid); --btn-fg: var(--on-verm); }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); }
.btn--ghost:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); }

.btn--paper { --btn-bg: var(--card); --btn-fg: var(--ink); }

.btn--amber { --btn-bg: var(--amber); --btn-fg: var(--on-amber); }

.btn--sm { padding: 0.7em 1.15em; font-size: 0.82rem; }
.btn--lg { padding: 1.1em 2em; font-size: 1rem; }
.btn--block { width: 100%; }

.btn__arrow {
  display: inline-block;
  transition: transform 0.28s var(--ease);
}
.btn:hover .btn__arrow { transform: translateX(4px); }

/* Text link with animated rule */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 700;
  font-size: 0.925rem;
  padding-bottom: 3px;
  background-image: linear-gradient(var(--vermilion), var(--vermilion));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease), color 0.25s var(--ease);
}
.tlink:hover { background-size: 100% 2px; color: var(--verm-solid); }
.tlink svg, .tlink .btn__arrow { transition: transform 0.28s var(--ease); }
.tlink:hover .btn__arrow { transform: translateX(4px); }

/* ------------------------------ Badges --------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.42em 0.85em;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--live { background: var(--card); }

.dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--forest) 70%, transparent);
  animation: pulse 2.4s var(--ease) infinite;
  flex: none;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--forest) 60%, transparent); }
  70%  { box-shadow: 0 0 0 9px color-mix(in srgb, var(--forest) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--forest) 0%, transparent); }
}

.tag {
  display: inline-block;
  padding: 0.3em 0.7em;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ------------------------------ Utilities ------------------------------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--wide { max-width: 1480px; }
.shell--narrow { max-width: 820px; }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.section--paper2 { background: var(--paper-2); }

.section--ink { background: var(--inv-bg); color: var(--inv-fg); }
.section--ink h1, .section--ink h2, .section--ink h3 { color: var(--inv-fg); }
.section--ink .eyebrow { color: var(--inv-fg-3); }
.section--ink .lead,
.section--ink .prose-muted,
.section--ink li,
.section--ink p { color: var(--inv-fg-2); }
.section--ink .btn--ghost { --btn-fg: var(--inv-fg); border-color: var(--inv-fg); }
.section--ink .btn--ghost:hover { --btn-bg: var(--inv-fg); --btn-fg: var(--inv-bg); }

.rule-top { border-top: 2px solid var(--line); }
.rule-bottom { border-bottom: 2px solid var(--line); }

.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: 0.5rem; }
.stack-lg { display: grid; gap: 2rem; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.center { text-align: center; }
.center .lead, .center .eyebrow { margin-inline: auto; }

.mw-50 { max-width: 50ch; }
.mw-60 { max-width: 60ch; }
.mw-70 { max-width: 70ch; }

.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;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 200;
  padding: 0.8em 1.4em;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--amber);
  color: var(--on-amber);
  font-weight: 700;
  transition: transform 0.25s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* Section heading cluster */
.sec-head {
  display: grid;
  gap: 1.1rem;
  align-items: end;
  margin-bottom: clamp(2.25rem, 4vw, 3.5rem);
}

@media (min-width: 900px) {
  .sec-head--split {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 2.5rem;
  }
  .sec-head--split .sec-head__aside { justify-self: end; text-align: left; }
}

/* Grain overlay for tactile paper feel */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: 0.07; }

/* Scroll progress rail */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--vermilion), var(--amber));
  z-index: 120;
}

/* Reveal-on-scroll.
   Scoped to .js (set by the inline head script) so that if JavaScript never
   runs, content stays visible instead of being stuck at opacity 0. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* Escape hatch: forces content visible with no transition at all. */
.reveal-off [data-reveal] {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
}

/* Cursor follower (desktop only) */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid var(--vermilion);
  border-radius: 50%;
  pointer-events: none;
  z-index: 130;
  opacity: 0;
  transition: opacity 0.3s var(--ease), width 0.25s var(--ease),
              height 0.25s var(--ease), margin 0.25s var(--ease),
              background-color 0.25s var(--ease);
}
.cursor-dot.is-on { opacity: 1; }
.cursor-dot.is-hot {
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  background: color-mix(in srgb, var(--vermilion) 18%, transparent);
}

@media (hover: none), (pointer: coarse) {
  .cursor-dot { display: none; }
}
