/* WHVease v0.2 — designer-grade polish on top of Pico v2 classless */

/* -------------------------------------------------------------------
   Brand tokens — emerald teal + supporting greys
   ------------------------------------------------------------------- */
[data-theme=light],
:root:not([data-theme=dark]) {
  --pico-primary: #0d9488;
  --pico-primary-background: #0d9488;
  --pico-primary-border: #0d9488;
  --pico-primary-underline: #0d9488;
  --pico-primary-hover: #0f766e;
  --pico-primary-hover-background: #0f766e;
  --pico-primary-hover-border: #0f766e;
  --pico-primary-hover-underline: #0f766e;
  --pico-primary-focus: rgba(13, 148, 136, 0.25);
  --pico-primary-inverse: #ffffff;
  --pico-form-element-spacing-vertical: 0.7rem;
  --pico-form-element-spacing-horizontal: 0.9rem;
  --pico-border-radius: 0.5rem;

  /* Semantic surface tokens — used by cards / strips / banners */
  --whv-surface-raised: #ffffff;
  --whv-surface-soft:   #f8fafc;
  --whv-surface-mist:   #f1f5f9;
  --whv-border-soft:    #e2e8f0;
  --whv-text-muted:     #64748b;
  --whv-text-mute-2:    #94a3b8;

  /* Brand emerald scale (derived from #0d9488) */
  --whv-emerald-50:     #ecfdf5;
  --whv-emerald-100:    #d1fae5;
  --whv-emerald-200:    #a7f3d0;
  --whv-emerald-700:    #0f766e;
  --whv-emerald-900:    #134e4a;

  /* Shadow scale */
  --whv-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --whv-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --whv-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --whv-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.05);
  --whv-shadow-popular: 0 12px 32px rgba(13, 148, 136, 0.18), 0 2px 6px rgba(13, 148, 136, 0.10);

  /* Motion */
  --whv-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* -------------------------------------------------------------------
   Layout shell
   ------------------------------------------------------------------- */
body {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
  background: var(--whv-surface-soft);
  color: #0f172a;
}

header {
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
}
header nav { padding: 0.5rem 0; }
header .brand {
  font-weight: 700;
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: #0f172a;
}
header .brand:hover { color: var(--pico-primary); }

main {
  padding: 1.75rem 0 4rem;
}

footer {
  padding: 3rem 0 4rem;
  text-align: center;
  color: var(--whv-text-muted);
  border-top: 1px solid var(--whv-border-soft);
  margin-top: 3rem;
}
footer small { font-size: 0.85rem; }
footer a { color: var(--whv-text-muted); }

/* -------------------------------------------------------------------
   Typography rhythm
   ------------------------------------------------------------------- */
h1 {
  letter-spacing: -0.025em;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.6em;
}
h2 {
  letter-spacing: -0.015em;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0;
  margin-bottom: 0.6em;
}
h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
p { line-height: 1.65; }
section + section { margin-top: 3rem; }

/* -------------------------------------------------------------------
   Buttons — refined hover + focus
   ------------------------------------------------------------------- */
button, [role="button"], input[type="submit"] {
  transition: transform 120ms var(--whv-ease),
              box-shadow 180ms var(--whv-ease),
              background-color 180ms var(--whv-ease),
              border-color 180ms var(--whv-ease);
}
[role="button"]:not(.secondary):not(.contrast):not(.outline):hover,
button:not(.secondary):not(.contrast):not(.outline):hover {
  transform: translateY(-1px);
  box-shadow: var(--whv-shadow-sm);
}
[role="button"].secondary.outline:hover {
  background: var(--whv-surface-mist);
}

