/* ==========================================================================
   Timelock — design system
   Aesthetic: engraved banknote meets precision instrument.
   High-contrast Didone display type, hairline rules, guilloché line-work,
   monospace tabular numerals. Dark only, by product requirement.
   ========================================================================== */

/* ---------- Fonts ---------- */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-400.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/plexmono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/plexmono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --ink-900: #070a08;
  --ink-850: #0a0f0c;
  --ink-800: #0d1410;
  --ink-750: #111a15;
  --ink-700: #16211a;

  --line: #1c271f;
  --line-hi: #2b3d31;

  --green: #34d07a;
  --green-bright: #5ee89a;
  --green-deep: #1a7a48;
  --green-wash: rgba(52, 208, 122, 0.09);
  --green-glow: rgba(52, 208, 122, 0.28);

  --paper: #eaf2ec;
  --paper-dim: #8ea395;
  --paper-faint: #5d6f63;

  --danger: #e5645d;
  --warn: #d8a851;

  /* One grotesque for everything, monospace for figures. The high-contrast Didone that was
     here read as a fashion masthead rather than a financial product. */
  --display: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --ui: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'Consolas', monospace;

  --radius: 4px;
  --radius-lg: 8px;

  --bs-body-bg: var(--ink-900);
  --bs-body-color: var(--paper);
  --bs-border-color: var(--line);
  --bs-primary: var(--green);
  --bs-link-color: var(--green);
  --bs-link-hover-color: var(--green-bright);
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--ink-900);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Engine-turned ground: two offset ring systems plus fine hatching, the way a
   banknote's lathe work reads at a distance. Kept far below text contrast. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    repeating-radial-gradient(circle at 18% -10%,
      transparent 0 38px, rgba(52, 208, 122, 0.028) 38px 39px),
    repeating-radial-gradient(circle at 88% 8%,
      transparent 0 46px, rgba(52, 208, 122, 0.022) 46px 47px),
    repeating-linear-gradient(58deg,
      transparent 0 7px, rgba(234, 242, 236, 0.011) 7px 8px);
}

/* Grain. Stops the flat fields from reading as plastic. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

main { flex: 1 0 auto; }

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

h1, h2, h3, .display-type {
  font-family: var(--display);
  font-weight: 700;
  /* Large sans text needs the tracking pulled in or it reads loose and soft. */
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--paper);
}

h1 { font-size: clamp(2.3rem, 5.4vw, 4.1rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -0.025em; }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); letter-spacing: -0.015em; font-weight: 600; }

h4, h5, h6, .ui-heading {
  font-family: var(--ui);
  font-weight: 600;
  letter-spacing: 0.005em;
}

/* Small caps rules, used as section markers. */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-hi), transparent);
}

.lede {
  font-size: clamp(1.02rem, 1.5vw, 1.2rem);
  color: var(--paper-dim);
  max-width: 56ch;
}

.muted { color: var(--paper-dim); }
.faint { color: var(--paper-faint); }

/* Every number in the product is monospace and tabular so digits sit in
   columns and a changing countdown does not jitter. */
.num, .amount, td.num, .countdown {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
  letter-spacing: -0.01em;
}

.amount { font-weight: 600; color: var(--paper); }
.amount .unit { color: var(--paper-faint); font-weight: 400; font-size: 0.82em; margin-left: 0.3em; }
.amount.positive { color: var(--green); }

.addr {
  font-family: var(--mono);
  font-size: 0.84rem;
  word-break: break-all;
  color: var(--paper-dim);
}

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

.shell { width: min(1180px, 100% - 3rem); margin-inline: auto; }
.shell-narrow { width: min(760px, 100% - 3rem); margin-inline: auto; }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

.section { padding: clamp(3.5rem, 9vw, 7rem) 0; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--ink-900) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.95rem 0;
}

.brand {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--paper);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand:hover { color: var(--paper); }

.brand-mark {
  width: 22px;
  height: 22px;
  border: 1px solid var(--green);
  border-radius: 50%;
  position: relative;
  flex: none;
}

.brand-mark::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid var(--green-deep);
  border-radius: 50%;
}

/* The hand of the clock, fixed at the hour that never comes. */
.brand-mark::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 7px;
  background: var(--green);
  transform-origin: top center;
  transform: translate(-50%, 0) rotate(38deg);
}

/* Price and clock. Secondary information, so it sits between the brand and the nav at a
   deliberately quiet weight. */
