/* ==========================================================================
   Spellyr — design tokens
   ========================================================================== */
:root {
  --bg: #FBFBF8;
  --surface: #FFFFFF;
  --ink: #191B1B;
  --ink-soft: #565C5D;
  --ink-faint: #8B9091;
  --border: #E3E3DE;
  --border-strong: #CDCFC9;
  --accent: #1F4B4D;
  --accent-strong: #163839;
  --accent-tint: #EAF1F0;
  --gold: #A9772F;
  --gold-tint: #F6EEE0;
  --error: #A3352B;
  --radius: 3px;
  --max-w: 1080px;

  --font-body: 'Signika', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 700; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; }

p { margin: 0 0 14px; color: var(--ink-soft); }

.mono { font-family: var(--font-mono); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 10px;
}

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type { border-bottom: none; }

.section-head {
  max-width: 640px;
  margin: 0 0 32px;
}

.section-head p { margin-bottom: 0; }

/* ==========================================================================
   Header / navigation
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}

.brand .brand-mark {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2px 6px;
  letter-spacing: 0.02em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  font-size: 15px;
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: color .15s ease, background .15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--ink);
  background: var(--accent-tint);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform .2s ease;
}

.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

/* ==========================================================================
   Tool section (signature element: the ledger card)
   ========================================================================== */
.tool-section { padding-top: 48px; }

.tool-intro { max-width: 640px; margin-bottom: 28px; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tool-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.tool-form label {
  font-size: 13px;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 6px;
}

.field-group { flex: 1 1 280px; }

.tool-form input[type="text"] {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 20px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
}

.tool-form input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border: none;
  border-radius: var(--radius);
  padding: 12px 22px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  transition: background .15s ease;
}

.btn:hover { background: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink);
}

.btn-ghost:hover { background: var(--accent-tint); border-color: var(--accent); }

.result-ticket {
  padding: 28px 24px;
}

.result-ticket .ticket-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.ticket-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  width: 110px;
  flex-shrink: 0;
  padding-top: 4px;
}

.ticket-value-number {
  font-family: var(--font-mono);
  font-size: 26px;
  color: var(--accent);
}

.ticket-value-words {
  font-size: 20px;
  color: var(--ink);
  font-weight: 600;
}

.ticket-divider {
  border: none;
  border-top: 1px dashed var(--border-strong);
  margin: 18px 0;
}

.result-error {
  padding: 20px 24px;
  color: var(--error);
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  background: #FBF1EF;
}

.share-url {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  word-break: break-all;
}

/* ==========================================================================
   Benefit cards
   ========================================================================== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.benefit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.benefit-card .index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 10px;
  display: block;
}

.benefit-card h3 { margin-bottom: 8px; }
.benefit-card p { margin-bottom: 0; font-size: 14.5px; }

/* ==========================================================================
   How to use — steps
   ========================================================================== */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.steps li:first-child { border-top: none; }

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps h3 { margin-bottom: 4px; font-size: 16px; }
.steps p { margin-bottom: 0; font-size: 14.5px; }

/* ==========================================================================
   FAQ
   ========================================================================== */
.faq-item {
  border-top: 1px solid var(--border);
}

.faq-item:last-child { border-bottom: 1px solid var(--border); }

.faq-item summary {
  cursor: pointer;
  padding: 18px 4px;
  font-weight: 600;
  font-size: 16px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.faq-item[open] summary::after { content: '\2212'; }

.faq-item p {
  padding: 0 4px 18px;
  font-size: 14.5px;
  max-width: 720px;
}

/* ==========================================================================
   Popular conversions table
   ========================================================================== */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table.numbers-table {
  width: 100%;
  border-collapse: collapse;
}

table.numbers-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-tint);
}

table.numbers-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
  vertical-align: top;
}

table.numbers-table tr:last-child td { border-bottom: none; }

table.numbers-table td.num-cell {
  font-family: var(--font-mono);
  color: var(--accent);
  white-space: nowrap;
  width: 140px;
}

table.numbers-table td.num-cell a:hover { text-decoration: underline; }

table.numbers-table tr:nth-child(even) td { background: #FCFCFA; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 20px;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-note {
  font-size: 13px;
  color: var(--ink-faint);
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a {
  font-size: 13px;
  color: var(--ink-soft);
}

.footer-links a:hover { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 24px 16px;
    display: none;
  }

  .main-nav.open { display: flex; }

  .main-nav a { padding: 12px 6px; border-bottom: 1px solid var(--border); }
  .main-nav a:last-child { border-bottom: none; }

  .grid-3 { grid-template-columns: 1fr; }

  .btn { align-self: stretch; }

  table.numbers-table td, table.numbers-table th { padding: 10px 12px; }

  .ticket-label { width: 100%; }
}

@media (max-width: 480px) {
  .section { padding: 40px 0; }
  .ticket-value-number { font-size: 21px; }
  .ticket-value-words { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
