/* Astrolabe — a self-contained local astrology studio. */

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

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 5px;
  --maxw: 1280px;
}

:root[data-theme="dark"] {
  --bg: #070a12;
  --bg-2: #0a0f1b;
  --panel: rgba(15, 21, 36, 0.78);
  --panel-solid: #0f1524;
  --panel-2: #121a2d;
  --ink: #e9e3d6;
  --ink-strong: #f6f1e5;
  --muted: #a09a8e;
  --dim: #736e64;
  --line: rgba(216, 186, 128, 0.14);
  --line-strong: rgba(216, 186, 128, 0.3);
  --gold: #d8b46a;
  --gold-hi: #f1d7a1;
  --gold-dim: #9c8149;
  --accent: #c97b62;
  --sage: #93a878;
  --blue: #7e9fc4;
  --danger: #d07a6a;
  --ok: #86b58c;
  --input-bg: rgba(6, 9, 18, 0.55);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --header-bg: rgba(7, 10, 18, 0.82);
  --selection: rgba(216, 180, 106, 0.28);
}

:root[data-theme="light"] {
  --bg: #f4efe3;
  --bg-2: #eee7d8;
  --panel: rgba(255, 252, 245, 0.82);
  --panel-solid: #fbf8f0;
  --panel-2: #f1ebdd;
  --ink: #2a241b;
  --ink-strong: #17120b;
  --muted: #6f6759;
  --dim: #948b7b;
  --line: rgba(120, 94, 42, 0.18);
  --line-strong: rgba(120, 94, 42, 0.4);
  --gold: #8d6a2f;
  --gold-hi: #b08843;
  --gold-dim: #b09464;
  --accent: #a8543c;
  --sage: #65784c;
  --blue: #466e94;
  --danger: #a64c3d;
  --ok: #4d7a54;
  --input-bg: rgba(255, 253, 248, 0.9);
  --shadow: 0 22px 50px rgba(70, 55, 30, 0.12);
  --header-bg: rgba(244, 239, 227, 0.86);
  --selection: rgba(141, 106, 47, 0.2);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 760px at 18% -12%, rgba(92, 124, 176, 0.16), transparent 62%),
    radial-gradient(900px 680px at 92% -4%, rgba(190, 124, 80, 0.09), transparent 58%),
    radial-gradient(1000px 900px at 50% 115%, rgba(70, 100, 150, 0.07), transparent 60%);
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection);
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  color: var(--gold-hi);
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink-strong);
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(1.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  flex: 0 0 auto;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 8.5px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 3px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.8vw, 26px);
  margin-left: auto;
}

.site-nav a {
  position: relative;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 8px 1px;
  white-space: nowrap;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--gold-hi);
}

.site-nav a:hover::after,
.site-nav a.active::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
}

.theme-toggle:hover {
  color: var(--gold);
  border-color: var(--line-strong);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  width: 38px;
  height: 34px;
  border-radius: var(--radius);
}

/* ---------- layout ---------- */

.view {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 58px) clamp(18px, 4vw, 48px) 72px;
  outline: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px clamp(18px, 4vw, 48px);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  color: var(--dim);
  font-size: 11px;
}

.footer-main,
.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  color: var(--gold);
  letter-spacing: 0.28em;
  font-size: 9px;
}

.footer-note {
  letter-spacing: 0.04em;
}

.footer-links a {
  color: var(--muted);
}

.footer-dot {
  opacity: 0.4;
}

/* ---------- typography helpers ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--line-strong);
}

.display {
  font-family: var(--serif);
  font-size: clamp(34px, 4.8vw, 64px);
  line-height: 1.02;
  font-weight: 500;
}

.display em {
  font-style: italic;
  color: var(--gold);
}

.lede {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  max-width: 62ch;
}

.muted {
  color: var(--muted);
}

.dim {
  color: var(--dim);
}

.small {
  font-size: 12px;
}

.tiny {
  font-size: 10.5px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.nums {
  font-variant-numeric: tabular-nums;
}

.gold {
  color: var(--gold);
}

.accent {
  color: var(--accent);
}

.center {
  text-align: center;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- home hero ---------- */

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  padding-top: 14px;
  margin-bottom: clamp(42px, 6vw, 84px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.hero-meta div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-meta .k {
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.hero-meta .v {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
}

.hero-wheel {
  position: relative;
  aspect-ratio: 1;
  max-width: 560px;
  justify-self: end;
  width: 100%;
}

.hero-wheel::before {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 180, 106, 0.09), transparent 62%);
  pointer-events: none;
}