/* -------------------------------------------------------------------
   Hero (home)
   ------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  position: relative;
  border-radius: 1.25rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(13, 148, 136, 0.08), transparent 60%),
    linear-gradient(180deg, var(--whv-emerald-50) 0%, transparent 100%);
  margin-bottom: 2.5rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 2.85rem);
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #0f172a 0%, var(--whv-emerald-900) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--whv-text-muted);
  max-width: 580px;
  margin: 0 auto 1.75rem;
  line-height: 1.55;
}
.hero-cta {
  display: inline-flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-cta [role="button"] { min-width: 140px; }

/* Page-section heading w/ subtle accent */
.section-heading {
  position: relative;
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}
.section-heading::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 2.5rem; height: 3px;
  background: var(--pico-primary);
  border-radius: 2px;
}

/* -------------------------------------------------------------------
   Price ladder (Tier A time-tiered urgency strip)
   ------------------------------------------------------------------- */
.price-ladder-note {
  margin: 0 0 1.5rem 0;
  padding: 0.85rem 1.1rem;
  background: var(--whv-surface-soft, #f8fafc);
  border: 1px solid var(--whv-border-soft);
  border-left: 3px solid var(--pico-primary);
  border-radius: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--whv-text-soft, #475569);
}
.price-ladder-note .ladder-active {
  font-weight: 600;
  color: var(--pico-primary);
}
.price-ladder-note strong {
  color: var(--whv-text-strong, #0f172a);
}

/* -------------------------------------------------------------------
   Plan cards (3-tier A/B/C)
   ------------------------------------------------------------------- */
.plan-cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 2.5rem;
}
.plan-card {
  position: relative;
  padding: 1.75rem 1.5rem 1.5rem;
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  background: var(--whv-surface-raised);
  box-shadow: var(--whv-shadow-xs);
  transition: transform 200ms var(--whv-ease),
              box-shadow 200ms var(--whv-ease),
              border-color 200ms var(--whv-ease);
}
.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--whv-shadow-md);
  border-color: #cbd5e1;
}
.plan-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}
.plan-card .plan-tagline {
  color: var(--whv-text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
  min-height: 1.4em;
}
.plan-card .plan-price {
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--pico-primary);
  margin: 0.75rem 0 1rem;
  line-height: 1.1;
}
.plan-card .plan-price small {
  font-size: 0.85rem;
  color: var(--whv-text-muted);
  font-weight: 400;
  display: inline-block;
  margin-left: 0.25rem;
}
.plan-card .plan-includes {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.25rem;
}
.plan-card .plan-includes li {
  position: relative;
  padding-left: 1.4em;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.plan-card .plan-includes li::before {
  content: "✓";
  position: absolute;
  left: 0; top: 0;
  color: var(--pico-primary);
  font-weight: 700;
}

.plan-popular {
  border: 2px solid var(--pico-primary);
  box-shadow: var(--whv-shadow-popular);
  transform: translateY(-4px);
}
.plan-popular:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(13, 148, 136, 0.22), 0 4px 8px rgba(13, 148, 136, 0.12);
}
.plan-badge {
  position: absolute;
  top: -0.85rem; right: 1.25rem;
  background: var(--pico-primary);
  color: white;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.3);
}

/* -------------------------------------------------------------------
   Free-tier strip (downplayed; secondary path)
   ------------------------------------------------------------------- */
.freebie-strip {
  background: var(--whv-surface-mist);
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
}
.freebie-strip article {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.freebie-strip h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: #334155;
}
.freebie-strip p {
  margin: 0.4rem 0;
  color: #475569;
}

/* -------------------------------------------------------------------
   Three-flow card row (legacy free/paid/onboard layout)
   ------------------------------------------------------------------- */
