/* Sky, the home page: a window onto tonight's sky. The wheel is the hero, the Moon sits in its centre in its real phase, one
   factual line reads the day, the five limbs follow as quiet chips, and everything else waits below, quieter.
   Colours are the theme tokens in site.css only (the Moon's lit surface is the one exception). Classes only: the CSP allows no
   inline styles. */

main:has(> .sky-hero) { max-width: 1280px; }
.nw { white-space: nowrap; }

/* ---- The hero ------------------------------------------------------------------------------------------------------- */
.sky-hero { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 0; padding: 4px 0 8px; text-align: center; }
.sky-intro { display: contents; }
.sky-title { order: 6; margin: 20px 0 0; font: 600 16px/1.35 var(--serif); letter-spacing: .02em; color: var(--ink-2); }
.sky-title em { font-style: normal; color: var(--gold); }
.sky-ctl-row { order: 4; margin: 14px 0 14px; }
.sky-wheel { order: 3; }
.sky-panch { order: 5; }
.sky-day { order: 1; margin: 6px 0 4px; font: 600 24px/1.3 var(--serif); color: var(--ink); text-wrap: balance; }
.sky-sep { color: var(--ink-3); font-weight: 400; }
.sky-moonline { order: 2; margin: 0 0 12px; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sky-panch { width: 100%; max-width: 640px; }
.sky-cap { order: 7; margin: 14px auto 0; max-width: 560px; font-size: 14px; color: var(--ink-3); }

/* Place and time: one control that opens the sheet */
.sky-ctl { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-gold); background: color-mix(in srgb, var(--panel) 85%, transparent); color: var(--ink);
  font: 600 16px/1.2 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: none; }