.hero-wheel .wheel-svg {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- cards & panels ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 30px);
  backdrop-filter: blur(8px);
}

.card.tight {
  padding: 16px 18px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-title h2,
.card-title h3 {
  font-size: 21px;
}

.card-title .sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.section {
  margin-top: clamp(38px, 5vw, 64px);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-size: clamp(24px, 2.6vw, 34px);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--gold);
  color: var(--gold-hi);
  background: rgba(216, 180, 106, 0.06);
}

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #14100a;
  font-weight: 700;
}

.btn-primary:hover {
  background: var(--gold-hi);
  border-color: var(--gold-hi);
  color: #14100a;
}

.btn-ghost {
  border-color: var(--line);
  color: var(--muted);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---------- forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  grid-column: span 12;
}

.field.half {
  grid-column: span 6;
}

.field.third {
  grid-column: span 4;
}

.field.quarter {
  grid-column: span 3;
}

.field.two-thirds {
  grid-column: span 8;
}

.field > label:not(.checkbox) {
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field label .opt {
  color: var(--dim);
  letter-spacing: 0.06em;
  text-transform: none;
  font-size: 10px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 42px;
}

input::placeholder,
textarea::placeholder {
  color: var(--dim);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(216, 180, 106, 0.09);
}

input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

:root[data-theme="light"] input[type="date"],
:root[data-theme="light"] input[type="time"] {
  color-scheme: light;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--input-bg);
  display: grid;
  place-items: center;
  margin: 0;
}

.checkbox input:checked::after {
  content: "✓";
  font-size: 11px;
  color: var(--gold);
}

.form-note {
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.5;
}

.form-actions {
  grid-column: span 12;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* city autocomplete */

.city-field {
  position: relative;
}

.city-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  display: none;
}

.city-results.open {
  display: block;
}

.city-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  color: var(--ink);
}

.city-result:last-child {
  border-bottom: 0;
}

.city-result:hover,
.city-result.active {
  background: rgba(216, 180, 106, 0.09);
}

.city-result .city-name {
  font-size: 13px;
}

.city-result .city-where {
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-result .city-pop {
  font-size: 9px;
  color: var(--gold-dim);
  white-space: nowrap;
}

.city-chosen {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--gold);
  min-height: 16px;
}

.city-chosen .pin {
  opacity: 0.7;
}

details.advanced {
  grid-column: span 12;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

details.advanced summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  list-style: none;
}

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

details.advanced summary::before {
  content: "＋ ";
  color: var(--gold-dim);
}

details.advanced[open] summary::before {
  content: "− ";
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px 18px;
  padding-top: 14px;
}

/* ---------- notices & badges ---------- */

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold);
  border-radius: 3px;
  background: rgba(216, 180, 106, 0.05);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.notice.warn {
  border-left-color: var(--accent);
  background: rgba(201, 123, 98, 0.06);
}

.notice.error {
  border-left-color: var(--danger);
  background: rgba(208, 122, 106, 0.08);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge.gold {
  border-color: var(--line-strong);
  color: var(--gold);
}

.badge.retro {
  color: var(--accent);
  border-color: rgba(201, 123, 98, 0.35);
}

/* ---------- page heads ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: clamp(26px, 3.4vw, 42px);
}

.page-head .titles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
}

.page-head h1 {
  font-size: clamp(32px, 3.8vw, 52px);
  line-height: 1.04;
}

.page-head .lede {
  font-size: 14.5px;
}

.page-head .aside {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- chart result ---------- */

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}

.wheel-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(70% 70% at 50% 45%, rgba(68, 90, 140, 0.09), transparent 70%),
    var(--panel);
  padding: clamp(8px, 1.5vw, 18px);
  overflow: hidden;
}

.wheel-panel .wheel-svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chart-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-title h2 {
  font-size: clamp(25px, 2.4vw, 34px);
}

.chart-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 18px;
}

.chart-meta .item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chart-meta .k {
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.chart-meta .v {
  font-size: 13px;
  color: var(--ink);
}

.chart-meta .v.mono {
  font-size: 12px;
}

.angle-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.angle {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.012);
}

.angle .k {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--dim);
  text-transform: uppercase;
}

.angle .v {
  font-family: var(--serif);
  font-size: 14px;
  margin-top: 2px;
}

/* tabs */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 30px 0 0;
}

.tab {
  padding: 10px 15px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-panels {
  padding-top: 22px;
}

.tab-panel[hidden] {
  display: none;
}

/* tables */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th {
  text-align: left;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.018);
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(216, 180, 106, 0.035);
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td .glyph {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--gold);
  margin-right: 7px;
}