.flow-cards {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.flow-card {
  padding: 1.4rem;
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  background: var(--whv-surface-raised);
  box-shadow: var(--whv-shadow-xs);
  transition: transform 180ms var(--whv-ease), box-shadow 180ms var(--whv-ease);
}
.flow-card:hover { transform: translateY(-2px); box-shadow: var(--whv-shadow-sm); }
.flow-card h3 { margin-top: 0; }
.flow-card .price { font-size: 1.65rem; font-weight: 700; color: var(--pico-primary); }
.flow-card .price-free { color: var(--whv-text-muted); }

/* -------------------------------------------------------------------
   Flash messages
   ------------------------------------------------------------------- */
.flash {
  padding: 0.95rem 1.1rem;
  margin-bottom: 1.5rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  box-shadow: var(--whv-shadow-xs);
}
.flash-success { background: var(--whv-emerald-50); border-color: var(--whv-emerald-200); color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.flash-warn    { background: #fef3c7; border-color: #fde68a; color: #92400e; }

/* -------------------------------------------------------------------
   License key display
   ------------------------------------------------------------------- */
.license-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, "Cascadia Code", monospace;
  background: var(--whv-surface-mist);
  border: 1px solid var(--whv-border-soft);
  padding: 0.45rem 0.7rem;
  border-radius: 0.4rem;
  letter-spacing: 0.04em;
  user-select: all;
  font-size: 0.92rem;
  color: var(--whv-emerald-900);
}

/* Dashboard tables */
table {
  border-collapse: separate;
  border-spacing: 0;
  background: var(--whv-surface-raised);
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.6rem;
  overflow: hidden;
}
table thead th {
  background: var(--whv-surface-mist);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--whv-text-muted);
  font-weight: 600;
}
table tbody tr { transition: background 120ms var(--whv-ease); }
table tbody tr:hover { background: var(--whv-surface-soft); }

/* -------------------------------------------------------------------
   Crypto checkout
   ------------------------------------------------------------------- */
.chain-picker ul {
  display: flex; flex-wrap: wrap; gap: 0.55rem;
  list-style: none; padding: 0; margin: 1.25rem 0;
}
.chain-picker a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.5rem;
  text-decoration: none;
  background: var(--whv-surface-raised);
  color: #1e293b;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 150ms var(--whv-ease);
}
.chain-picker a:hover {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
  transform: translateY(-1px);
}
.chain-picker a.active {
  background: var(--pico-primary);
  color: white;
  border-color: var(--pico-primary);
  box-shadow: var(--whv-shadow-sm);
}

.checkout-card {
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  padding: 1.75rem;
  background: var(--whv-surface-raised);
  box-shadow: var(--whv-shadow-sm);
}
.address-block { margin: 1.25rem 0; }
.full-addr {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--whv-surface-mist);
  border: 1px solid var(--whv-border-soft);
  padding: 0.55rem 0.8rem;
  border-radius: 0.4rem;
  word-break: break-all;
  user-select: all;
  font-size: 0.88rem;
  color: var(--whv-emerald-900);
}
.copy-btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  margin-left: 0.5rem;
  font-size: 0.85rem;
  vertical-align: middle;
}
.qr-image {
  display: block;
  margin: 1.25rem 0;
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.5rem;
  padding: 0.4rem;
  background: white;
}

/* -------------------------------------------------------------------
   Auth forms (register / login) — centered card layout
   ------------------------------------------------------------------- */
.form-card {
  max-width: 420px;
  margin: 1rem auto 2rem;
  background: var(--whv-surface-raised);
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  padding: 2rem 2rem 1.75rem;
  box-shadow: var(--whv-shadow-sm);
}
.form-card h1 {
  margin-top: 0;
  font-size: 1.6rem;
  text-align: center;
}
.form-card .lede {
  color: var(--whv-text-muted);
  text-align: center;
  margin: -0.25rem 0 1.5rem;
  font-size: 0.95rem;
}
.form-card form label {
  font-size: 0.92rem;
  color: #334155;
  font-weight: 500;
}
.form-card form input,
.form-card form select {
  margin-bottom: 0.85rem;
}
.form-card .footnote {
  text-align: center;
  margin: 1.25rem 0 0;
  color: var(--whv-text-muted);
}
.form-card button[type="submit"] {
  width: 100%;
  margin-top: 0.75rem;
}

/* -------------------------------------------------------------------
   Onboard form — 22-field, 6-fieldset structure
   ------------------------------------------------------------------- */
