/* ==========================================================================
   Z-Deck Design System
   Deep-sea ground, light ink, teal accent — the MarOps pilot page palette, dark rendition.
   ========================================================================== */

:root {
  /* Surfaces: the MarOps pilot page in its dark rendition — deep sea, not black */
  --bg:            #0f1a20;
  --bg-raised:     #16242c;
  --surface:       #16242c;
  --surface-hover: #1c2d36;

  /* Lines */
  --line:          #26363e;
  --line-strong:   #35484f;

  /* Text */
  --text:          #e7ecee;
  --text-dim:      #9aaab2;
  --text-faint:    #7a8a93;

  /* Single accent: deep-water teal, lifted for a dark ground */
  --accent:        #52b6c6;
  --accent-soft:   #163037;
  --accent-line:   rgba(82, 182, 198, 0.4);
  --on-accent:     #0f1a20;
  --ok:            #6fcf97;
  --warn:          #e2b04a;
  --err:           #f28b82;

  /* Type */
  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Sans 3', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  /* Rhythm */
  --section-y:   clamp(5rem, 10vw, 9rem);
  --gutter:      clamp(1.25rem, 4vw, 3rem);
  --max:         1180px;
  --max-narrow:  760px;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Nautical chart grid — texture without a single image file */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
  opacity: 0.75;
}

main, header, footer { position: relative; z-index: 1; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- Typography ------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.3rem, 1.4rem + 3.9vw, 4rem); font-weight: 700; max-width: 15ch; }
h2 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3rem); }
h3 { font-size: clamp(1.15rem, 1rem + 0.7vw, 1.45rem); }

p { text-wrap: pretty; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 1rem;
}

.lede {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  color: var(--text-dim);
  max-width: 58ch;
}

.accent { color: var(--accent); }

/* ---------- Layout ----------------------------------------------------- */

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

section { padding-block: calc(var(--section-y) * 0.5); }
section:last-of-type { padding-bottom: var(--section-y); }

.section-head { max-width: var(--max-narrow); margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head p { color: var(--text-dim); margin-top: 1rem; }

.rule {
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
  border: 0;
}

/* ---------- Buttons ---------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.8rem 1.4rem;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease),
              transform 0.25s var(--ease), color 0.25s var(--ease);
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--primary:hover { background: #6fc6d4; transform: translateY(-2px); }

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: transparent;
}
.btn--ghost:hover { border-color: var(--accent-line); background: var(--accent-soft); transform: translateY(-2px); }

.btn--sm { padding: 0.5rem 0.95rem; font-size: 0.85rem; }

/* ---------- Navigation ------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--line); }

.nav__inner {
  max-width: var(--max);
  margin-inline: auto;
  padding: 0.9rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand { display: flex; align-items: center; gap: 0.65rem; flex-shrink: 0; }

.brand__mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), #2f8fa0);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}
.brand__name span { color: var(--text-faint); font-weight: 400; }

.nav__links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  margin-left: auto;
  font-size: 0.92rem;
}
.nav__links a { color: var(--text-dim); transition: color 0.2s var(--ease); }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); }

.nav__end { display: flex; align-items: center; gap: 0.75rem; margin-left: 0.5rem; }

.lang {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.lang button {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.lang button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.nav__toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .nav__links {
    position: fixed;
    inset: 62px 0 auto;
    flex-direction: column;
    gap: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1.25rem;
    margin: 0;
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links li { border-top: 1px solid var(--line); }
  .nav__links a { display: block; padding: 0.9rem 0; font-size: 1rem; }
  .nav__toggle { display: block; margin-left: auto; order: 3; }
  .nav__end { order: 2; margin-left: auto; }
  .nav__end .btn { display: none; }
}

/* Desktop: the navigation is a fixed sidebar on the left. */
@media (min-width: 901px) {
  :root { --sidebar: 236px; }
  body { padding-left: var(--sidebar); }
  .nav {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar);
    border-bottom: 0;
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .nav.is-stuck { border-bottom-color: transparent; }
  .nav__inner {
    max-width: none;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 1.75rem;
    padding: 1.25rem 1rem 1.25rem;
  }
  .nav__links {
    flex-direction: column;
    gap: 0.15rem;
    margin-left: 0;
    font-size: 0.95rem;
  }
  .nav__links a {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: var(--r-sm);
  }
  .nav__links a:hover { background: var(--bg-raised); }
  .nav__links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .nav__end {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-left: 0;
    margin-top: auto;
  }
  .nav__end .lang { justify-content: center; }
  .nav__end .lang button { flex: 1; }
}

/* ---------- Hero ------------------------------------------------------- */

.hero { padding-block: clamp(3rem, 6vw, 5.5rem) clamp(2.5rem, 5vw, 4rem); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

@media (max-width: 940px) {
  .hero__grid { grid-template-columns: 1fr; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  margin-bottom: 1.75rem;
}

.status__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2.6s infinite;
}

/* On narrow screens the status text wraps; a pill radius on two lines looks broken. */
@media (max-width: 600px) {
  .status {
    border-radius: var(--r-sm);
    font-size: 0.68rem;
    line-height: 1.5;
    padding: 0.5rem 0.8rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
  }
  .status__dot { margin-top: 0.4rem; flex-shrink: 0; }
}

@keyframes pulse {
  70%  { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero h1 { margin-bottom: 1.5rem; }
.hero .lede { margin-bottom: 2.25rem; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 2.5rem; }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.hero__meta span { display: inline-flex; align-items: center; gap: 0.45rem; }
.hero__meta span::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

/* Instrument panel — the "bridge console" */
.panel {
  background: linear-gradient(180deg, var(--surface), var(--bg-raised));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.panel__bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.015);
}

.panel__body { padding: 1.25rem; display: grid; gap: 1rem; }

.readout {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
  background: var(--bg-raised);
}
.readout__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: block;
  margin-bottom: 0.4rem;
}
.readout strong { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; display: block; }
.readout small { color: var(--text-dim); font-size: 0.85rem; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.65rem; }

.stat {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.9rem 0.75rem;
  text-align: center;
  background: var(--bg-raised);
}
.stat b {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.75rem);
  font-weight: 700;
  display: block;
  line-height: 1.1;
}
.stat span {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

/* ---------- Cards ------------------------------------------------------ */

.grid { display: grid; gap: 1.1rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 2.5vw, 1.9rem);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), background 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.card:hover { border-color: var(--accent-line); transform: translateY(-3px); background: var(--surface-hover); }
.card p { color: var(--text-dim); font-size: 0.95rem; }

.card__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.12em;
}

