/* The Fery Group shared styles. Light mode only. */

:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #e8edeb;
  --ink: #101313;
  --muted: #505b56;
  --line: #cbd3cf;
  --strong-line: #7e8c85;
  --accent: #68e365;
  --accent-ink: #09230b;
  --orange: #ff6339;
  --orange-ink: #2c0a02;
  --shadow: 0 24px 80px rgba(16, 19, 19, .11);
  --offset-shadow: color-mix(in srgb, var(--orange) 35%, var(--bg)); /* peach block behind .system-card; the home grid glow reuses it */
  --grid: rgba(16, 19, 19, .07);
  --nav: rgba(243, 246, 245, .90);
  --focus: #0066cc;
  --topbar-text: color-mix(in srgb, var(--bg) 72%, transparent);
  --topbar-line: color-mix(in srgb, var(--bg) 18%, transparent);
  --topbar-focus: #8ec5ff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

/* Home page only: stronger grid lines. Tweak --grid-home here; the CSS fallback and the canvas both use it. */
body.home { --grid-home: rgba(16, 19, 19, .12); --grid: var(--grid-home); }

/* Home page grid effect: JS adds .grid-fx once its canvas is drawing the grid. Without it the body gradient above stays. */
body.grid-fx { background: var(--bg); }
/* Dull the grid behind plain intro text. Only active with the canvas grid. Tweak strength and feather here. */
body.grid-fx, body.grid-fx-hero { --text-halo: 65%; --text-halo-feather: 22px; }
body.grid-fx .hero-copy,
body.grid-fx .section-head > p,
body.grid-fx-hero .hero-copy { position: relative; }
body.grid-fx .hero-copy::before,
body.grid-fx .section-head > p::before,
body.grid-fx-hero .hero-copy::before {
  content: "";
  position: absolute;
  inset: -28px -40px;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) var(--text-halo), transparent);
  filter: blur(var(--text-halo-feather));
  pointer-events: none;
}
.grid-fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
/* Hero-only mode: the canvas is clipped to the hero and paints the page colour so it replaces the CSS grid there. */
body.grid-fx-hero .grid-fx-canvas { background: var(--bg); }

::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.shell { width: min(1200px, calc(100% - 40px)); margin: 0 auto; }
.mono { font-family: "IBM Plex Mono", monospace; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font: 600 12px/1.2 "IBM Plex Mono", monospace;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--accent); }
/* Headline keyword colour */
h2 .kw { color: var(--accent); }
.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;
}

/* Topbar and nav */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--topbar-line);
  background: var(--ink);
  color: var(--bg);
}
.topbar :focus-visible, .package.featured :focus-visible, footer :focus-visible { outline-color: var(--topbar-focus); }
.topbar-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; color: #ffffff; }
.brand-mark { display: block; width: 40px; height: 40px; border: 1px solid color-mix(in srgb, var(--bg) 38%, transparent); transition: border-color .18s ease; }
.brand:hover .brand-mark { border-color: var(--accent); }
.brand-name { color: #ffffff; font: 600 13px/1 "IBM Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--topbar-text);
  font: 500 14px/1.2 "IBM Plex Mono", monospace;
  transition: color .18s ease;
}
.nav-links a:hover { color: #ffffff; }
.nav-cta {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  background: var(--accent);
  color: var(--accent-ink) !important;
  border: 1px solid var(--accent);
  font-weight: 600;
  transition: background .18s ease, border-color .18s ease;
}
.nav-links a.nav-cta:hover { background: #ffffff; border-color: #ffffff; color: var(--accent-ink) !important; }
.nav-more { position: relative; }
.nav-more-label { display: none; }
.nav-more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--topbar-text);
  font: 500 14px/1.2 "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: color .18s ease;
}
.nav-more-toggle:hover, .nav-more-toggle[aria-expanded="true"] { color: #ffffff; }
.nav-more-toggle .nav-caret {
  display: block;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .18s ease, margin .18s ease;
}
.nav-more-toggle[aria-expanded="true"] .nav-caret { margin-top: 3px; transform: rotate(225deg); }
.nav-more-panel { position: absolute; top: 100%; right: -18px; z-index: 30; display: none; padding-top: 16px; }
.nav-more.open .nav-more-panel { display: block; }
.nav-more-list { min-width: 240px; padding: 6px; border: 1px solid var(--strong-line); background: var(--surface); box-shadow: var(--shadow); }
.nav-more-list a { display: block; padding: 12px 14px; color: var(--muted); border: 1px solid transparent; }
.nav-more-list a:hover { background: var(--surface-2); color: var(--ink); }
.nav-more-list a:focus-visible { outline-offset: -3px; outline-color: var(--focus); }
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--bg) 32%, transparent);
  background: transparent;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.menu-toggle:hover { border-color: var(--bg); background: color-mix(in srgb, var(--bg) 10%, transparent); }
