/* MatchAPI website — screen and A5 print styles */
:root {
  --ink: #1f2933;
  --muted: #5f6b7a;
  --line: #d9d2c5;
  --paper: #fffdf7;
  --bg: #f6f2ea;
  --accent: #b44d12;
  --accent-ink: #ffffff;
  --head: #f3ece0;
  --ok: #1f7a4d;
  --warn: #9a6a00;
  --bad: #b3261e;
  --radius: 8px;
  --font: "Noto Sans", "Noto Sans Tamil", "Noto Sans Telugu", "Noto Sans Malayalam", "Noto Sans Kannada",
          "Noto Sans Devanagari", "Nirmala UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece6dc; --muted: #b0a89c; --line: #4a443c; --paper: #24211d; --bg: #1a1815;
    --head: #2e2a24; --accent: #e08a4f; --accent-ink: #1a1815;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--accent); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 6px 10px; z-index: 10; }
.small { font-size: .85rem; color: var(--muted); }
.hint { font-size: .85rem; color: var(--muted); margin: .25rem 0 0; }

/* header / footer */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px;
  background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.site-head nav { display: flex; gap: 16px; }
.site-head nav a { color: var(--ink); text-decoration: none; padding: 4px 2px; border-bottom: 2px solid transparent; }
.site-head nav a[aria-current="page"], .site-head nav a:hover { border-bottom-color: var(--accent); }
.site-foot { padding: 20px 16px 32px; text-align: center; color: var(--muted); font-size: .9rem; }
.site-foot p { margin: .3rem 0; }

/* layout + ad slots (fixed sizes so pages don't jump) */
.page { max-width: 1180px; margin: 0 auto; padding: 16px; }
.page.with-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 1100px) { .page.with-side { grid-template-columns: minmax(0, 1fr) 300px; } }
.ad { margin: 12px auto; text-align: center; overflow: hidden; }
.ad-top, .ad-bottom { max-width: 970px; min-height: 90px; padding: 0 16px; }
.ad-side { display: none; width: 300px; min-height: 600px; position: sticky; top: 16px; align-self: start; }
@media (min-width: 1100px) { .ad-side { display: block; } }
.ad-side
/* home */
.hero h1 { margin: .5rem 0; font-size: 1.8rem; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 16px; }
.card { display: block; padding: 20px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card h2 { margin: 0 0 .4rem; color: var(--accent); }
.roadmap { list-style: none; padding: 0; }
.roadmap .card:hover { border-color: var(--line); }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; margin-bottom: .5rem; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); }

/* forms */
h1 { font-size: 1.6rem; margin: .4rem 0; }
.lead { color: var(--muted); margin-top: 0; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  padding: 12px 16px 16px; margin: 0 0 16px; min-width: 0; }
.form legend { font-weight: 700; padding: 0 6px; }
.field { margin: 10px 0; min-width: 0; }
.field label, .field .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
input[type=text], input[type=date], input[type=time], input[type=number], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; min-height: 40px; }
input:focus, select:focus, .rte-area:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: .88rem; margin: .25rem 0 0; }
.row2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
.row4 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .row2 { grid-template-columns: 1fr 1fr; } .row4 { grid-template-columns: repeat(4, 1fr); } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.check { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.check-wrap { display: inline-flex; align-items: center; gap: 4px; }
.label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.label-row label { margin-bottom: 0; }
/* info popovers */
.tip { position: relative; display: inline-flex; }
.tip-btn { width: 20px; height: 20px; min-width: 0; padding: 0; border-radius: 50%; font: italic 700 12px/18px Georgia, serif;
  color: var(--accent); background: var(--paper); border: 1px solid var(--accent); cursor: help; }
.tip-box { position: absolute; z-index: 25; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: min(320px, 80vw); padding: 10px 12px; background: var(--ink); color: var(--paper); border-radius: 6px;
  font-size: .85rem; font-weight: normal; line-height: 1.45; box-shadow: 0 6px 18px rgba(0,0,0,.2);
  visibility: hidden; opacity: 0; transition: opacity .12s; }
.tip-box a { color: inherit; text-decoration: underline; }
.tip:hover .tip-box, .tip:focus-within .tip-box, .tip.open .tip-box { visibility: visible; opacity: 1; }
@media (max-width: 640px) {
  .tip-box { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; transform: none; }
}
button, .toolbar a { font: inherit; border-radius: 6px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.linkish { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }
.banner { border: 1px solid var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--paper));
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }
.banner p { margin: .2rem 0; }
.pair-form { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 16px; }
@media (min-width: 820px) { .pair-form { grid-template-columns: 1fr 1fr; } }
.pair-form fieldset { margin: 0; }
.bride legend::before { content: "♀ "; color: var(--accent); }
.groom legend::before { content: "♂ "; color: var(--accent); }

/* place search */
.place-box { position: relative; }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px 0;
  list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 280px; overflow: auto; }
.suggest li { padding: 8px 12px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--head); }
.suggest .sub { color: var(--muted); font-size: .85rem; }
.coords { margin-left: 8px; }
.map { height: 320px; margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; }

