/* ═══════════════════════════════════════════════════════════
   THE LEDGER — Editorial / Financial Daily aesthetic
   Type: Fraunces (display) · Newsreader (body) · JetBrains Mono (data)
   Mood: aged paper, deep ink, vermillion accents, gilt highlights
═══════════════════════════════════════════════════════════ */

:root {
  /* Type stack — distinctive, editorial */
  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body:    'Newsreader', 'PT Serif', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Paper & ink palette */
  --bg:           #efe6cf;   /* aged cream paper */
  --surface:      #fbf5e3;   /* fresh sheet */
  --surface-2:    #e6dcbf;   /* deeper printed area */
  --inset:        #f6efd9;   /* slightly inset */
  --ink:          #1a1612;   /* deep printers ink */
  --ink-soft:     #4a4338;
  --ink-faint:    #8a8268;
  --rule:         #b6a983;   /* horizontal rule / hairline */
  --rule-soft:    #d8caa3;

  /* Accents */
  --accent:       #a8311c;   /* vermillion — masthead, key data */
  --accent-deep:  #7c2516;
  --gold:         #9a7c3a;   /* gilt — secondary emphasis */
  --gold-deep:    #7a601e;
  --good:         #4f6b3a;
  --bad:          #a8311c;

  /* Misc */
  --r:            2px;       /* sharp corners — newspaper, not SaaS */
  --r-card:       4px;
  --nav-h:        72px;
  --shadow-press: 0 1px 0 rgba(26,22,18,.06), 0 0 0 1px var(--rule-soft);
  --shadow-card:  0 1px 0 rgba(26,22,18,.10),
                  0 12px 28px -16px rgba(26,22,18,.32);
}

html.dark {
  --bg:           #14110c;
  --surface:      #1d1810;
  --surface-2:    #0e0c08;
  --inset:        #1a1610;
  --ink:          #ece2c6;
  --ink-soft:     #b9ac8b;
  --ink-faint:    #6e6749;
  --rule:         #3d3528;
  --rule-soft:    #2a2418;
  --accent:       #d77d6e;
  --accent-deep:  #b65a48;
  --gold:         #c8a763;
  --gold-deep:    #9b8044;
  --shadow-press: 0 1px 0 rgba(0,0,0,.4), 0 0 0 1px var(--rule-soft);
  --shadow-card:  0 1px 0 rgba(0,0,0,.5), 0 16px 36px -20px rgba(0,0,0,.85);
}

/* ─── reset ─── */
*,*::before,*::after { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 420;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  /* paper grain via SVG noise */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.045 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-blend-mode: multiply;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
}
html.dark {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .15s, color .15s;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   MASTHEAD / NAV
═══════════════════════════════════════════════════════════ */
.nav {
  position: relative;
  z-index: 200;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  /* double-rule like an old newspaper masthead */
  box-shadow: 0 4px 0 -3px var(--ink), 0 6px 0 -4px var(--ink);
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: 26px;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  justify-self: start;
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }

.nav-logo-icon {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.nav-logo-icon svg { width: 100%; height: 100%; display: block; }

/* Center column: edition line — date, volume */
.nav-edition {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  justify-self: center;
}
.nav-edition .sep { color: var(--rule); margin: 0 8px; }
.nav-edition em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.nav-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-email {
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-faint);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  text-decoration: none;
  transition: all .12s;
  line-height: 1;
}
/* compensate trailing letter-spacing for visual centering */
.nav-btn::after { content: ''; margin-left: -.14em; display: inline-block; width: 0; }
.nav-btn:hover {
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}
.nav-btn-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.nav-btn-solid:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: var(--surface);
}

/* ─── theme toggle (vertical, mono-styled) ─── */
.themeSwitch {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  position: static;
}
.themeSwitch-track {
  position: relative;
  width: 46px;
  height: 24px;
  display: block;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  transition: background .15s;
}
.themeSwitch:hover .themeSwitch-track { background: var(--surface); }
.themeSwitch-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  display: flex;
}
.themeSwitch-sun  { left: 5px; }
.themeSwitch-moon { right: 5px; }
.themeSwitch-thumb {
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background: var(--ink);
  border-radius: 0;
  transition: left .18s ease;
}
html.dark .themeSwitch-thumb { left: 24px; }

/* ═══════════════════════════════════════════════════════════
   HERO / FRONT-PAGE HEADLINE
═══════════════════════════════════════════════════════════ */
.hero {
  padding: 64px 24px 0;
  position: relative;
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.hero-eyebrow::before,
.hero-eyebrow::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--rule);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 9vw, 108px);
  line-height: .95;
  letter-spacing: -.04em;
  color: var(--ink);
  font-feature-settings: "liga" 1, "dlig" 1;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  font-feature-settings: "swsh" 1;
}

.hero p {
  margin: 22px auto 0;
  max-width: 540px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* hairline ornaments under headline */
.hero-rules {
  margin: 36px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--rule);
}
.hero-rules::before, .hero-rules::after {
  content: '';
  width: 80px;
  height: 1px;
  background: currentColor;
}
.hero-rules span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* no wave — replaced with a printers' rule + dot */
.wave { display: none; }

/* ═══════════════════════════════════════════════════════════
   CONVERTER — "rate inquiry slip"
═══════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
}

.converter {
  margin: 56px auto 0;
  padding: 36px 40px 32px;
  width: min(880px, calc(100vw - 32px));
  position: relative;
  border-radius: 0;
}

/* receipt-style top bar */
.converterEyebrow {
  position: absolute;
  top: -1px;
  left: 24px;
  transform: translateY(-50%);
  background: var(--bg);
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .26em;
  color: var(--ink-faint);
  white-space: nowrap;
}

