/* MeldCNC website — shared styles. Brand tokens mirror the app (src/styles.scss). */

/* ——— Fonts (self-hosted: no third-party requests) ——— */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('fonts/space-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('fonts/space-grotesk-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/ibm-plex-sans-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 500; src: url('fonts/ibm-plex-sans-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-display: swap; font-weight: 600; src: url('fonts/ibm-plex-sans-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* ——— Tokens ——— */
:root {
  color-scheme: light dark;

  --bg: #efede8;
  --bg-grid: rgb(23 25 28 / 0.05);
  --surface: #fbfaf7;
  --surface-2: #f3f1ec;
  --surface-3: #e8e5de;
  --line: #dcd8cf;
  --line-strong: #c7c2b7;
  --text: #16181b;
  --text-2: #3b4047;
  --muted: #646a73;
  --accent: #d9530b;
  --accent-2: #f06a1d;
  --accent-soft: rgb(217 83 11 / 0.1);
  --accent-ink: #ffffff;
  --ok: #1f9d63;
  --info: #2f6fcf;
  --steel: #c9cfd6;

  /* the machine panel is dark in both themes, like the app's editor chrome */
  --panel: #17191c;
  --panel-2: #1f2226;
  --panel-line: #2f3338;
  --panel-text: #eef0f2;
  --panel-muted: #939ca7;
  --panel-accent: #ff7a2e;

  --shadow-1: 0 1px 0 rgb(255 255 255 / 0.7) inset, 0 1px 2px rgb(24 20 12 / 0.06), 0 6px 20px -8px rgb(24 20 12 / 0.12);
  --shadow-2: 0 24px 60px -24px rgb(24 20 12 / 0.35), 0 2px 8px rgb(24 20 12 / 0.08);
  --ring: 0 0 0 3px rgb(217 83 11 / 0.3);

  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --r: 12px;
  --r-lg: 20px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);

  accent-color: var(--accent);
  scrollbar-color: var(--line-strong) transparent;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    color-scheme: dark;
    --bg: #0d0f11;
    --bg-grid: rgb(255 255 255 / 0.035);
    --surface: #15181b;
    --surface-2: #1b1f23;
    --surface-3: #23282d;
    --line: #262b31;
    --line-strong: #363c44;
    --text: #eceef0;
    --text-2: #c3c8ce;
    --muted: #8f98a2;
    --accent: #ff7a2e;
    --accent-2: #ff9a57;
    --accent-soft: rgb(255 122 46 / 0.13);
    --accent-ink: #1b0b00;
    --ok: #3ccf8e;
    --info: #6aaeff;
    --panel: #101315;
    --panel-2: #171b1e;
    --panel-line: #262c31;
    --shadow-1: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 30px 70px -24px rgb(0 0 0 / 0.8), 0 2px 8px rgb(0 0 0 / 0.4);
    --ring: 0 0 0 3px rgb(255 122 46 / 0.35);
  }
}
:root.dark {
  color-scheme: dark;
  --bg: #0d0f11;
  --bg-grid: rgb(255 255 255 / 0.035);
  --surface: #15181b;
  --surface-2: #1b1f23;
  --surface-3: #23282d;
  --line: #262b31;
  --line-strong: #363c44;
  --text: #eceef0;
  --text-2: #c3c8ce;
  --muted: #8f98a2;
  --accent: #ff7a2e;
  --accent-2: #ff9a57;
  --accent-soft: rgb(255 122 46 / 0.13);
  --accent-ink: #1b0b00;
  --ok: #3ccf8e;
  --info: #6aaeff;
  --panel: #101315;
  --panel-2: #171b1e;
  --panel-line: #262c31;
  --shadow-1: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 30px 70px -24px rgb(0 0 0 / 0.8), 0 2px 8px rgb(0 0 0 / 0.4);
  --ring: 0 0 0 3px rgb(255 122 46 / 0.35);
}
:root.light {
  color-scheme: light;
}