td .deg {
  font-variant-numeric: tabular-nums;
}

td .sub {
  display: block;
  font-size: 9.5px;
  color: var(--dim);
  margin-top: 1px;
}

.retro {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.dignity {
  color: var(--sage);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dignity.hard {
  color: var(--danger);
}

/* aspect grid */

.aspect-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
}

.aspect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.012);
}

.aspect-item .a-body {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.aspect-item .a-glyph {
  font-family: var(--serif);
  font-size: 17px;
}

.aspect-item .a-sym {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
}

.aspect-item .orb {
  font-size: 10px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.aspect-item .applying {
  color: var(--sage);
}

.aspect-item .separating {
  color: var(--dim);
}

/* balances */

.balance-block {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.balance-group h4 {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 12px;
}

.balance-row {
  display: grid;
  grid-template-columns: 62px 1fr 24px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 11.5px;
}

.balance-row .bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.balance-row .bar span {
  display: block;
  height: 100%;
  background: var(--gold);
  opacity: 0.7;
}

.balance-row .count {
  text-align: right;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.balance-row.fire .bar span {
  background: #c97b62;
}
.balance-row.earth .bar span {
  background: #93a878;
}
.balance-row.air .bar span {
  background: #7e9fc4;
}
.balance-row.water .bar span {
  background: #6c8fc0;
}

/* patterns */

.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pattern {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.pattern .type {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--gold);
  min-width: 110px;
}

.pattern .bodies {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- dashboard ---------- */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.moon-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.moon-visual {
  display: flex;
  align-items: center;
  gap: 18px;
}

.moon-disc {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  background: #1a2030;
  border: 1px solid var(--line-strong);
  box-shadow: inset -8px 0 18px rgba(0, 0, 0, 0.45);
}

.moon-disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #e9e2cf;
  transform: translateX(var(--moon-shift, 0%));
  box-shadow: inset -10px 0 16px rgba(0, 0, 0, 0.12);
}

.moon-name {
  font-family: var(--serif);
  font-size: 22px;
}

.moon-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.moon-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.moon-stats .k {
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.moon-stats .v {
  font-size: 12px;
}

.phase-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.phase-row:last-child {
  border-bottom: 0;
}

.phase-row .ph {
  display: flex;
  align-items: center;
  gap: 10px;
}

.phase-row .ph-glyph {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.phase-row .when {
  color: var(--dim);
  font-size: 10.5px;
  text-align: right;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.quick-link {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px;
  background: var(--panel);
  color: var(--ink);
  transition: background 0.2s ease;
}

.quick-link:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.quick-link .qk {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--gold);
}

.quick-link .qd {
  font-size: 11px;
  color: var(--dim);
  line-height: 1.4;
}

/* ---------- ephemeris ---------- */

.ephem-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.ephem-controls .field {
  min-width: 120px;
  width: auto;
  grid-column: auto;
}

.ephem-table td,
.ephem-table th {
  padding: 7px 9px;
  font-size: 11.5px;
}

.ephem-table .sign {
  color: var(--dim);
  font-size: 10px;
  margin-left: 4px;
}

.ephem-table .retro-mark {
  color: var(--accent);
  font-size: 9px;
  margin-left: 2px;
}

.ephem-table tr.month-start td {
  border-top: 1px solid var(--line-strong);
}

.body-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  color: var(--muted);
  background: transparent;
}

.toggle-chip.on {
  border-color: var(--line-strong);
  color: var(--gold);
  background: rgba(216, 180, 106, 0.06);
}

.toggle-chip .g {
  font-family: var(--serif);
  font-size: 13px;
}

/* ---------- moon calendar ---------- */

.moon-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.moon-cell {
  position: relative;
  min-height: 104px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.008);
}

.moon-cell.empty {
  background: transparent;
}

.moon-cell .daynum {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
}

.moon-cell.today {
  background: rgba(216, 180, 106, 0.06);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.moon-cell .dphase {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

.moon-cell .dsign {
  font-size: 10px;
  color: var(--dim);
  margin-top: auto;
}

.moon-cell .illum {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.moon-cell .illum span {
  display: block;
  height: 100%;
  background: var(--gold);
  opacity: 0.55;
}

.moon-cell .event {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.weekday {
  padding: 8px;
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* ---------- saved ---------- */

.profile-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-card h3 {
  font-size: 20px;
}

.profile-card .pmeta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.profile-card .pactions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 6px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin-bottom: 8px;
}

/* ---------- tools / about ---------- */

.hours-table td {
  padding: 7px 10px;
}

.hours-table tr.day-hour td:first-child {
  border-left: 2px solid var(--gold-dim);
}

.hours-table tr.night-hour td:first-child {
  border-left: 2px solid var(--blue);
}

.sun-times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sun-time {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}

.sun-time .k {
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.sun-time .v {
  font-family: var(--serif);
  font-size: 18px;
  margin-top: 3px;
}

.about-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.about-cols h3 {
  font-size: 20px;
  margin-bottom: 10px;
}

.about-cols p,
.about-cols li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.about-cols ul {
  padding-left: 18px;
  margin: 8px 0;
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--muted);
}

/* ---------- toast, modal ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 80;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: min(92vw, 480px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: rgba(208, 122, 106, 0.5);
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(2, 4, 9, 0.72);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(520px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal h3 {
  margin-bottom: 8px;
}

.modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px 0 20px;
}

/* ---------- misc ---------- */

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

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  min-width: 100px;
}

.stat .k {
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.stat .v {
  font-family: var(--serif);
  font-size: 16px;
  margin-top: 2px;
}

.link-arrow::after {
  content: " →";
  color: var(--gold-dim);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .site-nav {
    gap: 14px;
  }
  .site-nav a {
    font-size: 9.5px;
    letter-spacing: 0.16em;
  }
  .home-hero {
    grid-template-columns: 1fr;
  }
  .hero-wheel {
    justify-self: center;
    max-width: 520px;
  }
  .chart-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  }
}

@media (max-width: 900px) {
  .nav-toggle {
    display: block;
  }
  .site-nav {
    position: fixed;
    top: var(--header-h, 64px);
    left: 0;
    right: 0;
    z-index: 39;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: calc(100vh - var(--header-h, 64px));
    overflow-y: auto;
    padding: 10px 18px 18px;
    background: var(--panel-solid);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    display: none;
  }
  .site-nav.open {
    display: flex;
  }
  .site-nav a {
    padding: 13px 2px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
  }
  .chart-layout {
    grid-template-columns: 1fr;
  }
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .balance-block {
    grid-template-columns: 1fr;
  }
  .about-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }
  .site-header {
    padding: 12px 16px;
  }
  .brand-name {
    font-size: 17px;
  }
  .view {
    padding: 24px 16px 60px;
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .field.half,
  .field.third,
  .field.quarter,
  .field.two-thirds {
    grid-column: span 12;
  }
  .chart-meta {
    grid-template-columns: 1fr;
  }
  .angle-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .moon-calendar {
    font-size: 11px;
  }
  .moon-cell {
    min-height: 78px;
    padding: 5px;
  }
  .moon-cell .dsign {
    display: none;
  }
  .sun-times {
    grid-template-columns: 1fr;
  }
  .hero-meta {
    gap: 14px;
  }
  .quick-links {
    grid-template-columns: 1fr;
  }
  .footer-main,
  .footer-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ---------- print ---------- */

@media print {
  :root {
    --bg: #fff;
    --ink: #111;
    --ink-strong: #000;
    --muted: #333;
    --dim: #555;
    --line: #ccc;
    --line-strong: #999;
    --gold: #6b5426;
    --gold-hi: #000;
    --panel: #fff;
    --panel-solid: #fff;
    --panel-2: #f5f5f5;
  }
  body {
    background: #fff !important;
    color: #111;
    font-size: 11px;
  }
  .site-header,
  .site-footer,
  .no-print,
  .tabs,
  .btn,
  .toast,
  .form-card,
  .page-head .aside {
    display: none !important;
  }
  .view {
    max-width: none;
    padding: 0;
  }
  .chart-layout {
    grid-template-columns: 1fr 0.8fr;
    gap: 18px;
  }
  .wheel-panel {
    background: #fff;
    border-color: #bbb;
  }
  .wheel-svg circle {
    fill: #fff !important;
  }
  .wheel-svg circle[fill="none"] {
    fill: none !important;
  }
  .wheel-svg text {
    fill: #12161f !important;
  }
  .wheel-svg line {
    stroke-opacity: 0.6;
  }
  .card {
    break-inside: avoid;
    background: #fff;
    border-color: #bbb;
    box-shadow: none;
  }
  .tab-panel[hidden] {
    display: block !important;
  }
  .tab-panels {
    padding-top: 18px;
  }
  .tab-panel h3 {
    margin-top: 14px;
  }
  a {
    color: #111;
  }
}