.menu-toggle span, .menu-toggle span::before {
  display: block;
  width: 19px;
  height: 2px;
  background: var(--bg);
  content: "";
  transition: transform .2s ease;
}
.menu-toggle span::before { transform: translateY(6px); }
.menu-toggle[aria-expanded="true"] span { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span::before { transform: rotate(-90deg); }

/* Hero */
.hero {
  min-height: min(820px, calc(100vh - 70px));
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, .75fr);
  align-items: center;
  gap: clamp(38px, 7vw, 96px);
  padding: 84px 0 72px;
}
.hero h1 {
  margin: 0;
  max-width: 850px;
  font-size: clamp(48px, 7vw, 94px);
  line-height: .94;
  letter-spacing: -.065em;
  font-weight: 600;
}
.hero-line { display: block; }
.hero-copy {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.5;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* Buttons */
.button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 21px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font: 600 14px/1 "IBM Plex Mono", monospace;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.button:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--strong-line); }
.button.secondary:hover { background: var(--surface); border-color: var(--ink); }
.button.small { min-height: 42px; padding: 0 15px; font-size: 12px; }
.button .arrow { font-size: 18px; line-height: 0; }

/* Cards */
.system-card {
  position: relative;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--strong-line);
  box-shadow: var(--shadow);
}
.system-card::before {
  content: "";
  position: absolute;
  inset: 10px -10px -10px 10px;
  z-index: -1;
  border: 1px solid var(--line);
  background: var(--offset-shadow);
}
.package-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.package {
  grid-column: span 4;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.package.featured { grid-column: span 8; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.package.featured .package-meta, .package.featured p, .package.featured .package-owner { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.package.featured .package-tag { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.package-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.package-tag {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 500 10px/1 "IBM Plex Mono", monospace;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.package-owner { color: var(--muted); font: 500 11px/1.4 "IBM Plex Mono", monospace; }
.package h3 { margin: 44px 0 12px; font-size: 29px; line-height: 1.08; letter-spacing: -.035em; }
.package p { margin: 0; color: var(--muted); line-height: 1.5; }
.package-bottom { margin-top: auto; padding-top: 30px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.package-meta { color: var(--muted); font: 500 11px/1.5 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .05em; }
/* Priced cards: a headline figure with the mono label beside it, or under it when the row runs out of room.
   "Scope this" sits on the label's baseline; flex-end is the fallback where last baseline is unsupported. */
.package-bottom.priced { align-items: flex-end; align-items: last baseline; }
.package-price { min-width: 0; }
.package-price-visual { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 4px; }
.package-figure { color: currentColor; font: 700 30px/1 "DM Sans", sans-serif; letter-spacing: -.035em; }
.scope-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  font: 600 12px/1.2 "IBM Plex Mono", monospace;
  cursor: pointer;
  white-space: nowrap;
}
.proof-card { padding: 30px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.proof-card .count { font-size: clamp(46px, 6vw, 72px); line-height: 1; font-weight: 600; letter-spacing: -.065em; }
.proof-card h3 { margin: 20px 0 8px; font-size: 24px; letter-spacing: -.035em; }
.proof-card p { margin: 0; color: var(--muted); }
.proof-card .mono { margin-top: 25px; color: var(--muted); font-size: 11px; }

/* Sections and section headers */
section { scroll-margin-top: 88px; }
.section { padding: clamp(88px, 11vw, 150px) 0; border-bottom: 1px solid var(--line); }
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 480px);
  gap: 48px;
  align-items: end;
  margin-bottom: 54px;
}
.section-head h2 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(39px, 5vw, 68px);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 600;
}
.section-head p { margin: 0; color: var(--muted); font-size: 18px; }

/* Footer */
footer { background: var(--ink); color: var(--bg); }
.footer-inner { min-height: 240px; padding: 58px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
.footer-statement { max-width: 570px; font-size: clamp(27px, 4vw, 46px); line-height: 1.05; letter-spacing: -.045em; font-weight: 600; }
.footer-meta { text-align: right; color: color-mix(in srgb, var(--bg) 65%, transparent); font: 400 11px/1.7 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .07em; }
.footer-meta a { border-bottom: 1px solid currentColor; }
.footer-meta a:hover { color: var(--accent); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  padding: 22px 0 30px;
  border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent);
}
.footer-links a { color: color-mix(in srgb, var(--bg) 65%, transparent); font: 500 12px/1.2 "IBM Plex Mono", monospace; letter-spacing: .07em; text-transform: uppercase; transition: color .18s ease; }
.footer-links a:hover { color: var(--accent); }

/* Scroll reveal (only hidden when JS is running) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 66px; }
  .system-card { max-width: 620px; }
  .section-head { grid-template-columns: 1fr; gap: 24px; }
  .package { grid-column: span 6; }
  .package.featured { grid-column: span 12; }
}

/* Collapse the nav into the mobile menu before it can run out of room */
@media (max-width: 900px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding: 12px 20px 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--topbar-line);
    background: var(--ink);
  }
  .nav-links.open { display: flex; }
  .nav-links a { min-height: 48px; display: flex; align-items: center; border-bottom: 1px solid var(--topbar-line); }
  .nav-links a:last-child { border-bottom: 0; margin-top: 10px; justify-content: center; }
  .menu-toggle { display: inline-flex; }
  .nav-links { max-height: calc(100vh - 71px); overflow-y: auto; }
  .nav-more { display: block; }
  .nav-more-toggle { display: none; }
  .nav-more-label { display: block; padding: 18px 0 8px; border-bottom: 1px solid var(--topbar-line); color: #ffffff; font: 600 11px/1.2 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
  .nav-more-panel { position: static; display: block; padding: 0; }
  .nav-more-list { min-width: 0; padding: 0; border: 0; background: none; box-shadow: none; }
  .nav-more-list a { min-height: 48px; padding: 0; display: flex; align-items: center; border: 0; border-bottom: 1px solid var(--topbar-line); color: var(--topbar-text); }
  .nav-more-list a:hover { background: none; color: #ffffff; }
  .nav-more-list a:focus-visible { outline-color: var(--topbar-focus); }
  .nav-more-list a:last-child { margin-top: 0; justify-content: flex-start; border-bottom: 1px solid var(--topbar-line); }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 26px, 1200px); }
  .topbar-inner { min-height: 62px; }
  .nav-links { padding: 12px 13px 18px; }
  .hero { padding: 56px 0 64px; gap: 48px; }
  .hero h1 { font-size: clamp(45px, 15vw, 68px); letter-spacing: -.06em; }
  .hero-copy { font-size: 18px; }
  .hero-actions .button { width: 100%; }
  .system-card::before { display: none; }
  .section { padding: 82px 0; }
  .section-head { margin-bottom: 38px; }
  .package { grid-column: span 12; min-height: 305px; }
  .package.featured { min-height: 360px; }
  .package h3 { margin-top: 34px; }
  .proof-card { min-height: 270px; }
  .footer-inner { min-height: 300px; align-items: flex-start; flex-direction: column; justify-content: space-between; }
  .footer-meta { text-align: left; }
}

@media (max-width: 340px) {
  .brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