/* ——— Base ——— */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}
body {
  margin: 0;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg,
canvas {
  max-width: 100%;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-wrap: balance;
}
p {
  margin: 0;
  text-wrap: pretty;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
::selection {
  background: var(--accent);
  color: var(--accent-ink);
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.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 {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: 500 15px/1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s,
    box-shadow 0.15s;
}
.btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px -10px var(--accent);
}
.btn.primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--surface-2);
}
.btn.sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 10px;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ——— Header ——— */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  container-type: scroll-state;
  container-name: site-head;
}
.head-bar {
  border-bottom: 1px solid transparent;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
@container site-head scroll-state(stuck: top) {
  .head-bar {
    border-bottom-color: var(--line);
    box-shadow: 0 8px 24px -18px rgb(0 0 0 / 0.35);
  }
}
.head-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 68px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: none;
}
.brand svg {
  width: 32px;
  height: 32px;
}
.brand strong {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand strong span {
  color: var(--accent);
}
.logo-bg {
  fill: var(--text);
}
.logo-steel {
  fill: var(--steel);
}
.logo-bit {
  fill: var(--accent);
}
.logo-flute {
  stroke: var(--text);
}
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 16px;
  scroll-target-group: auto;
}
.nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  transition:
    color 0.15s,
    background 0.15s;
}
.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav a:is(:target-current, .is-current) {
  color: var(--text);
}
.nav a:is(:target-current, .is-current)::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
.theme-toggle .moon {
  display: none;
}
:root.dark .theme-toggle .sun {
  display: none;
}
:root.dark .theme-toggle .moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) .theme-toggle .sun {
    display: none;
  }
  :root:not(.light) .theme-toggle .moon {
    display: block;
  }
}

/* mobile menu */
.menu {
  display: none;
  position: relative;
}
.menu > summary {
  list-style: none;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(280px, calc(100vw - 32px));
  padding: 8px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
}
.menu-panel a {
  padding: 11px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}
.menu-panel a:hover {
  background: var(--surface-2);
}
@media (max-width: 960px) {
  .nav {
    display: none;
  }
  .menu {
    display: block;
  }
}
@media (max-width: 480px) {
  .head-actions .btn.hide-xs {
    display: none;
  }
}

/* ——— Sections ——— */
.section {
  padding-block: clamp(64px, 9vw, 112px);
}
.section-head {
  display: grid;
  gap: 14px;
  max-width: 720px;
  margin-bottom: clamp(32px, 5vw, 52px);
}
.section-head.center {
  margin-inline: auto;
  text-align: center;
  justify-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.section-head h2 {
  font-size: clamp(32px, 4.6vw, 52px);
}
.lede {
  font-size: clamp(17px, 1.6vw, 19px);
  color: var(--text-2);
  max-width: 62ch;
}

/* ruler divider: 10 mm ticks, a detail from the machine's world */
.ruler {
  height: 18px;
  border-top: 1px solid var(--line);
  background:
    repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px 48px) top / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 9.6px) top / 100% 5px no-repeat;
}

/* ——— Scroll reveal (progressive enhancement) ——— */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes rise {
      from {
        opacity: 0.25;
        translate: 0 28px;
      }
    }
    .reveal {
      animation: rise auto linear backwards;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ——— Footer ——— */
.site-foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: 48px 36px;
  font-size: 14px;
  color: var(--muted);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}
.foot-grid h3 {
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 14px;
}
.foot-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.foot-grid a {
  text-decoration: none;
}
.foot-grid a:hover {
  color: var(--text);
  text-decoration: underline;
}
.foot-brand p {
  margin-top: 12px;
  max-width: 34ch;
}
.foot-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
@media (max-width: 760px) {
  .foot-grid {
    grid-template-columns: 1fr 1fr;
  }
  .foot-brand {
    grid-column: 1 / -1;
  }
}

/* ——— Legal pages ——— */
.legal {
  padding-block: 48px 96px;
}
.legal-card {
  max-width: 800px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 56px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.legal-card h1 {
  font-size: clamp(32px, 5vw, 46px);
  margin-block: 10px 8px;
}
.legal-card .meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
}
.legal-card h2 {
  font-size: 22px;
  margin-block: 36px 12px;
  scroll-margin-top: 96px;
}
.legal-card h3 {
  font-size: 17px;
  margin-block: 22px 8px;
}
.legal-card p,
.legal-card li {
  color: var(--text-2);
  max-width: 68ch;
}
.legal-card p + p {
  margin-top: 12px;
}
.legal-card ul {
  padding-left: 20px;
  display: grid;
  gap: 6px;
}
.legal-card address {
  font-style: normal;
  padding: 16px 18px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.7;
}
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0 0 8px;
  list-style: none;
}
.toc a {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  font-size: 13px;
  text-decoration: none;
  color: var(--text-2);
}
.toc a:hover {
  border-color: var(--accent);
  color: var(--text);
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-top: 12px;
}
.legal-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}
.legal-card th,
.legal-card td {
  text-align: left;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  color: var(--text-2);
}
.legal-card thead th {
  border-top: 0;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover {
  color: var(--text);
}