.card__foot { margin-top: auto; padding-top: 0.5rem; }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.22rem 0.5rem;
}

.link-arrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap 0.25s var(--ease);
}
.link-arrow:hover { gap: 0.7rem; }

.badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
}
.badge--live { color: var(--ok); border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.08); }
.badge--code { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- Showcase with real screenshots ----------------------------- */

.shot {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-raised);
}
.shot__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.shot__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.shot__url {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-left: 0.5rem;
}
.shot img { width: 100%; display: block; }

.feature {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: center;
}
.feature--flip > :first-child { order: 2; }
@media (max-width: 880px) {
  .feature, .feature--flip > :first-child { grid-template-columns: 1fr; order: 0; }
}

/* ---------- Split / founder -------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}

.timeline { list-style: none; display: grid; gap: 1.5rem; }
.timeline li {
  padding-left: 1.5rem;
  border-left: 1px solid var(--line);
  position: relative;
}
.timeline li::before {
  content: '';
  position: absolute;
  left: -4.5px; top: 0.5rem;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.timeline p { color: var(--text-dim); font-size: 0.93rem; }
.timeline .when {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.35rem;
}

/* ---------- Forms ------------------------------------------------------ */

.form { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.75rem 0.9rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent-line);
  outline: none;
}
.field textarea { min-height: 120px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.form__msg {
  font-size: 0.9rem;
  min-height: 1.4em;
  color: var(--text-dim);
}
.form__msg[data-state="ok"]  { color: var(--ok); }
.form__msg[data-state="err"] { color: var(--err); }

/* ---------- Footer ----------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 5vw, 4rem) 2rem;
}
.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(140px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.footer h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
  font-weight: 500;
}
.footer ul { list-style: none; display: grid; gap: 0.55rem; }
.footer a { color: var(--text-dim); font-size: 0.92rem; transition: color 0.2s; }
.footer a:hover { color: var(--accent); }
.footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* ---------- Reveal (fail-open: visible unless JS opts in) -------------- */

.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js-reveal [data-reveal].is-in { opacity: 1; transform: none; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.7rem 1.1rem;
  z-index: 100;
  font-weight: 600;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

[hidden] { display: none !important; }

/* ---------- Pricing tiers ---------------------------------------------- */

.tier {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 3vw, 2.1rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.tier:hover { border-color: var(--accent-line); transform: translateY(-3px); }

.tier--featured { border-color: var(--accent-line); background: var(--surface-hover); }

.tier__flag {
  position: absolute;
  top: -1px; right: 1.5rem;
  transform: translateY(-50%);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.tier__price {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.6rem + 1.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.tier__unit {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}

.tier ul { list-style: none; display: grid; gap: 0.6rem; margin-top: 0.25rem; }
.tier li {
  display: flex;
  gap: 0.6rem;
  font-size: 0.93rem;
  color: var(--text-dim);
}
.tier li::before { content: '+'; color: var(--accent); font-weight: 600; flex-shrink: 0; }

.tier .btn { margin-top: auto; justify-content: center; }

/* ---------- Prose (case studies, long-form) ---------------------------- */

.prose { max-width: 68ch; }
.prose p { color: var(--text-dim); margin-bottom: 1.2rem; }
.prose h3 { margin: 2rem 0 0.75rem; }
.prose ul { margin: 0 0 1.2rem 1.1rem; color: var(--text-dim); }
.prose li { margin-bottom: 0.5rem; }
.prose strong { color: var(--text); }

.notice {
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--warn);
  border-radius: var(--r-sm);
  padding: 1rem 1.2rem;
  background: rgba(251, 191, 36, 0.05);
  font-size: 0.92rem;
  color: var(--text-dim);
}

/* ---------- Tool pages ------------------------------------------------- */

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
}
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

.field-note {
  font-size: 0.82rem;
  min-height: 1.2em;
  color: var(--text-faint);
}
.field-note[data-state="ok"]  { color: var(--ok); }
.field-note[data-state="err"] { color: var(--err); }

/* The rendered document: monospace, on paper, so it reads as the real thing. */
.doc {
  background: #f7f6f3;
  color: #14161a;
  border-radius: var(--r);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow-x: auto;
  min-height: 30rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.doc-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.privacy-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--r-sm);
  padding: 0.85rem 1rem;
  background: rgba(52, 211, 153, 0.05);
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

@media print {
  body::before, .nav, .footer, .tool-panel, .doc-bar, .no-print,
  .section-head, .hero__actions, .privacy-note, .skip-link { display: none !important; }
  body { background: #fff; color: #000; padding-left: 0; }
  section { padding: 0 !important; }
  .tool-grid { display: block; }
  .doc {
    background: #fff;
    color: #000;
    box-shadow: none;
    padding: 0;
    font-size: 11pt;
    min-height: 0;
  }
  @page { margin: 20mm; }
}

/* ---------- Upload tools ------------------------------------------------ */

.drop {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: clamp(2rem, 5vw, 3.25rem) 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-raised);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.drop:hover, .drop:focus-visible { border-color: var(--accent-line); background: var(--surface); }
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }

.drop__icon { font-size: 1.75rem; display: block; margin-bottom: 0.75rem; }
.drop__title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}
.drop__hint {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-top: 0.6rem;
}

.file-list { list-style: none; display: grid; gap: 0.4rem; margin-top: 1.25rem; }

.file-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.file-row__order {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 4px;
  min-width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.file-row__name {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row__size { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-faint); }
.file-row__remove {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
  border-radius: 4px;
  transition: color 0.2s;
}
.file-row__remove:hover { color: var(--err); }

.result-box {
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  background: var(--accent-soft);
  margin-top: 1.5rem;
}
.result-box h3 { margin-bottom: 0.3rem; }
.result-box p { color: var(--text-dim); font-size: 0.92rem; }

/* ---------- Charts ------------------------------------------------------ */

.chart-figure {
  margin: 0 0 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem);
}
.chart-figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
/* Below ~560px a 720-unit chart scales its 11px labels down to about 5px.
   Rather than let it become unreadable, the chart keeps a legible minimum width
   and scrolls inside its own card — the page body still never scrolls sideways. */
.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.chart { width: 100%; min-width: 520px; height: auto; display: block; }
.chart circle, .chart rect { transition: opacity 0.15s var(--ease); }
.chart:hover circle, .chart:hover rect { opacity: 0.85; }
.chart circle:hover, .chart rect:hover { opacity: 1; }

.control-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ---------- Account (tools sign-in) ------------------------------------ */
.account-card {
  max-width: 34rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-raised);
}
.account-card h3 { margin-bottom: 0.5rem; }
.account-card__lede { color: var(--text-dim); margin-bottom: 1rem; font-size: 0.95rem; }
.account-card__fine { color: var(--text-faint); font-size: 0.82rem; line-height: 1.5; }
.account-card__fine strong { color: var(--text-dim); }
.account-form__row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.account-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.account-bar strong { color: var(--text); }
.account-bar__log { font-family: var(--font-mono); font-size: 0.78rem; }
