/* base.css
   ---------------------------------------------------------------
   Styles shared by every page: page colours, text, the top menu,
   buttons, form fields and the little "what does this word mean"
   pop-ups. Page-specific layouts live in their own files.
   --------------------------------------------------------------- */

/* --- 1. Basics ------------------------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--bone);
  font: 16px/1.65 var(--sans);
  font-weight: 450; /* a touch heavier than normal, easier to read on dark colours */
  -webkit-font-smoothing: antialiased;
}

/* Each page picks its colour by adding a class to <body>. */
.page-welcome     { --page: var(--olive); }
.page-universe    { --page: var(--rose); }
.page-chart       { --page: var(--slate); }
.page-explore     { --page: var(--sage); }
.page-connections { --page: var(--mauve); }
.page-profile     { --page: var(--grey); }
.page-how         { --page: var(--taupe); }

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

/* Anything marked "hidden" stays hidden, even if another rule gives it a layout. */
[hidden] { display: none !important; }

a { color: inherit; text-underline-offset: 4px; }
a:hover { color: var(--champagne); }

/* A visible outline for keyboard users, on everything they can reach. */
:focus-visible { outline: 2px solid var(--champagne); outline-offset: 3px; }

/* People who ask their device for less motion get no animations. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Headings that the page moves the focus to (after a click) don't need a visible box. */
[tabindex="-1"]:focus { outline: none; }

/* Hidden on screen but still read out by screen readers. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* "Skip to content" link: invisible until a keyboard user tabs to it. */
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; background: var(--champagne); color: var(--ink); text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* Content never gets wider than this, and keeps space at the sides. */
.wrap { width: 100%; max-width: var(--max-width); margin: 0 auto; padding-inline: var(--gutter); }

/* --- 2. Text styles --------------------------------------------- */

/* Bodoni has very thin strokes; weight 500 keeps the elegance but makes titles easier to read. */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.05; margin: 0; }
h1 em, h2 em, h3 em { font-style: italic; }

/* Bodoni Moda changes its shape with its size ("optical size"): the
   bigger the text, the thinner its fine lines. For big titles we ask
   for the sturdier version made for 18px text, so the thin lines are a
   little thicker and easier to read, but it's still the same font.
   (Smaller Bodoni text, like the spaced-out labels, is left as it is.) */
/* ("html" in front makes this rule win over the page CSS files, whose
   "font: …" shorthand would otherwise reset it.) */
html :is(h1, h2, h3, .title, .section-title, .welcome-title, .welcome-tagline,
  .placement-sign, .reading-title, .grammar, .topic-name, .topic-item-title,
  .topic-big-question, .lens, .lib-name, .explore-name, .travel-date,
  .playground-readout .angle, .term-popup strong) {
  font-variation-settings: "opsz" 18;
}
/* The small spaced-out labels keep their own automatic setting. */
html .eyebrow { font-variation-settings: normal; }

/* Small spaced capitals, like "S U N · W H O  Y O U  A R E" */
.eyebrow {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700; /* small text needs extra weight to stay readable */
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--champagne);
}

.title { font-size: clamp(1.9rem, 3.4vw, 3.1rem); line-height: 1.12; }
.section-title { font-size: clamp(1.6rem, 2.5vw, 2.2rem); line-height: 1.15; }

.lede { max-width: 58ch; color: var(--bone-soft); margin: 0; }
.quiet { color: var(--bone-soft); }

/* --- 3. Top menu ------------------------------------------------ */

.site-header { border-bottom: 1px solid var(--line); }

.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 40px; padding-block: 18px;
}

.brand {
  font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: 0.4em;
  color: var(--champagne); text-decoration: none;
}