.ticker {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-right: auto;
  padding-left: 1.75rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  color: var(--paper-dim);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ticker-item { display: inline-flex; align-items: baseline; gap: 0.45rem; }

.ticker-zone {
  color: var(--paper-faint);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.ticker-link { text-decoration: none; color: inherit; transition: color 0.16s ease; }
.ticker-link:hover { color: var(--green); }
.ticker-link:hover .ticker-zone { color: var(--green-deep); }

.ticker-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 3.2s ease-in-out infinite;
}

@media (max-width: 900px) {
  .ticker { display: none; }
}

.nav-links { display: flex; align-items: center; gap: 1.75rem; }

.nav-links a {
  font-size: 0.875rem;
  color: var(--paper-dim);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.18s ease;
}

.nav-links a:hover { color: var(--paper); }
.nav-links a.active { color: var(--green); }

/* Buttons in the header keep their own colour.
   ".nav-links a" is more specific than ".btn-mint" below, so without this the muted link grey
   repaints every button in the header — which left "Open an account" at #8ea395 on #34d07a,
   two mid-tone greens about 1.4:1 apart and close to illegible. These restate the button
   colours at a specificity that wins, hover included. */
.nav-links a.btn { color: var(--paper); }
.nav-links a.btn-ghost, .nav-links a.btn-ghost:hover { color: var(--paper); }
.nav-links a.btn-quiet { color: var(--paper-dim); }
.nav-links a.btn-quiet:hover { color: var(--paper); }
.nav-links a.btn-mint, .nav-links a.btn-mint:hover { color: var(--ink-900); }

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

.btn {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  border-radius: var(--radius);
  padding: 0.7rem 1.5rem;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.btn-mint {
  background: var(--green);
  color: var(--ink-900);
  border-color: var(--green);
}

.btn-mint:hover {
  background: var(--green-bright);
  border-color: var(--green-bright);
  color: var(--ink-900);
  box-shadow: 0 0 0 1px var(--green-glow), 0 8px 28px -10px var(--green-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--line-hi);
}

.btn-ghost:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-wash);
}

.btn-quiet {
  background: transparent;
  color: var(--paper-dim);
  border-color: transparent;
  padding-inline: 0.5rem;
}

.btn-quiet:hover { color: var(--paper); }

.btn-lg { padding: 0.95rem 2rem; font-size: 0.98rem; }

/* ---------- Panels ---------- */

.panel {
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
}

.panel-quiet { background: var(--ink-850); }

.panel-inset {
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

/* Corner ticks. A drawn instrument bezel rather than a rounded box. */
.panel-ticked::before,
.panel-ticked::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: var(--green-deep);
  border-style: solid;
  opacity: 0.75;
}

.panel-ticked::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.panel-ticked::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* ---------- Stat tiles ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stat {
  background: var(--ink-800);
  padding: 1.4rem 1.5rem;
}

.stat-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  margin-bottom: 0.55rem;
}

.stat-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--paper);
  line-height: 1.15;
}

.stat-value.accent { color: var(--green); }
.stat-sub { font-size: 0.78rem; color: var(--paper-faint); margin-top: 0.3rem; }

/* ---------- Guilloché seal ---------- */