.converter-grid { display: grid; gap: 28px; }

.exchangeGrid {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  gap: 24px;
  align-items: stretch;
}

.col { min-width: 0; }
.col .label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.col .label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}

.fieldBox {
  background: var(--inset);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 22px 22px 18px;
  min-height: 152px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color .15s, background .15s;
}
.fieldBox:hover { border-color: var(--ink); }
.fieldBox:focus-within {
  border-color: var(--ink);
  background: var(--surface);
}

/* the big number — tabular mono, like a stock ticker */
.big {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--rule);
  font-feature-settings: "tnum" 1, "zero" 1;
}
.big[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.big[type="number"]::-webkit-outer-spin-button,
.big[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.big:focus { border-bottom-color: var(--ink); }
.big.readonly { color: var(--accent); font-weight: 600; }

/* currency selector */
.selectWrap { position: relative; margin-top: 14px; }
.selectBtn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  cursor: pointer;
  border-radius: 0;
  transition: border-color .12s, background .12s;
}
.selectBtn:hover { border-color: var(--ink); background: var(--surface); }
.selectBtn.primary { background: transparent; }
.chev {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-faint);
  font-style: normal;
}
.chev::before { content: '▼'; }

/* swap key — round "coin" between the two slips */
.swapWrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 36px;
}
.swap {
  width: 46px; height: 46px;
  border: 1.5px solid var(--rule);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  padding: 0;
  transition:
    background .22s var(--ease-spring),
    border-color .22s var(--ease-spring),
    color .22s var(--ease-spring),
    box-shadow .22s var(--ease-spring),
    transform .22s var(--ease-spring);
}
.swap svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform .22s var(--ease-spring);
}
.swap:hover {
  background: var(--inset);
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(26,22,18,.14);
}
html.dark .swap:hover { box-shadow: 0 6px 18px rgba(0,0,0,.45); }
.swap:hover svg { transform: scale(1.08); }
.swap:active { transform: translateY(0) scale(.94); transition-duration: .08s; }
.swap.spin svg {
  animation: swapTurn .55s cubic-bezier(.65, 0, .35, 1);
}
@keyframes swapTurn {
  from { transform: rotate(0); }
  to   { transform: rotate(180deg); }
}

/* row 2: date + button */
.row2 {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.dateFocus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  background: var(--inset);
  cursor: pointer;
  border-radius: 0;
  transition: border-color .12s, background .12s;
}
.dateFocus:hover, .dateFocus:focus-within {
  border-color: var(--ink);
  background: var(--surface);
}
.dateFocus strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2px;
}
.dateFocus small {
  display: block;
  font-style: italic;
  font-size: 12px;
  color: var(--ink-soft);
}

/* status pill — like a printers' stamp */
.meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: 0;
}
#statusText {
  display: inline-block;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}
#statusText.statusFading {
  opacity: 0;
  transform: translateY(-3px);
}
.dot {
  width: 8px; height: 8px;
  background: var(--ink-faint);
  flex-shrink: 0;
  border-radius: 50%;
  transition: background-color .35s var(--ease-out), box-shadow .35s var(--ease-out);
}
.pipe { color: var(--rule); }
.metaLabel { font-style: normal; }

/* date inputs */
.date, .authInput {
  border: 1px solid var(--rule);
  background: var(--inset);
  color: var(--ink);
  padding: 0 12px;
  height: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: 0;
  transition: border-color .12s, background .12s;
}
.date:focus, .authInput:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface);
}
.dateLarge {
  min-width: 158px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  /* prevent iOS from inflating the height of native date input */
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  text-align: center;
}
.dateLarge::-webkit-date-and-time-value {
  text-align: center;
  min-height: 0;
  line-height: normal;
  margin: 0;
}
.dateLarge::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
html.dark .dateLarge::-webkit-calendar-picker-indicator { filter: invert(1); }

/* CTA — a bold imprimatur stamp */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 28px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  border-radius: 0;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1;
}
.cta::after { content: ''; margin-left: -.2em; display: inline-block; width: 0; order: 99; }
.cta:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.cta.ctaBlue {
  height: 38px;
  padding: 0 18px;
  font-size: 11px;
}

/* dropdown menu */
.menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .14s, transform .14s;
  z-index: 100;
  overflow: hidden;
  border-radius: 0;
}
.selectWrap.open .menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.menuSearch {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  outline: none;
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  color: var(--ink);
}
.menuSearch::placeholder { color: var(--ink-faint); font-style: italic; }
.menuList {
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.menuList::-webkit-scrollbar { width: 6px; }
.menuList::-webkit-scrollbar-track { background: transparent; }
.menuList::-webkit-scrollbar-thumb { background: var(--rule); }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-soft);
  transition: background .1s;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--inset); }
.item.is-fav { background: rgba(168, 49, 28, .04); }
html.dark .item.is-fav { background: rgba(215, 125, 110, .07); }
.code { font-weight: 700; letter-spacing: .12em; }
.name {
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.itemFav {
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  flex-shrink: 0;
  opacity: .55;
  transition: color .15s, transform .18s var(--ease-spring), opacity .15s;
}
.itemFav:hover { color: var(--accent); transform: scale(1.18); opacity: 1; }
.itemFav.active { color: var(--accent); opacity: 1; }
.itemFav.locked { opacity: .35; }
.itemFav.locked:hover { opacity: .85; color: var(--accent); }
.itemFav svg { width: 14px; height: 14px; display: block; }

.itemSep {
  height: 1px;
  background: var(--rule);
  margin: 4px 14px;
}

/* ═══════════════════════════════════════════════════════════
   RESULT BLOCK — "filed entry"
═══════════════════════════════════════════════════════════ */
.resultBox {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px double var(--ink);
  position: relative;
}
.resultBox::before {
  content: attr(data-filed);
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .3em;
  color: var(--accent);
}

.resultSummary {
  display: grid;
  grid-template-columns: 1fr minmax(280px, .9fr);
  gap: 24px;
  align-items: end;
}

.resultAmount { display: grid; gap: 6px; }
.resultLabel {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.resultAmount strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--accent);
}
.resultAmount strong em {
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--ink-faint);
  margin-left: 8px;
  vertical-align: 8px;
}
.resultAmount small {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}