/* rich text */
.rte { border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.rte-bar { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rte-bar button { padding: 4px 10px; min-width: 36px; }
.rte-area { min-height: 140px; padding: 10px; }
.rte-area:empty::before { content: "Write about the person, family, expectations…"; color: var(--muted); }

/* result toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 4px 0 16px; }

/* ---------------- printable sheets (A5 = 148 × 210 mm) ---------------- */
.sheets { display: flex; flex-direction: column; align-items: center; gap: 20px; overflow-x: auto; }
.sheet { width: 148mm; min-height: 210mm; padding: 8mm; background: #fff; color: #1f2933;
  box-shadow: 0 2px 12px rgba(0,0,0,.15); display: flex; flex-direction: column; font-size: 9pt; line-height: 1.35; }
.sheet h2 { margin: 0; font-size: 14pt; }
.sheet h3 { margin: 0 0 2mm; font-size: 10pt; color: #b44d12; border-bottom: 0.3mm solid #e4dccd; padding-bottom: 1mm; }
.sheet-head { text-align: center; margin-bottom: 4mm; }
.sheet-head p { margin: 1mm 0 0; color: #5f6b7a; }
.sheet-head.small h2 { font-size: 11pt; }
.sheet .block { margin-bottom: 3mm; }
.sheet .block table, .sheet .verdict { break-inside: avoid; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 600; width: 38%; padding: 0.8mm 2mm 0.8mm 0; vertical-align: top; color: #3e4a57; }
.kv td { padding: 0.8mm 0; }
.about { overflow-wrap: anywhere; }
.about p { margin: 0 0 1.5mm; }
.grid { width: 100%; border-collapse: collapse; font-size: 8pt; line-height: 1.2; }
.grid td.small { font-size: 6.5pt; color: #5f6b7a; }
.grid th, .grid td { border: 0.2mm solid #e4dccd; padding: 0.6mm 1.5mm; text-align: left; vertical-align: top; }
.grid thead th, .grid tfoot th, .grid tfoot td { background: #f3ece0; }
.grid .num { text-align: right; white-space: nowrap; }
.note { color: #5f6b7a; font-size: 7pt; }
.st-MATCH { color: #1f7a4d; font-weight: 600; }
.st-PARTIAL { color: #9a6a00; font-weight: 600; }
.st-NO_MATCH { color: #b3261e; font-weight: 600; }
.verdict { margin: 1.5mm 0; }
.v-REJECTED b, .v-ADHAMAM b { color: #b3261e; }
.v-UTTAMAM b, .v-ATI_UTTAMAM b { color: #1f7a4d; }
.v-MADHYAMAM b { color: #9a6a00; }
.sheet figure { margin: 0; }
.sheet svg { display: block; width: 100%; height: auto; }
.charts .grids { display: flex; flex-direction: column; align-items: center; gap: 4mm; }
.charts .chart { width: 84mm; }
/* single-page horoscope: details in two columns, Rasi + Navamsa side by side */
.single { font-size: 8pt; }
.single .sheet-head { margin-bottom: 2.5mm; }
.single .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.single .block { margin-bottom: 2.2mm; }
.single h3 { font-size: 8.5pt; margin-bottom: 1mm; }
.single .kv th { width: 42%; padding: 0.5mm 1.5mm 0.5mm 0; }
.single .kv td { padding: 0.5mm 0; }
.single .about { font-size: 7.5pt; }
.single .grids { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; margin-top: 1mm; break-inside: avoid; }
.single .grids.n1 { grid-template-columns: 1fr; justify-items: center; }
.single .grids.n1 .chart { width: 64mm; }
.kp { width: 100%; }
.kp-sheet .kp { width: 100%; }
/* matching: one grid for both people — label | value | label | value — so rows and charts line up */
.pair { display: grid; grid-template-columns: auto 1fr auto 1fr; column-gap: 2mm; row-gap: 0.8mm;
  font-size: 8pt; align-items: start; }
.pair .who, .pair .chart { grid-column: span 2; }
.pair .k { font-weight: 600; color: #3e4a57; }
.pair .k.g { padding-left: 3mm; }
.pair .v { overflow-wrap: anywhere; }
.pair .chart { margin-top: 3mm; }
.person .role { margin: 0; font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #b44d12; }
.person h3 { color: #1f2933; border: 0; margin: 0 0 1.5mm; font-size: 11pt; }
.pair .chart.groom { margin-left: 3mm; width: calc(100% - 3mm); }
.sheet .small { font-size: 7.5pt; }
.sheet-foot { margin-top: auto; padding-top: 3mm; border-top: 0.3mm solid #e4dccd; font-size: 6.5pt; color: #5f6b7a; }
.sheet-foot p { margin: 0.4mm 0; }

/* consent */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 640px; margin: 0 auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.2); display: flex; gap: 12px; align-items: center; z-index: 30; }
.consent[hidden] { display: none; }
.consent p { margin: 0; font-size: .9rem; }

/* credits/prose */
.credits td, .credits th { font-size: .9rem; }
main ul { padding-left: 1.2rem; }

/* ---------------- print ---------------- */
@page { size: A5 portrait; margin: 8mm; }
@media print {
  html, body { background: #fff; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print, .site-head, .site-foot, .consent, .toolbar, .skip, .ad { display: none !important; }
  .page { max-width: none; padding: 0; display: block; }
  .sheets { display: block; overflow: visible; }
  .sheet { width: auto; min-height: calc(210mm - 16mm); padding: 0; box-shadow: none; break-after: page; }
  .sheet:last-child { break-after: auto; }
}

/* Learn articles */
.article { max-width: 760px; }
.article h2 { margin-top: 1.6rem; font-size: 1.25rem; }
.article .grid { font-size: .95rem; line-height: 1.4; margin: 1rem 0; }
.article .grid th, .article .grid td { padding: 6px 8px; border-color: var(--line); }
.article .grid thead th { background: var(--head); }
.crumb { margin: 0; font-size: .9rem; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 1.5rem 0 .5rem; }
a.button { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); text-decoration: none; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
