/* Remanso (light) and Sonar (dark), mirrored from packages/ui/src/tokens.ts */
:root {
  color-scheme: light dark;
  --bg: #f4f7f5;
  --card: #ffffff;
  --fg: #0e2621;
  --muted: #4a5f58;
  --line: #d6e2dd;
  --action: #0b5a4c;
  --on-action: #ffffff;
  --signal: #f07a2a;
  --on-signal: #0e2621;
  --water: #8cc6ba;
  --leader: #c2500c;
  --alert-bg: #fff0df;
  --alert-fg: #6e3406;
  --focus: #0b5a4c;

  --brand-green: #0b5a4c;
  --brand-orange: #f07a2a;
  --brand-paper: #f4f7f5;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --title-transform: none;
  --title-tracking: -0.02em;

  --font-display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(16px, 5vw, 48px);
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07121b;
    --card: #0e1d2a;
    --fg: #e3eef5;
    --muted: #8fa6b6;
    --line: #1c3246;
    --action: #21d4c4;
    --on-action: #031f1c;
    --signal: #ffb21e;
    --on-signal: #1f1400;
    --water: #10354f;
    --leader: #ffb21e;
    --alert-bg: #2b1e05;
    --alert-fg: #ffd07a;
    --focus: #ffb21e;

    --r-sm: 2px;
    --r-md: 4px;
    --r-lg: 6px;
    --r-pill: 3px;
    --title-transform: uppercase;
    --title-tracking: 0.01em;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: var(--title-tracking);
  text-transform: var(--title-transform);
  margin: 0;
  font-optical-sizing: auto;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--action);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--signal);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip {
  position: absolute;
  left: 12px;
  top: -100px;
  background: var(--action);
  color: var(--on-action);
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  z-index: 10;
}

.skip:focus {
  top: 12px;
}

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

/* Header */
.site-header {
  padding: 20px 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-block;
  line-height: 0;
  border-radius: var(--r-sm);
}

.brand img {
  width: 200px;
  height: auto;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--r-sm);
}

.header-nav a:hover {
  color: var(--action);
}

.header-nav a[aria-current="page"] {
  color: var(--action);
  text-decoration: underline;
  text-decoration-color: var(--signal);
}

/* Hero */
.hero {
  padding: clamp(24px, 6vw, 72px) 0 clamp(48px, 8vw, 96px);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-orange);
  flex: none;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.75rem);
}

.hero h1 em {
  font-style: normal;
  color: var(--action);
}

.lede {
  margin-top: 24px;
  font-size: clamp(1.125rem, 2.2vw, 1.3125rem);
  max-width: 34em;
}

.lede strong {
  font-weight: 600;
}

.soon {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 18px;
  line-height: 1.3;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--r-pill);
  font-weight: 600;
}

.soon-badge .dot {
  background: var(--brand-orange);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-orange) 30%, transparent);
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.social a:hover {
  border-color: var(--action);
}

.social span {
  color: var(--muted);
  font-weight: 400;
}

/* Example card: the Hoje screen */
.reading {
  margin: 0;
  display: grid;
  gap: 16px;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: 0 1px 0 var(--line), 0 24px 48px -32px rgba(14, 38, 33, 0.35);
}

.reading-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.tag {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.6;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--alert-bg);
  color: var(--alert-fg);
  white-space: nowrap;
}

.reading-q {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.1;
  text-transform: var(--title-transform);
  letter-spacing: var(--title-tracking);
}

.score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.score-n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4rem;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.score-of {
  color: var(--muted);
  font-weight: 600;
}

.trend {
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 2px 12px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--action) 14%, transparent);
  color: var(--action);
}

.meter {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}

.meter i {
  display: block;
  width: calc(var(--v) * 1%);
  height: 100%;
  background: var(--action);
  border-radius: inherit;
}

.palpite {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--alert-bg);
  color: var(--alert-fg);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.palpite svg,
.rules svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.basis {
  font-size: 0.875rem;
  color: var(--muted);
}

.readings {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.readings div {
  background: var(--card);
  padding: 12px 14px;
  min-width: 0;
}

.readings dt {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}

.readings dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.readings dd small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
}

.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
}