.resultStats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule);
  background: var(--inset);
}
.resultStat {
  padding: 14px;
  border-right: 1px solid var(--rule);
}
.resultStat:last-child { border-right: 0; }
.resultStat > span {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.resultStat b {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dateNotice {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--gold);
  background: rgba(154,124,58,.07);
  color: var(--ink);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
  line-height: 1.55;
  border-radius: 0;
}
html.dark .dateNotice { background: rgba(200,167,99,.07); }

.raw {
  margin-top: 16px;
  padding: 16px;
  background: var(--inset);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink);
  overflow-x: auto;
  border-radius: 0;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   MAIN / SECTIONS
═══════════════════════════════════════════════════════════ */
.main { padding: 88px 24px 80px; }
.section { max-width: 1100px; margin: 0 auto; }
.section + .section { margin-top: 80px; }

.section h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -.025em;
  color: var(--ink);
  font-feature-settings: "liga" 1, "dlig" 1;
}
.section h2 em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}
.sub {
  margin: 0 0 24px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.sub::after {
  content: '◆';
  position: absolute;
  bottom: -8px;
  left: 0;
  background: var(--bg);
  padding-right: 10px;
  color: var(--accent);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   TABLE — ledger / stock listing
═══════════════════════════════════════════════════════════ */
.table {
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 0;
  overflow: hidden;
}

.tableHead {
  display: grid;
  grid-template-columns: minmax(160px,1.4fr) minmax(110px,.8fr) minmax(130px,.8fr) minmax(80px,.5fr);
  padding: 12px 22px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
}
.tableBody .row {
  display: grid;
  grid-template-columns: minmax(160px,1.4fr) minmax(110px,.8fr) minmax(130px,.8fr) minmax(80px,.5fr);
  padding: 14px 22px;
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  align-items: center;
  transition: background .12s;
}
.tableBody .row:nth-child(even) { background: var(--inset); }
.tableBody .row:last-child { border-bottom: 0; }
.tableBody .row:hover { background: var(--surface-2); }
.tableHead > div, .tableBody .row > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableBody .row > div:first-child { font-weight: 700; letter-spacing: .12em; }
.tableBody .row > div:nth-child(2) { color: var(--accent); font-weight: 600; }
.tableBody .row > div:nth-child(3) { color: var(--ink-soft); }
.tableHead > div:nth-child(4),
.tableBody .row > div:nth-child(4) { text-align: right; }
.tableBody .row > div:nth-child(4) {
  display: flex;
  justify-content: flex-end;
}
.tableBody .row > div:nth-child(4) span {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid var(--rule);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--ink-soft);
}
.tableFoot {
  padding: 12px 22px;
  display: flex;
  gap: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tableFoot a { color: var(--ink-faint); text-decoration: underline; text-decoration-color: var(--rule); }
.tableFoot a:hover { color: var(--accent); }
.tableFoot span { color: var(--rule); font-size: 0; }
.tableFoot span::before { content: '·'; font-size: 18px; }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD / MANAGE
═══════════════════════════════════════════════════════════ */
.manageSection { padding-bottom: 60px; }
.manageCard { padding: 0; overflow: visible; }
.manageForm {
  display: grid;
  grid-template-columns: 1fr 100px 100px 1fr auto;
  gap: 10px;
  padding: 22px;
  border-bottom: 1px solid var(--rule);
  background: var(--inset);
  align-items: center;
}
.manageForm .date { height: 40px; }
.manageSelect { position: relative; }
.manageSelect .selectBtn {
  height: 40px;
  padding: 0 12px;
  font-size: 13px;
  background: transparent;
}
.manageSelect .menu {
  min-width: 220px;
  left: 0;
  right: auto;
}
.manageList { padding: 14px; display: grid; gap: 10px; }
.manageRow {
  display: grid;
  grid-template-columns: minmax(130px,1fr) 110px minmax(160px,1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12.5px;
  border-radius: 0;
  transition: border-color .12s;
}
.manageRow:hover { border-color: var(--ink); }
.managePair {
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink);
}
.manageDate {
  color: var(--ink-faint);
  font-size: 12px;
}
.manageUpdate { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.miniBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: all .12s;
  line-height: 1;
}
.miniBtn::after { content: ''; margin-left: -.18em; display: inline-block; width: 0; order: 99; }
.miniBtn:hover { background: var(--accent); border-color: var(--accent); }
.dangerBtn {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.dangerBtn:hover { background: var(--accent); color: var(--surface); }

.emptyState {
  padding: 40px 20px;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 15px;
}

.guestPanel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
}
.guestPanel h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -.02em;
  color: var(--ink);
}
.guestPanel p {
  margin: 0;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.guestPanelActions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   AUTH — subscriber pages
═══════════════════════════════════════════════════════════ */
.authHero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: flex-start;
}
.authCard {
  max-width: 460px;
  margin: 56px auto 0;
  padding: 40px;
  position: relative;
}
.authForm { display: grid; gap: 18px; }
.authLabel {
  display: grid;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.authInput { width: 100%; height: 46px; }
.authSubmit { width: 100%; height: 46px; margin-top: 6px; }
.authLinks {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 14px;
}

/* flash messages */
.flashStack { display: grid; gap: 10px; margin-bottom: 22px; }
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-14px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.flash {
  padding: 12px 16px;
  border: 1px solid var(--rule);
  background: var(--inset);
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: var(--ink);
  border-left: 3px solid var(--ink-faint);
  border-radius: 0;
  overflow: hidden;
  transform-origin: top center;
  animation: flashIn .5s var(--ease-spring) both;
  transition:
    opacity .5s var(--ease-out),
    transform .5s var(--ease-out),
    max-height .55s var(--ease-out) .05s,
    padding .55s var(--ease-out) .05s,
    margin .55s var(--ease-out) .05s,
    border-width .55s var(--ease-out) .05s;
  max-height: 200px;
}
.flash-error   { border-left-color: var(--accent); }
.flash-success { border-left-color: var(--good); }
.flash.dismissing {
  opacity: 0;
  transform: translateX(32px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border-top-width: 0;
  border-bottom-width: 0;
}

/* ═══════════════════════════════════════════════════════════
   MODAL — "subscription invitation"
═══════════════════════════════════════════════════════════ */
.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20,17,12,.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modalOverlay.show { opacity: 1; pointer-events: auto; }
.signupModal {
  width: min(500px, 100%);
  padding: 36px;
}
.modalEyebrow {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--accent);
}
.signupModal h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.signupModal p {
  margin: 0 0 22px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.modalFeatureGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 22px;
}
.modalFeature {
  border: 1px solid var(--rule);
  background: var(--inset);
  padding: 16px;
}
.modalFeature span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}
.modalFeature small {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.modalActions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modalActions .cta { width: 100%; height: 44px; }
.modalSecondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: all .12s;
  line-height: 1;
}
.modalSecondary::after { content: ''; margin-left: -.2em; display: inline-block; width: 0; }
.modalSecondary:hover { background: var(--ink); color: var(--bg); }

/* ═══════════════════════════════════════════════════════════
   LANGUAGE PICKER
═══════════════════════════════════════════════════════════ */
.langPicker { position: relative; }

.langBtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: all .12s;
}
.langBtn:hover { background: var(--ink); color: var(--bg); }
.langBtn svg { display: block; }

.langMenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .14s, transform .14s;
  z-index: 250;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
/* Invisible bridge so hover doesn't break in the gap */
.langMenu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
  pointer-events: auto;
}
.langPicker.open .langMenu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.langItem {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  border-radius: 0;
  transition: background .1s;
}
.langItem:last-child { border-bottom: 0; }
.langItem:hover { background: var(--inset); }
.langItem.active {
  background: var(--inset);
  color: var(--accent);
}
.langItem.active::after {
  content: '◆';
  margin-left: auto;
  color: var(--accent);
  font-size: 10px;
}

.langItemCode {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--ink-faint);
  min-width: 24px;
}
.langItem.active .langItemCode { color: var(--accent); }

.langItemName {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   RTL SUPPORT (Arabic)
═══════════════════════════════════════════════════════════ */
body.rtl {
  font-family: 'Newsreader', 'Noto Naskh Arabic', Georgia, serif;
}
body.rtl .nav-inner { direction: rtl; }
body.rtl .nav-edition { direction: rtl; }
body.rtl .nav-logo { font-style: normal; }
body.rtl .hero-eyebrow,
body.rtl .col .label,
body.rtl .meta,
body.rtl .converterEyebrow,
body.rtl .resultLabel,
body.rtl .resultStat span,
body.rtl .modalEyebrow,
body.rtl .authLabel,
body.rtl .nav-edition,
body.rtl .langItemCode,
body.rtl .nav-btn,
body.rtl .langBtn,
body.rtl .miniBtn,
body.rtl .cta {
  letter-spacing: 0;
}
body.rtl .converterEyebrow { left: auto; right: 24px; }
body.rtl .col .label::after { display: none; }
body.rtl .col .label::before {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}
body.rtl .col .label { flex-direction: row-reverse; }
body.rtl .langMenu { right: auto; left: 0; }
body.rtl .langItem.active::after { margin-left: 0; margin-right: auto; }
body.rtl .hero h1 { font-family: 'Fraunces', 'Noto Naskh Arabic', serif; }
body.rtl .section h2 { font-family: 'Fraunces', 'Noto Naskh Arabic', serif; }

/* CJK font swap when those langs active */
html[lang="zh"] body { font-family: 'Newsreader', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', serif; }
html[lang="zh"] .hero h1,
html[lang="zh"] .section h2,
html[lang="zh"] .signupModal h2 { font-family: 'Fraunces', 'Noto Sans SC', serif; font-weight: 700; }
html[lang="zh"] .nav-logo { font-style: normal; }

html[lang="ja"] body { font-family: 'Newsreader', 'Noto Sans JP', 'Hiragino Mincho ProN', serif; }
html[lang="ja"] .hero h1,
html[lang="ja"] .section h2,
html[lang="ja"] .signupModal h2 { font-family: 'Fraunces', 'Noto Sans JP', serif; font-weight: 700; }
html[lang="ja"] .nav-logo { font-style: normal; }

/* ═══════════════════════════════════════════════════════════
   ANIMATION SYSTEM
   — easings: spring out, ink bleed
   — only transform & opacity (per skill rules)
═══════════════════════════════════════════════════════════ */

/* Easings */
:root {
  --ease-spring:  cubic-bezier(.16, 1, .3, 1);
  --ease-out:     cubic-bezier(.22, 1, .36, 1);
  --ease-press:   cubic-bezier(.4, 0, .2, 1);
}

/* ─── PAGE LOAD ORCHESTRATION ─── */
@keyframes inkRise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes inkSettle {
  0%   { opacity: 0; transform: translateY(28px) scale(.985); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.002); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mastheadDrop {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}
@keyframes ruleDraw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes heroRise {
  0%   { opacity: 0; transform: translateY(56px) scale(.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.nav            { animation: mastheadDrop .55s var(--ease-spring) both; }
.hero-eyebrow   { animation: inkRise .65s var(--ease-out) both .15s; }

/* Hero h1: animate the span and em separately, in sequence */
.hero h1 > span,
.hero h1 > em {
  display: inline-block;
  will-change: transform, opacity;
}
.hero h1 > span { animation: heroRise 1.05s cubic-bezier(.16, 1, .3, 1) both .25s; }
.hero h1 > em   { animation: heroRise 1.15s cubic-bezier(.16, 1, .3, 1) both .55s; }

.hero p         { animation: inkRise .75s var(--ease-out) both .85s; }
.hero-rules     { animation: inkRise .6s var(--ease-out) both 1s; }
.hero-rules::before,
.hero-rules::after {
  transform-origin: center;
  animation: ruleDraw .7s var(--ease-out) both 1.12s;
}
.converter      { animation: inkSettle .85s var(--ease-spring) both 1s; }

/* ─── STATUS DOT PULSE ─── */
@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.4); }
}
.dot {
  animation: dotPulse 2.2s ease-in-out infinite;
  transform-origin: center;
  will-change: transform;
}

/* ─── BUTTON / CTA — ink darken + lift ─── */
.cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform .32s var(--ease-spring);
  z-index: -1;
}
.cta:hover::before { transform: translateY(0); }
.cta:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--surface);
}
html.dark .cta:hover { color: var(--ink); }
.cta:active { transform: translateY(1px) scale(.98); transition: transform .08s var(--ease-press); }