.onboard-form {
  background: var(--whv-surface-raised);
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  padding: 2rem 2.25rem;
  box-shadow: var(--whv-shadow-sm);
}
.onboard-form fieldset {
  border: none;
  padding: 0;
  margin: 0 0 2rem;
  position: relative;
}
.onboard-form fieldset + fieldset {
  border-top: 1px solid var(--whv-border-soft);
  padding-top: 1.75rem;
}
.onboard-form legend {
  padding: 0;
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.onboard-form legend strong { font-weight: 600; }
.onboard-form fieldset > p {
  color: var(--whv-text-muted);
  font-size: 0.88rem;
  margin: -0.4rem 0 1rem;
  line-height: 1.55;
}
.onboard-form fieldset > p strong { color: var(--whv-emerald-900); }

.onboard-form label {
  display: block;
  font-size: 0.92rem;
  color: #334155;
  font-weight: 500;
  margin-bottom: 0.75rem;
}
.onboard-form input,
.onboard-form select {
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

.onboard-form .submit-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--whv-border-soft);
}
.onboard-form .submit-row button { min-width: 160px; }
.onboard-form .submit-row .submit-note {
  color: var(--whv-text-muted);
  font-size: 0.85rem;
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.onboard-form .error-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.95rem 1.1rem;
  margin: 0 0 1.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  border-radius: 0.5rem;
  color: #991b1b;
  font-size: 0.95rem;
}
.onboard-form .error-banner a {
  color: #991b1b;
  text-decoration: underline;
  font-weight: 600;
}

/* -------------------------------------------------------------------
   Form validation errors (server-rendered inline)
   ------------------------------------------------------------------- */
.field-error {
  display: block;
  color: #b91c1c;
  margin-top: -0.55rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.4;
}
input.invalid-input,
input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 0.15rem rgba(220, 38, 38, 0.18) !important;
}

/* -------------------------------------------------------------------
   Fact strip — for the "我們不碰你的" type lists
   ------------------------------------------------------------------- */
.fact-strip {
  background: var(--whv-surface-raised);
  border: 1px solid var(--whv-border-soft);
  border-left: 4px solid var(--pico-primary);
  padding: 1.5rem 1.75rem;
  border-radius: 0.7rem;
  box-shadow: var(--whv-shadow-xs);
}
.fact-strip h2 { margin-top: 0; }
.fact-strip ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.fact-strip ul li {
  position: relative;
  padding-left: 1.6em;
  margin-bottom: 0.65rem;
  line-height: 1.55;
}
.fact-strip ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--pico-primary);
  font-weight: 700;
}

/* -------------------------------------------------------------------
   Why-this-is-hard explainer block
   ------------------------------------------------------------------- */
.explainer {
  background: var(--whv-surface-raised);
  border: 1px solid var(--whv-border-soft);
  border-radius: 0.85rem;
  padding: 1.75rem 2rem;
  box-shadow: var(--whv-shadow-xs);
}
.explainer p strong { color: var(--whv-emerald-900); }

/* -------------------------------------------------------------------
   Mobile breakpoints
   ------------------------------------------------------------------- */
@media (max-width: 640px) {
  body { padding: 0 1rem; }
  .hero { padding: 2rem 0.5rem 1.5rem; border-radius: 1rem; }
  .hero h1 { font-size: 1.85rem; }
  .plan-cards { gap: 0.85rem; }
  .plan-popular { transform: none; }
  .plan-popular:hover { transform: translateY(-2px); }
  .checkout-card { padding: 1.25rem; }
  .explainer, .fact-strip { padding: 1.25rem 1.4rem; }
  table thead th, table td { font-size: 0.85rem; padding: 0.5rem; }
}

@media (max-width: 480px) {
  header nav ul { font-size: 0.92rem; }
  .hero-cta { flex-direction: column; }
  .hero-cta [role="button"] { width: 100%; min-width: 0; }
}