.site-nav ul {
  display: flex; flex-wrap: wrap; gap: 10px 34px;
  margin: 0; padding: 0; list-style: none;
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.site-nav a { text-decoration: none; padding-block: 6px; display: inline-block; }
/* The page you're on is underlined in champagne. */
.site-nav a[aria-current="page"] {
  text-decoration: underline; text-decoration-color: var(--champagne);
  text-decoration-thickness: 1px; text-underline-offset: 8px;
}

/* On phones every page stays visible: the menu sits under ORBIT,
   in rows of small tabs, so you can always see where you can go. */
@media (max-width: 760px) {
  .site-header .wrap { gap: 10px; padding-block: 16px 10px; }
  .site-nav { flex-basis: 100%; }
  .site-nav ul { gap: 2px 20px; font-size: 11.5px; letter-spacing: 0.12em; }
  .site-nav a { padding: 8px 0; }
}

/* A strip at the top when someone is looking at the sample chart. */
.sample-banner {
  background: var(--champagne); color: var(--ink);
  text-align: center; font-size: 14px; padding: 8px 16px;
}
.sample-banner a { color: var(--ink); font-weight: 600; }

/* --- 4. Buttons --------------------------------------------------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 12px 22px;
  font: 600 12px/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  border: 1px solid var(--champagne); border-radius: 0;
  background: var(--champagne); color: var(--ink);
  transition: background 0.2s, color 0.2s;
}
.button:hover { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.button[disabled] { opacity: 0.5; cursor: wait; }

.button-outline { background: transparent; color: var(--bone); }
.button-outline:hover { background: var(--champagne); color: var(--ink); border-color: var(--champagne); }

.text-link { font-size: 15px; font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* --- 5. Form fields ----------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field legend { font-weight: 600; font-size: 15px; padding: 0; }
.hint { font-size: 14px; color: var(--bone-soft); margin: 0; }

input[type="text"], input[type="number"], select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  font: inherit; color: var(--bone);
  background: rgba(233, 227, 216, 0.06);
  border: 1px solid rgba(233, 227, 216, 0.45); border-radius: 0;
}
input::placeholder { color: rgba(233, 227, 216, 0.5); }
input:focus, select:focus { border-color: var(--champagne); outline: none; box-shadow: 0 0 0 1px var(--champagne); }
input[aria-invalid="true"] { border-color: var(--error); }
input:disabled { opacity: 0.4; }
select option { color: var(--ink); }
/* Drop-down menus: the same flat box as the other fields, with a thin arrow
   (instead of each browser's own shiny button). */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23CDBB92' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

.checkbox { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--bone-soft); cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--champagne); margin: 0; }

.error-text { color: var(--error); font-size: 14px; font-weight: 600; margin: 0; }
.error-text:empty { display: none; }

/* --- 6. "What does this word mean?" pop-ups ----------------------- */
/* Any astrology word with a dotted underline can be hovered, focused
   or tapped to show a one-line plain explanation (js/glossary.js). */

.term {
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: help; position: relative; display: inline;
  text-decoration: underline dotted; text-decoration-color: var(--champagne);
  text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.term-popup {
  position: absolute; z-index: 50; left: 0; top: calc(100% + 8px);
  width: max-content; max-width: min(300px, 80vw);
  padding: 12px 14px; background: var(--bone); color: var(--ink);
  font: 14px/1.5 var(--sans); letter-spacing: 0; text-transform: none; text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
/* The pop-up always keeps dark text on its light box, whatever page
   styles are around it (".term >" makes this rule win). */
.term > .term-popup { color: var(--ink); }
.term-popup strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 18px; margin-bottom: 2px; }
.term-popup[hidden] { display: none; }

/* --- 7. Footer ---------------------------------------------------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; }
.site-footer .wrap { padding-block: 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; font-size: 13px; color: var(--bone-soft); }
.site-footer p { margin: 0; }

/* --- 8. "Save to my profile" button ------------------------------- */
.save-button {
  align-self: flex-start;
  font: 600 11.5px/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--bone); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 0; padding: 9px 14px; min-height: 36px;
}
.save-button:hover { border-color: var(--champagne); color: var(--champagne); }
.save-button[aria-pressed="true"] { border-color: var(--champagne); color: var(--champagne); }

/* --- 9. A quiet button that looks like a text link (Remove, Cancel) --- */
.link-button {
  font: 600 15px var(--sans); color: var(--bone); background: none; border: 0; padding: 10px 0;
  cursor: pointer; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line);
}
.link-button:hover { color: var(--champagne); text-decoration-color: currentColor; }
.link-button.danger { color: var(--error); text-decoration-color: currentColor; }

/* --- 10. "← Back to …" button (js/layout.js) ---------------------- */
.back-chip {
  position: fixed; left: 16px; bottom: 16px; z-index: 45;
  display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px;
  font: 600 14px/1.2 var(--sans); color: var(--bone); text-decoration: none;
  background: var(--page); border: 1px solid var(--champagne);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.back-chip:hover { background: var(--champagne); color: var(--ink); }

/* Two or more buttons joined together, one pressed at a time
   (Wheel / List, Friendship / Romance, Log in / Create account). */
.view-switch { display: inline-flex; border: 1px solid var(--champagne); }
.view-switch button {
  font: 600 12px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase;
  padding: 13px 20px; min-height: 44px; border: 0; border-radius: 0; cursor: pointer;
  background: transparent; color: var(--bone);
}
.view-switch button[aria-pressed="true"] { background: var(--champagne); color: var(--ink); }