.miniBtn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform .12s var(--ease-press);
}
.miniBtn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease-spring);
  z-index: -1;
}
.miniBtn:hover::before { transform: scaleX(1); }
.miniBtn:hover { filter: none; background: transparent; color: var(--bg); border: 1px solid var(--accent); }
.dangerBtn::before { background: var(--accent); }
.dangerBtn:hover { color: var(--surface); border-color: var(--accent); }
.miniBtn:active { transform: scale(.96); }

/* ─── NAV BUTTONS — same treatment ─── */
.nav-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateY(101%);
  transition: transform .28s var(--ease-spring);
  z-index: -1;
}
.nav-btn:hover::before { transform: translateY(0); }
.nav-btn-solid::before { background: var(--accent-deep); }

/* ─── LINKS — underline draws ─── */
.tableFoot a,
.authLinks a,
.guestPanelActions a {
  position: relative;
}
.tableFoot a::after,
.authLinks a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .28s var(--ease-spring);
}
.tableFoot a:hover::after,
.authLinks a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}
.tableFoot a:hover,
.authLinks a:hover { text-decoration: none; }

/* ─── INPUT FOCUS — vermillion glow draws in ─── */
.fieldBox,
.dateFocus,
.date,
.authInput,
.menuSearch {
  position: relative;
}
.big {
  position: relative;
}
.big::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 14px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease-spring);
}
.big:focus { border-bottom-color: transparent; }
.big:focus::after { transform: scaleX(1); }

/* ─── FILED STAMP — drop in with rotation ─── */
@keyframes stampDrop {
  0%   { opacity: 0; transform: translate(-50%, -180%) rotate(-14deg) scale(1.5); }
  60%  { opacity: 1; transform: translate(-50%, -42%) rotate(3deg) scale(1.04); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-2deg) scale(1); }
}
.resultBox:not(.hidden)::before {
  animation: stampDrop .65s var(--ease-spring) both;
}

/* ─── RESULT APPEAR ─── */
@keyframes resultUnfold {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.resultBox:not(.hidden) > .resultSummary {
  animation: resultUnfold .55s var(--ease-out) both .15s;
}
.resultBox:not(.hidden) > .dateNotice {
  animation: resultUnfold .5s var(--ease-out) both .35s;
}

/* ─── DROPDOWN MENU items stagger ─── */
@keyframes itemFade {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.selectWrap.open .item,
.langPicker.open .langItem {
  animation: itemFade .28s var(--ease-out) both;
}
.selectWrap.open .item:nth-child(1)  { animation-delay: .03s }
.selectWrap.open .item:nth-child(2)  { animation-delay: .06s }
.selectWrap.open .item:nth-child(3)  { animation-delay: .09s }
.selectWrap.open .item:nth-child(4)  { animation-delay: .12s }
.selectWrap.open .item:nth-child(5)  { animation-delay: .14s }
.selectWrap.open .item:nth-child(6)  { animation-delay: .16s }
.selectWrap.open .item:nth-child(7)  { animation-delay: .18s }
.selectWrap.open .item:nth-child(8)  { animation-delay: .19s }
.selectWrap.open .item:nth-child(n+9){ animation-delay: .2s }
.langPicker.open .langItem:nth-child(1)  { animation-delay: .03s }
.langPicker.open .langItem:nth-child(2)  { animation-delay: .06s }
.langPicker.open .langItem:nth-child(3)  { animation-delay: .09s }
.langPicker.open .langItem:nth-child(4)  { animation-delay: .12s }
.langPicker.open .langItem:nth-child(5)  { animation-delay: .15s }
.langPicker.open .langItem:nth-child(6)  { animation-delay: .17s }
.langPicker.open .langItem:nth-child(7)  { animation-delay: .19s }
.langPicker.open .langItem:nth-child(n+8){ animation-delay: .21s }

/* ─── TABLE ROWS sweep on hover ─── */
.tableBody .row {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.tableBody .row::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent-glow, rgba(168,49,28,.08)), transparent);
  transform: translateX(-100%);
  transition: transform .55s var(--ease-out);
  z-index: -1;
}
.tableBody .row:hover::before { transform: translateX(100%); }