.week .day {
  display: grid;
  gap: 4px;
  justify-items: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

.week .col {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: flex-end;
}

.week .bar {
  display: block;
  width: 100%;
  height: calc(var(--v) * 1%);
  background: var(--action);
  border-radius: calc(var(--r-sm) / 2) calc(var(--r-sm) / 2) 0 0;
}

.week .part .bar,
.stripe-key {
  background: repeating-linear-gradient(135deg, var(--action) 0 3px, transparent 3px 7px);
  box-shadow: inset 0 0 0 1.5px var(--action);
}

.week .num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.week .today {
  color: var(--fg);
  font-weight: 600;
}

.week-cap {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.stripe-key {
  display: inline-block;
  width: 14px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border-radius: calc(var(--r-sm) / 4);
}

.rules {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted);
}

.rules b {
  color: var(--fg);
  font-weight: 600;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Rose section */
.rose {
  background: var(--brand-green);
  color: var(--brand-paper);
  padding: clamp(56px, 9vw, 112px) 0;
}

.rose .wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.rose-art {
  aspect-ratio: 1;
  width: 100%;
  max-width: 440px;
  justify-self: center;
}

.rose h2 {
  font-size: clamp(2rem, 4.5vw, 3rem);
}

.rose-intro {
  margin-top: 16px;
  max-width: 32em;
  color: #d2e5de;
}

.points {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.points li {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(140, 198, 186, 0.35);
}

.points li:last-child {
  border-bottom: 1px solid rgba(140, 198, 186, 0.35);
}

.points b {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  align-self: start;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.3;
  color: #ffffff;
}

.points .pt {
  width: 22px;
  height: 22px;
  flex: none;
}

.points span {
  color: #d2e5de;
}

/* Score with the math shown */
.count {
  padding: clamp(56px, 9vw, 112px) 0;
}

.count .wrap,
.knots .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.count h2,
.knots h2 {
  font-size: clamp(2rem, 4.5vw, 3rem);
}

.count-copy > p,
.knots-copy > p:not(.tag) {
  margin-top: 16px;
  max-width: 32em;
}

.count-copy > p + p,
.knots-copy > p + p {
  color: var(--muted);
}

.receipt {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px 16px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.receipt-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--fg);
}

.receipt-head strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.125rem;
  line-height: 1.2;
  text-transform: var(--title-transform);
  letter-spacing: var(--title-tracking);
}

.receipt ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.receipt li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.receipt li span:last-child {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
}

.receipt li.plus span:last-child {
  color: var(--action);
}

.receipt li.out {
  color: var(--muted);
}

.receipt li.out span:last-child {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
}

.receipt li.total {
  border-bottom: 0;
  border-top: 2px solid var(--fg);
  margin-top: -1px;
  font-weight: 600;
}

.receipt li.total span:last-child {
  font-size: 1.5rem;
}

.receipt .palpite {
  margin-top: 6px;
}

/* 3D knots, coming soon */
.knots {
  padding: 0 0 clamp(56px, 9vw, 112px);
}

.knots .tag {
  margin-bottom: 14px;
}

.knot-art {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 20px 16px;
}

.knot-art svg {
  width: 100%;
  height: auto;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knot-line {
  stroke: var(--action);
  stroke-width: 4;
}

.knot-back {
  stroke: var(--action);
  stroke-width: 3;
  opacity: 0.4;
}

.knot-gap {
  stroke: var(--card);
  stroke-width: 10;
}

.knot-leader {
  stroke: var(--leader);
  stroke-width: 5;
}

.knot-metal {
  stroke: var(--muted);
  stroke-width: 4;
}

.knot-art figcaption {
  margin-top: 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Closing */
.end {
  padding: 0 0 clamp(56px, 8vw, 96px);
}

.end .wrap > div {
  border-top: 1px solid var(--line);
  padding-top: 32px;
}

.end h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.end h2 + p {
  margin-top: 8px;
  color: var(--muted);
}

.end .soon {
  margin-top: 20px;
}

/* Text pages */
.page {
  padding: clamp(24px, 5vw, 56px) 0 clamp(56px, 8vw, 96px);
}

.page .wrap > * {
  max-width: 760px;
}

.page h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
}

.page .lede {
  margin-top: 16px;
  color: var(--muted);
}

.prose {
  margin-top: 40px;
}

.prose h2 {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  margin: 40px 0 12px;
}

.prose h3 {
  font-size: 1.1875rem;
  margin: 28px 0 8px;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: 6px;
}

.notice {
  margin-top: 32px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--alert-bg);
  color: var(--alert-fg);
  border-radius: var(--r-md);
  padding: 18px 20px;
}

.notice .dot {
  margin-top: 8px;
}

.notice strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  text-transform: var(--title-transform);
}

.contact {
  margin-top: 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
}

.contact h2 {
  font-size: 1.375rem;
}

.contact .email {
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.25rem, 4vw, 1.625rem);
  color: var(--action);
  overflow-wrap: anywhere;
  user-select: all;
}

.contact p + p {
  margin-top: 8px;
  color: var(--muted);
}

.faq {
  margin-top: 48px;
}

.faq > h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-bottom: 16px;
}

.faq details {
  border-top: 1px solid var(--line);
}

.faq details:last-of-type {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 12px 0;
  font-weight: 600;
  font-size: 1.0625rem;
}

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

.faq summary::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border-right: 3px solid var(--action);
  border-bottom: 3px solid var(--action);
  transform: rotate(45deg) translate(-3px, -3px);
  transition: transform 0.15s ease;
}

.faq details[open] summary::after {
  transform: rotate(-135deg) translate(-3px, -3px);
}

.faq details p {
  padding: 0 0 18px;
  max-width: 40em;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
  font-size: 0.9375rem;
  color: var(--muted);
}

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

.footer-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-mark img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 4px;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 10px;
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--action);
  text-decoration: underline;
}

@media (max-width: 860px) {
  .hero .wrap,
  .rose .wrap,
  .count .wrap,
  .knots .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .rose-art {
    max-width: 320px;
  }
}

@media (max-width: 480px) {
  .brand img {
    width: 136px;
  }

  .header-nav a {
    padding: 0 8px;
  }

  .reading {
    padding: 18px;
  }

  .score-n {
    font-size: 3.5rem;
  }

  .readings div {
    padding: 10px 12px;
  }

  .week {
    gap: 4px;
  }

  .receipt {
    padding: 16px 16px 14px;
  }

  .receipt li {
    gap: 12px;
  }

  .knot-art {
    padding: 14px 14px 12px;
  }

  .soon-badge {
    border-radius: var(--r-md);
  }

  .points li {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .site-footer a {
    padding: 0 8px;
  }
}

@media (forced-colors: active) {
  .week .bar,
  .meter i {
    background: CanvasText;
  }

  .week .part .bar,
  .stripe-key {
    background: Canvas;
    border: 2px dashed CanvasText;
  }
}

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