.sky-ctl svg { color: var(--gold); flex: none; }
/* A long remembered name (a village with its mandal) is cut with an ellipsis rather than pushing the page sideways */
.sky-ctl { max-width: 100%; }
.sky-ctl #sky-when-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sky-ctl .sky-chev { color: var(--ink-3); }
.sky-ctl:hover { border-color: var(--gold); }
.sky-ctl:focus-visible, .sky-chip:focus-visible, .sky-sheet button:focus-visible, .sky-sheet select:focus-visible, .sky-sheet input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* The wheel */
.sky-wheel { position: relative; aspect-ratio: 1; width: 100%; max-width: 600px; container-type: inline-size; }
.sky-wheel svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sk-disc { fill: color-mix(in srgb, var(--panel) 78%, transparent); }
.sk-glow { fill: url(#sk-glow); }
.sk-g0 { stop-color: var(--fill); stop-opacity: .16; }
.sk-g1 { stop-color: var(--fill); stop-opacity: .05; }
.sk-g2 { stop-color: var(--fill); stop-opacity: 0; }
.sk-ring { fill: none; stroke: var(--line); stroke-width: 1.2; }
.sk-inner { stroke-dasharray: 2 5; }
.sk-tick { stroke: var(--line); stroke-width: .8; }
.sk-div { stroke: var(--line); stroke-width: 1.2; }
.sk-nak { fill: var(--ink-3); font: 14px var(--sans); }
.sk-nak.on { fill: var(--gold); font-weight: 700; }
.sk-nak-on { fill: color-mix(in srgb, var(--gold) 20%, transparent); stroke: var(--gold); stroke-width: 1; }
.sk-rashi { fill: var(--ink-2); font: 19px var(--serif); }
.sk-rashi.moon { fill: var(--gold); }
.sk-rashi.lag { fill: var(--saffron); font-weight: 700; }
.sk-lagna { stroke: var(--saffron); stroke-width: 1.6; stroke-dasharray: 5 4; }
.sk-lagna-mark { fill: var(--saffron); }
.sk-spoke { stroke: color-mix(in srgb, var(--gold) 40%, transparent); stroke-width: .9; }
.sk-pl circle { fill: var(--panel-2); stroke: var(--gold); stroke-width: 1.4; }
.sk-pl text { fill: var(--gold-2); font: 20px var(--sans); }
.sk-pl.retro circle { stroke: var(--rose); stroke-dasharray: 3 2; }
/* The wheel is 540 user units wide and drawn 288-600px wide, so its words are sized for the width it is drawn at and stay 14px
   or more on screen. Under 540px the 27 nakshatra numbers are dropped rather than shrunk. */
@container (max-width: 539px) { .sk-nak { display: none; } }
@container (max-width: 397px) { .sk-rashi, .sk-pl text { font-size: 22.5px; } }
@container (max-width: 339px) { .sk-rashi, .sk-pl text { font-size: 26.5px; } }
/* The Moon in its phase */
.sk-moon-halo { fill: url(#sk-mglow); }
.sk-m0 { stop-color: var(--fill); stop-opacity: .22; }
.sk-m1 { stop-color: var(--fill); stop-opacity: 0; }
.sk-moon-dark { fill: color-mix(in srgb, var(--ink) 13%, var(--panel)); }
.sk-moon-lit { fill: #f0c75e; }
.sk-moon-rim { fill: none; stroke: var(--border-gold); stroke-width: 1; }
/* Night: the wheel glows softly, the Moon is pale */
[data-night="on"] .sky-wheel svg { filter: drop-shadow(0 0 26px color-mix(in srgb, var(--gold) 20%, transparent)); }
[data-night="on"] .sk-disc { fill: color-mix(in srgb, var(--panel) 62%, transparent); }
[data-night="on"] .sk-g0 { stop-color: var(--gold-2); stop-opacity: .14; }
[data-night="on"] .sk-g1 { stop-color: var(--gold); stop-opacity: .05; }
[data-night="on"] .sk-outer { stroke: var(--border-gold); }
[data-night="on"] .sk-m0 { stop-color: var(--gold-2); stop-opacity: .30; }
[data-night="on"] .sk-moon-dark { fill: color-mix(in srgb, var(--bg) 65%, var(--line)); }
[data-night="on"] .sk-moon-lit { fill: #f4e9cc; }
[data-night="on"] .sk-moon-rim { stroke: color-mix(in srgb, var(--ink-2) 35%, transparent); }

/* The five limbs: quiet chips; each opens its "why this?" note */
.sky-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sky-chip { flex: 1 1 150px; display: grid; gap: 2px; align-content: start; min-height: 44px; padding: 9px 14px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--ink); box-shadow: none; }
.sky-chip:hover { border-color: var(--border-gold); }
.sky-chip[aria-expanded="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--fill) 12%, var(--panel)); }
.sky-chip-v { font: 600 17px/1.25 var(--serif); }
.sky-chip-k { font-size: 14px; line-height: 1.3; color: var(--ink-3); }
.sky-chip-e { font-size: 14px; line-height: 1.35; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sky-why { margin: 10px 0 0; padding: 10px 14px; text-align: left; border-left: 2px solid var(--gold); background: color-mix(in srgb, var(--panel) 60%, transparent);
  border-radius: 0 12px 12px 0; font-size: 15px; color: var(--ink-2); }
.sky-why p { margin: 4px 0; }
.sky-why-k { font-weight: 600; color: var(--ink); }
.sky-why-m { font-variant-numeric: tabular-nums; }

/* Desktop: the wheel in the centre, the day on its left, the limbs on its right */
@media (min-width: 1100px) {
  .sky-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 600px) minmax(0, 1fr); grid-template-areas: "intro wheel panch" ". cap ."; column-gap: 40px; align-items: center; justify-items: stretch; text-align: left; padding-top: 8px; }
  .sky-intro { display: block; grid-area: intro; }
  .sky-wheel { grid-area: wheel; justify-self: center; width: min(100%, max(440px, calc(100svh - 250px))); }
  .sky-panch { grid-area: panch; }
  .sky-cap { grid-area: cap; text-align: center; }
  .sky-title { margin: 0 0 18px; font-size: 18px; }
  .sky-day { margin: 0 0 8px; font-size: 30px; line-height: 1.25; }
  .sky-day .sky-sep { display: none; }
  .sky-day .nw, .sky-moonline .nw { display: block; white-space: normal; }
  .sky-moonline .sky-sep { display: none; }
  .sky-moonline { margin: 0 0 22px; }
  .sky-ctl-row { margin: 0; }
  .sky-chips { flex-direction: column; }
  .sky-chip { flex: none; }
}
@media (max-width: 640px) {
  .sky-chip { flex-basis: 140px; padding: 8px 12px; }
}

/* ---- The place-and-time sheet --------------------------------------------------------------------------------------- */
.sky-sheet { width: min(460px, calc(100vw - 32px)); max-width: none; padding: 18px 20px 20px; border: 1px solid var(--border-gold); border-radius: 18px;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.sky-sheet::backdrop { background: rgba(11, 16, 38, .45); background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(3px); }
.sky-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sky-sheet h2 { margin: 0; font-size: 22px; }
main .sky-sheet h2::before { display: none; }
.sky-x { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 999px; background: none; border: 1px solid transparent; color: var(--ink-2); }
.sky-x:hover { border-color: var(--line); color: var(--ink); }
.sky-field { display: grid; gap: 6px; margin: 12px 0 0; font-size: 15px; color: var(--ink-2); }
.sky-field select, .sky-field input { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; font-variant-numeric: tabular-nums; }
.sky-sheet .status { font-size: 14px; margin: 10px 0 0; min-height: 0; }
/* The remembered place: where it is kept, and a way to forget it */
.sky-mem { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.sky-forget { min-height: 44px; min-width: 44px; padding: 8px 14px; border-radius: 999px; font-size: 15px; background: none; border-color: var(--line); color: var(--ink); }
.sky-forget:hover { border-color: var(--gold); }
.sky-sheet .note { margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.sky-sheet-acts { display: flex; gap: 10px; margin-top: 16px; }
.sky-sheet-acts button { flex: 1; min-height: 44px; font-size: 16px; }
@media (max-width: 640px) {
  .sky-sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: no-preference) {
  .sky-sheet[open] { animation: sky-in .22s var(--ease); }
  @media (max-width: 640px) { .sky-sheet[open] { animation-name: sky-up; animation-duration: .28s; } }
  .sky-chip, .sky-ctl { transition: border-color .2s var(--ease), background-color .2s var(--ease); }
}
@keyframes sky-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sky-up { from { transform: translateY(100%); } to { transform: none; } }

/* ---- Below the hero: the details, quieter --------------------------------------------------------------------------- */
.sky-below { margin-top: 44px; border-top: 1px solid var(--line); }
.sky-below h2 { font-size: clamp(21px, 2.4vw, 25px); margin: 1.4em 0 .5em; }
.sky-below h2::before { width: 22px; height: 14px; opacity: .7; }
.sky-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 40px; }
@media (min-width: 900px) { .sky-two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.sky-block h2 + * { margin-top: 0; }
.sky-grahas { border-color: var(--line); }
.sky-grahas th { background: transparent; }
.sky-grahas td.num, .sky-ayan, .sky-lagna .nw { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sky-lagna { margin: 0 0 4px; font: 600 24px/1.25 var(--serif); color: var(--gold); }
.sky-ayan { margin: 0; font-size: 16px; color: var(--ink); }
.sky-calc { margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 60%, transparent); }
@media (max-width: 640px) {
  /* The grahas as rows: name and degree, then sign and nakshatra; nothing scrolls sideways */
  .sky-grahas { overflow: visible; border: 0; border-radius: 0; margin: 4px 0 8px; }
  .sky-grahas thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sky-grahas table, .sky-grahas tbody { display: block; }
  .sky-grahas tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .sky-grahas td { display: block; padding: 0; border: 0; font-size: 15px; }
  .sky-grahas .g-name { grid-column: 1; grid-row: 1; font-weight: 600; }
  .sky-grahas .g-deg { grid-column: 2; grid-row: 1; }
  .sky-grahas .g-rashi { grid-column: 1; grid-row: 2; color: var(--ink-2); }
  .sky-grahas .g-nak { grid-column: 2; grid-row: 2; text-align: right; color: var(--ink-2); }
  .sky-grahas .g-name .muted { font-weight: 400; }
}

/* The explanations: the same content with less weight */
.sky-about { max-width: 780px; margin: 48px 0 0; padding-top: 24px; border-top: 1px solid var(--line); }
.sky-about .lede { font-size: 17px; margin: 0 0 12px; }
.free-line { font-size: 15px; color: var(--ink-2); margin: 0; }
.free-line strong { color: var(--ink); }
.sky-below .feature, .sky-below .card { box-shadow: none; background-image: none; background-color: color-mix(in srgb, var(--panel) 55%, transparent); }
.sky-below .feature h3 { margin-top: 0; font-size: 17px; }
.sky-below .feature p, .sky-below .card span { font-size: 15px; }
.sky-below .lede { font-size: 17px; }
.sky-below .quote { font-size: 18px; }

/* For you: one card per saved chart with its running dasha, linking to the explanation on the Kundli page */
.for-you { max-width: 820px; margin: 8px auto 28px; }
.for-you h2 { margin: 0 0 10px; }
.fy-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.fy-card { display: grid; gap: 3px; height: 100%; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border-gold); background: var(--panel);
  color: var(--ink-2); text-decoration: none; box-shadow: var(--shadow); }
.fy-card:hover { border-color: var(--gold); }
.fy-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.fy-name { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--saffron); }
.fy-line { font: 400 var(--fs-l)/1.35 var(--serif); color: var(--ink); }
.fy-line strong { font-weight: 600; font-size: var(--fs-xl); }
.fy-until { font-size: var(--fs-s); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fy-themes { font-size: var(--fs-s); color: var(--ink-2); }
.fy-go { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: var(--fs-s); font-weight: 600; color: var(--gold); }

/* Timings today: the Calendar's list for the sky's place and day, the running one first in words and marked in the list */
.sky-tm { max-width: 820px; margin: 4px auto 26px; }
.sky-tm h2 { margin: 0 0 2px; }
.tmc-where { margin: 0 0 8px; font-size: var(--fs-s); color: var(--ink-3); }
.tmc-lead { margin: 0 0 10px; font: 600 var(--fs-l)/1.4 var(--serif); color: var(--ink); }
@media (min-width: 761px) { .tmc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tmc-earlier { margin: 10px 0 0; }
.tmc-earlier > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--gold); }
.tmc-earlier[open] > summary { margin-bottom: 6px; }