@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tableBody .row {
  animation: rowFadeIn .35s var(--ease-out) both;
}
.tableBody .row:nth-child(1)  { animation-delay: .02s }
.tableBody .row:nth-child(2)  { animation-delay: .05s }
.tableBody .row:nth-child(3)  { animation-delay: .08s }
.tableBody .row:nth-child(4)  { animation-delay: .11s }
.tableBody .row:nth-child(5)  { animation-delay: .14s }
.tableBody .row:nth-child(6)  { animation-delay: .17s }
.tableBody .row:nth-child(7)  { animation-delay: .19s }
.tableBody .row:nth-child(8)  { animation-delay: .21s }
.tableBody .row:nth-child(n+9){ animation-delay: .23s }

/* ─── MANAGE ROWS fade in ─── */
.manageRow { animation: rowFadeIn .4s var(--ease-out) both; }
.manageList .manageRow:nth-child(1) { animation-delay: .04s }
.manageList .manageRow:nth-child(2) { animation-delay: .08s }
.manageList .manageRow:nth-child(3) { animation-delay: .12s }
.manageList .manageRow:nth-child(4) { animation-delay: .15s }
.manageList .manageRow:nth-child(n+5){ animation-delay: .18s }

/* ─── CURRENCY CODE swap micro-animation ─── */
@keyframes codePop {
  0%   { transform: translateY(0); opacity: 1; }
  40%  { transform: translateY(-6px); opacity: 0; }
  60%  { transform: translateY(6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.codeFlip { animation: codePop .35s var(--ease-spring); display: inline-block; }

/* ─── MODAL entrance ─── */
@keyframes modalRise {
  from { opacity: 0; transform: translateY(40px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modalOverlay.show .signupModal {
  animation: modalRise .5s var(--ease-spring) both .05s;
}

/* ─── THEME TOGGLE thumb bounce ─── */
.themeSwitch-thumb { transition: left .32s var(--ease-spring); }

/* ─── LANGUAGE PICKER + DROPDOWNS appear ─── */
.langPicker.open .langMenu,
.selectWrap.open .menu {
  animation: menuRise .28s var(--ease-spring) both;
}
@keyframes menuRise {
  from { opacity: 0; transform: translateY(-10px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── SECTION HEADERS underline draws on entry via IntersectionObserver class ─── */
.section .sub::after {
  transform-origin: left;
  transition: transform .8s var(--ease-out);
}

/* ─── LOGO HOVER spin ─── */
.nav-logo:hover .nav-logo-icon {
  animation: logoFlip .5s var(--ease-spring);
}
@keyframes logoFlip {
  0%   { transform: rotate(0); }
  50%  { transform: rotate(8deg) scale(1.08); }
  100% { transform: rotate(0); }
}
.nav-logo-icon { transition: transform .25s var(--ease-spring); }

/* ═══════════════════════════════════════════════════════════
   CUSTOM DATE PICKER — editorial calendar
═══════════════════════════════════════════════════════════ */
.dpWrap { position: relative; display: inline-block; }
.dateFocus .dpWrap { display: block; min-width: 0; }
.dateFocus .dpWrap > input.dateLarge { width: 100%; }

.dpCal {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-card);
  padding: 16px;
  opacity: 0;
  transform: translateY(-8px) scale(.985);
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 200;
}
.dpCal::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -8px;
  height: 8px;
}
.dpWrap.open .dpCal {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dpHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 14px;
}
.dpTitle {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 19px;
  letter-spacing: -.01em;
  color: var(--ink);
  text-transform: capitalize;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dpNav {
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.dpNav.dpNavYear {
  font-size: 13px;
  color: var(--ink-faint);
}
.dpNav:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.dpDow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 6px;
}
.dpDow span {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 4px 0;
}

.dpGrid,
.dpBody.dpDayGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}
.dpBody.dpItemGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 0 4px;
}
.dpItem {
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  height: 44px;
  cursor: pointer;
  border-radius: 0;
  transition: background .12s, color .12s;
  text-transform: capitalize;
  position: relative;
}
.dpItem:hover { background: var(--inset); }
.dpItem.today {
  font-weight: 800;
}
.dpItem.today::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.dpItem.selected {
  background: var(--accent);
  color: var(--surface);
}
.dpItem.selected.today::after { background: var(--surface); }
.dpItem.selected:hover { background: var(--accent-deep); }
.dpDay {
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  height: 34px;
  cursor: pointer;
  border-radius: 0;
  position: relative;
  transition: background .12s, color .12s;
}
.dpDay:hover:not(:disabled) {
  background: var(--inset);
}
.dpDay.muted {
  color: var(--ink-faint);
  opacity: .35;
  cursor: default;
}
.dpDay.today {
  font-weight: 700;
}
.dpDay.today::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.dpDay.selected {
  background: var(--accent);
  color: var(--surface);
}
.dpDay.selected.today::after { background: var(--surface); }
.dpDay.selected:hover { background: var(--accent-deep); }

.dpFoot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: flex-end;
}
.dpToday {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 0;
  transition: color .12s;
}
.dpToday:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }

/* Mobile: full-width picker, anchored under input */
@media (max-width: 540px) {
  .dpCal {
    width: calc(100vw - 32px);
    max-width: 320px;
    right: auto;
    left: 0;
  }
}

/* ─── HERO LETTER REVEAL (motion.js applies delays per char) ─── */
.splitChar {
  display: inline-block;
  opacity: 0;
  transform: translateY(44px) rotate(3deg);
  animation: heroCharIn .92s cubic-bezier(.16, 1, .3, 1) both;
  will-change: transform, opacity;
}
@keyframes heroCharIn {
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

/* ─── SECTION SCROLL REVEAL ─── */
.main .section.revealPending {
  opacity: 0;
  transform: translateY(28px);
  will-change: transform, opacity;
  transition: opacity .75s var(--ease-spring), transform .75s var(--ease-spring);
}
.main .section.revealPending.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ─── REDUCED MOTION ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-inner { grid-template-columns: 1fr auto; }
  .nav-edition { display: none; }
  .hero { padding-top: 48px; }
  .hero h1 { font-size: clamp(40px, 11vw, 72px); }
  .converter { padding: 28px 22px 26px; margin-top: 44px; }
  .converter::before { left: 20px; font-size: 10px; }
  .exchangeGrid { grid-template-columns: 1fr; gap: 16px; }
  .swapWrap { padding: 4px 0; justify-content: center; }
  .row2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .row2 > #btn { width: 100%; }
  .resultSummary { grid-template-columns: 1fr; gap: 18px; }
  .resultAmount strong { font-size: 44px; }
  .resultStats { grid-template-columns: 1fr; }
  .resultStat { border-right: 0; border-bottom: 1px solid var(--rule); }
  .resultStat:last-child { border-bottom: 0; }
  .section h2 { font-size: 32px; }
  .main { padding: 60px 20px 64px; }
  .manageForm { grid-template-columns: 1fr 1fr; }
  .manageForm input[name="date"],
  .manageForm input[name="rate"],
  .manageForm .cta { grid-column: 1 / -1; }
  .manageRow {
    grid-template-columns: 1fr auto;
    grid-template-areas: "pair date" "update delete";
  }
  .managePair { grid-area: pair; }
  .manageDate { grid-area: date; text-align: right; }
  .manageUpdate { grid-area: update; }
  .manageRow > form:last-child { grid-area: delete; align-self: stretch; display: flex; }
  .manageRow > form:last-child .miniBtn { flex: 1; }
  .guestPanel { flex-direction: column; align-items: flex-start; }
  .guestPanelActions { width: 100%; }
  .modalActions { grid-template-columns: 1fr; }
  .modalFeatureGrid { grid-template-columns: 1fr; }
  .nav-email { display: none; }
}

@media (max-width: 540px) {
  :root { --nav-h: 56px; }

  /* TAP HIGHLIGHT — clean on iOS */
  a, button, input { -webkit-tap-highlight-color: transparent; }

  /* HERO */
  .hero { padding: 30px 16px 0; }
  .hero h1 { font-size: clamp(34px, 11vw, 48px); padding: 0 4px; }
  .hero p { font-size: 15px; margin-top: 16px; padding: 0 4px; }
  .hero-eyebrow { font-size: 10px; letter-spacing: .2em; }
  .hero-eyebrow::before, .hero-eyebrow::after { width: 22px; }
  .hero-rules { margin-top: 28px; gap: 10px; }
  .hero-rules::before, .hero-rules::after { width: 26px; }
  .hero-rules span { font-size: 9.5px; letter-spacing: .15em; }

  /* CONVERTER */
  .converter { padding: 24px 16px 20px; margin-top: 36px; width: calc(100vw - 24px); }
  .converterEyebrow { font-size: 9.5px; left: 14px; padding: 0 8px; letter-spacing: .2em; }
  .converter-grid { gap: 18px; }
  .fieldBox { padding: 16px; min-height: 128px; }
  .col .label { font-size: 10px; letter-spacing: .18em; margin-bottom: 8px; }
  .big { font-size: 28px; padding-bottom: 12px; }
  .selectBtn { height: 38px; font-size: 12px; padding: 0 11px; }
  .swap { width: 42px; height: 42px; }
  .swap::before { font-size: 20px; }

  /* DATE row */
  .dateFocus {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
    justify-content: flex-start;
  }
  .dateFocus strong { font-size: 10px; letter-spacing: .18em; }
  .dateFocus small { font-size: 11.5px; }
  .dateLarge { width: 100%; min-width: 0; height: 40px; }
  .row2 {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 18px;
  }
  .row2 > #btn { width: 100%; height: 46px; font-size: 12px; }

  /* RESULT */
  .resultBox { margin-top: 22px; padding-top: 22px; }
  .resultBox::before { font-size: 10px; padding: 0 12px; letter-spacing: .26em; }
  .resultSummary { gap: 14px; }
  .resultLabel { font-size: 10px; letter-spacing: .18em; }
  .resultAmount strong { font-size: 38px; }
  .resultAmount strong em { font-size: 16px; vertical-align: 6px; margin-left: 6px; }
  .resultAmount small { font-size: 13px; }
  .resultStat { padding: 12px 14px; }
  .resultStat > span { font-size: 9px; letter-spacing: .18em; }
  .resultStat b { font-size: 13px; }
  .dateNotice { font-size: 13px; padding: 10px 14px; }

  /* MAIN / SECTIONS */
  .main { padding: 44px 16px 56px; }
  .section + .section { margin-top: 56px; }
  .section h2 { font-size: 26px; }
  .sub { font-size: 14px; padding-bottom: 14px; }

  /* TABLE - card style */
  .tableHead { display: none; }
  .tableBody .row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "pair source" "rate date";
    row-gap: 8px;
    padding: 14px 16px;
    font-size: 12.5px;
  }
  .tableBody .row > div:nth-child(1) { grid-area: pair; }
  .tableBody .row > div:nth-child(2) { grid-area: rate; overflow: visible; }
  .tableBody .row > div:nth-child(3) { grid-area: date; text-align: right; overflow: visible; font-size: 11px; }
  .tableBody .row > div:nth-child(4) { grid-area: source; justify-self: end; }
  .tableFoot { padding: 10px 16px; font-size: 10px; }

  /* MANAGE */
  .manageForm { grid-template-columns: 1fr; padding: 16px; gap: 8px; }
  .manageForm .date { height: 44px; }
  .manageForm input[name="date"],
  .manageForm input[name="rate"] { grid-column: unset; }
  .manageList { padding: 12px; gap: 8px; }
  .manageRow {
    grid-template-columns: 1fr;
    grid-template-areas: "pair" "date" "update" "delete";
    padding: 14px;
    gap: 10px;
  }
  .manageDate { text-align: left; }
  .manageUpdate { grid-template-columns: 1fr auto; }
  .manageRow > form:last-child .miniBtn { width: 100%; height: 40px; }
  .miniBtn { height: 40px; }

  /* GUEST PANEL */
  .guestPanel { padding: 24px; gap: 18px; flex-direction: column; align-items: flex-start; }
  .guestPanel h3 { font-size: 22px; }
  .guestPanel p { font-size: 14px; }
  .guestPanelActions { width: 100%; flex-wrap: wrap; }
  .guestPanelActions .cta,
  .guestPanelActions .miniBtn { flex: 1; min-width: 130px; height: 44px; }

  /* AUTH */
  .authCard { padding: 28px 22px; margin-top: 24px; max-width: calc(100vw - 32px); }
  .authForm { gap: 14px; }
  .authInput { height: 44px; font-size: 14px; }
  .authSubmit { height: 46px; }
  .authLinks { flex-direction: column; gap: 10px; align-items: center; font-size: 13px; }
  .authLinks a { padding: 4px 0; }

  /* NAV */
  .nav { height: 56px; }
  .nav-inner { padding: 0 14px; gap: 8px; }
  .nav-logo { font-size: 19px; gap: 7px; }
  .nav-logo-icon { width: 26px; height: 26px; }
  .nav-right { gap: 6px; }
  .nav-btn {
    height: 30px;
    padding: 0 9px;
    font-size: 10px;
    letter-spacing: .1em;
  }
  .nav-btn::after { margin-left: -.1em; }
  .langBtn {
    height: 30px;
    padding: 0 7px;
    font-size: 10px;
    gap: 4px;
    letter-spacing: .1em;
  }
  .langBtn svg { width: 11px; height: 11px; }
  .langMenu { min-width: 180px; max-height: 280px; }
  .langItem { padding: 12px 14px; }
  .langItemName { font-size: 13px; }
  .themeSwitch-track { width: 40px; height: 22px; }
  .themeSwitch-thumb { width: 16px; height: 16px; }
  html.dark .themeSwitch-thumb { left: 21px; }
  .themeSwitch-icon svg { width: 9px; height: 9px; }
  .themeSwitch-sun { left: 4px; }
  .themeSwitch-moon { right: 4px; }

  /* MODAL */
  .modalOverlay { padding: 14px; align-items: flex-end; }
  .signupModal { padding: 24px 22px; max-width: 100%; max-height: 90vh; overflow-y: auto; }
  .signupModal h2 { font-size: 22px; }
  .signupModal p { font-size: 14px; margin-bottom: 18px; }
  .modalEyebrow { font-size: 10px; letter-spacing: .22em; }
  .modalFeatureGrid { gap: 8px; margin-bottom: 18px; }
  .modalFeature { padding: 12px; }
  .modalFeature span { font-size: 12px; letter-spacing: .14em; }
  .modalFeature small { font-size: 12px; }
  .modalActions .cta,
  .modalSecondary { height: 46px; font-size: 11.5px; }

  /* CURRENCY DROPDOWN */
  .menu { left: -8px; right: -8px; }
  .menuList { max-height: 200px; }
  .item { padding: 12px 14px; font-size: 13px; }
}

/* ─── Very small phones (≤380px) ─── */
@media (max-width: 380px) {
  .nav-inner { padding: 0 10px; gap: 6px; }
  .nav-logo { font-size: 17px; gap: 6px; }
  .nav-logo-icon { width: 24px; height: 24px; }
  .nav-right { gap: 5px; }
  .nav-btn { padding: 0 8px; font-size: 9.5px; }
  /* Hide language flag text on very small screens, keep just globe icon */
  .langBtn #langCurrent { display: none; }
  .langBtn { padding: 0 6px; }

  .hero { padding-top: 24px; }
  .hero h1 { font-size: clamp(28px, 9.5vw, 38px); }
  .hero p { font-size: 14px; }
  .converter { padding: 20px 14px 18px; margin-top: 28px; }
  .big { font-size: 26px; }
  .resultAmount strong { font-size: 32px; }
  .resultAmount strong em { font-size: 14px; }
  .section h2 { font-size: 22px; }
  .signupModal { padding: 20px 18px; }
}