.seal {
  position: relative;
  width: min(360px, 76vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: none;
}

.seal-rings {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%,
      transparent 0 5px, rgba(52, 208, 122, 0.14) 5px 6px);
  mask-image: radial-gradient(circle at 50% 50%, #000 38%, transparent 71%);
  animation: seal-spin 90s linear infinite;
}

.seal-rings.offset {
  background:
    repeating-radial-gradient(circle at 44% 56%,
      transparent 0 7px, rgba(52, 208, 122, 0.1) 7px 8px);
  animation-duration: 130s;
  animation-direction: reverse;
}

@keyframes seal-spin { to { transform: rotate(360deg); } }

.seal-bezel {
  position: absolute;
  inset: 6%;
  border: 1px solid var(--line-hi);
  border-radius: 50%;
}

.seal-bezel::before {
  content: '';
  position: absolute;
  inset: 7%;
  border: 1px solid var(--green-deep);
  border-radius: 50%;
  opacity: 0.55;
}

.seal-core { position: relative; text-align: center; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .seal-rings { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Countdown ---------- */

.countdown {
  display: flex;
  gap: 0.15rem;
  align-items: baseline;
  justify-content: center;
  font-weight: 600;
  color: var(--paper);
}

.countdown-unit { display: flex; flex-direction: column; align-items: center; min-width: 3.1rem; }
.countdown-num { font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1; }
.countdown-sep { font-size: clamp(1.2rem, 3vw, 1.8rem); color: var(--paper-faint); padding-inline: 0.1rem; }

.countdown-tag {
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-faint);
  margin-top: 0.5rem;
  font-weight: 400;
}

.countdown.is-elapsed .countdown-num { color: var(--green); }

/* ---------- Status pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  border: 1px solid var(--line-hi);
  color: var(--paper-dim);
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill.is-locked { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); background: var(--green-wash); }
.pill.is-waiting { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.pill.is-done { color: var(--paper-dim); }
.pill.is-alert { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

/* A locked transfer pulses, so the state reads at a glance in a list. */
.pill.is-locked::before { animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

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

.form-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 0.5rem;
}

.form-control, .form-select {
  background: var(--ink-900);
  border: 1px solid var(--line-hi);
  border-radius: var(--radius);
  color: var(--paper);
  padding: 0.75rem 0.95rem;
  font-family: var(--ui);
  font-size: 0.95rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-control:focus, .form-select:focus {
  background: var(--ink-900);
  border-color: var(--green);
  color: var(--paper);
  box-shadow: 0 0 0 3px var(--green-wash);
  outline: none;
}

.form-control::placeholder { color: var(--paper-faint); }
.form-control.mono, input.mono { font-family: var(--mono); font-size: 0.88rem; }

.form-text { color: var(--paper-faint); font-size: 0.8rem; }

/* One-click durations. Most people want a round number of months or years. */
.preset-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.preset {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--line-hi);
  background: transparent;
  color: var(--paper-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset:hover { border-color: var(--green); color: var(--green); background: var(--green-wash); }

.preset.is-active {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-900);
  font-weight: 600;
}

/* Tip chips: radios that look like the duration presets, so the two rows read alike. */
.tip-option { display: inline-flex; align-items: center; gap: .45rem; user-select: none; }
.tip-option input { accent-color: var(--green); margin: 0; }
.tip-option:has(input:checked) {
  background: var(--green);
  border-color: var(--green);
  color: var(--ink-900);
  font-weight: 600;
}
.tip-option:has(input:checked) input { accent-color: var(--ink-900); }

.tip-custom {
  display: none;
  align-items: center;
  gap: .6rem;
  margin-top: .75rem;
}

.tip-custom.is-shown { display: flex; }

/* Make the native pickers legible on a dark ground. */
input[type="date"], input[type="time"], select { color-scheme: dark; }

.picker-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1.1fr;
  gap: 0.6rem;
}

/* Labels sit above their control, not below it. */
.picker-label {
  margin-bottom: 0.3rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.64rem;
}

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

.field-error { color: var(--danger); font-size: 0.82rem; margin-top: 0.4rem; display: block; }

/* ---------- Tables ---------- */

.ledger { width: 100%; border-collapse: collapse; }

.ledger th {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.ledger td {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.92rem;
}

.ledger tbody tr { transition: background 0.14s ease; }
.ledger tbody tr:hover { background: var(--ink-800); }
.ledger .right { text-align: right; }

.table-scroll { overflow-x: auto; }

/* ---------- Timeline ---------- */

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line-hi);
}

.timeline li { position: relative; padding: 0 0 1.15rem 1.85rem; }

.timeline li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--line-hi);
  background: var(--ink-900);
}

.timeline li.done::before { border-color: var(--green); background: var(--green); }
.timeline li.current::before { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-wash); }

.timeline-when {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--paper-faint);
  letter-spacing: 0.04em;
}

/* ---------- Deposit address block ---------- */

.deposit-addr {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--ink-900);
  border: 1px dashed var(--line-hi);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.deposit-addr code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
  word-break: break-all;
  flex: 1;
}

.qr-frame {
  background: var(--paper);
  padding: 0.85rem;
  border-radius: var(--radius);
  line-height: 0;
  display: inline-block;
}

.qr-frame img, .qr-frame svg { display: block; width: 100%; height: auto; max-width: 210px; }

/* ---------- Alerts ---------- */

.notice {
  border: 1px solid var(--line-hi);
  border-left: 2px solid var(--green);
  background: var(--ink-800);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  font-size: 0.9rem;
  color: var(--paper-dim);
}

.notice strong { color: var(--paper); font-weight: 600; }
.notice.warn { border-left-color: var(--warn); }
.notice.bad { border-left-color: var(--danger); }

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
  margin-top: 4rem;
  font-size: 0.83rem;
  color: var(--paper-faint);
}

.site-footer a { color: var(--paper-dim); text-decoration: none; }
.site-footer a:hover { color: var(--green); }

/* ---------- Entrance choreography ---------- */

.rise { animation: rise 0.75s cubic-bezier(0.2, 0.7, 0.25, 1) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.d1 { animation-delay: 0.06s; }
.d2 { animation-delay: 0.14s; }
.d3 { animation-delay: 0.22s; }
.d4 { animation-delay: 0.3s; }
.d5 { animation-delay: 0.38s; }

@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
}

/* ---------- Utility ---------- */

.stack > * + * { margin-top: var(--stack-gap, 1rem); }
.hairline-top { border-top: 1px solid var(--line); }
.text-green { color: var(--green); }
.copy-btn { cursor: pointer; }

::selection { background: var(--green); color: var(--ink-900); }

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