/* reading.css — Oneness Lifestyles · The Daily Attunement Reading (unit U-03).
   Fetches the day's reading from the stable gateway (config.js GATEWAY_URL),
   renders its three parts in order, and falls back to the last-known reading
   or a calm waiting state. Palette tokens are byte-identical to the frozen
   reference (captures/site/styles.css). WCAG: text >= 18px, contrast >= 4.5:1,
   touch targets >= 44px, keyboard reachable, focus visible, reduced-motion
   honored. */

/* ---------- Brand palette (from captures/site/styles.css, byte-identical) ---------- */
:root {
  --brand-blue: #283890;   /* deep blue — primary (theme-color) */
  --brand-green: #6dbc45;  /* vibrant lime green — accent CTA */
  --brand-sand: #c1a178;   /* warm sand — accent */
  --brand-teal: #25c4b8;   /* fun accent */
  --brand-pink: #ff4d8d;   /* fun accent */
  --bg: #f7faff;           /* page background */
  --surface: #ffffff;      /* cards / surfaces */
  --text: #141414;         /* body text */
  --text-2: #3f3f3f;       /* secondary text */
  --line: #dfe5f6;         /* soft blue-grey divider */

  /* WCAG-safe derivations (frozen tokens above are unchanged) */
  --brand-green-deep: #5fae3d;  /* green pill hover (from reference CSS) */
  --brand-green-text: #357a24;  /* link green, >= 4.5:1 on white/surface */
  --brand-sand-light: #e0cbaa;  /* footer link sand, >= 4.5:1 on brand blue */
  --brand-teal-text: #0a6b63;  /* dark teal kicker, >= 4.5:1 on white */
}

/* ---------- Base / reset ---------- */
* {
  box-sizing: border-box;
}

html {
  font-size: 18px;   /* WCAG: root 18px so 1rem = 18px and no text falls below the floor */
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* The hidden attribute must always win, even where a class sets display. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;   /* WCAG: base text >= 18px */
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Accessibility: visible focus + skip link ---------- */
:focus-visible {
  outline: 3px solid var(--brand-blue);
  outline-offset: 2px;
}

.site-footer :focus-visible {
  outline-color: var(--brand-sand-light);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  display: inline-block;
  padding: 12px 20px;
  min-height: 44px;
  background-color: var(--brand-blue);
  color: #ffffff;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}

.skip-link:focus-visible {
  left: 0;
  outline-offset: 0;
}

/* ---------- Layout container ---------- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  background-color: var(--surface);
  border-bottom: 4px solid var(--brand-sand);
}

.header-top {
  padding-top: 4px;
  padding-bottom: 4px;
}

.site-name {
  margin: 1em 0;
  color: var(--brand-blue);
  font-weight: bold;
  letter-spacing: 0.04em;
}

.site-name a {
  display: inline-block;
  padding: 10px 0;          /* WCAG: comfortable touch target */
  color: var(--brand-blue);
  text-decoration: none;
}

/* ---------- Reading hero (page title lives in the header) ---------- */
.reading-hero {
  text-align: center;
  padding: 40px 20px 48px;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(37, 196, 184, 0.24), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(255, 77, 141, 0.16), transparent 55%),
    linear-gradient(180deg, #eef2ff 0%, var(--bg) 100%);
}

.reading-kicker {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: 0.14em;
  color: var(--brand-teal-text);   /* >= 4.5:1 on bg */
}

.reading-heading {
  margin: 0 0 14px;
  font-size: 2.2rem;
  color: var(--brand-blue);
}

.reading-sub {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-2);
}

/* ---------- Reading section ---------- */
.reading-section {
  padding: 32px 20px 72px;
}

/* ---------- Last-known reading note ---------- */
.stored-note {
  max-width: 560px;
  margin: 0 auto 20px;
  padding: 14px 18px;
  color: var(--text-2);
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-sand);
  border-radius: 12px;
}

/* ---------- Waiting / offline states ---------- */
.reading-status {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 24px;
  text-align: center;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(20, 20, 20, 0.08);
}

.status-title {
  margin: 0 0 10px;
  font-size: 1.4rem;
  color: var(--brand-blue);
}

.status-copy {
  margin: 0;
  color: var(--text-2);
}

/* ---------- Reading card ---------- */
.reading-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 26px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(20, 20, 20, 0.08);
}

.reading-date {
  margin: 0 0 26px;
  color: var(--brand-teal-text);   /* >= 4.5:1 on white */
  letter-spacing: 0.02em;
}

/* Day-of-cycle line: "DAY N | Medicine Wheel Reading", spaced like the date */
.reading-day {
  margin: 0 0 26px;
  font-size: 1.8rem;               /* 32.4px — prominent */
  font-weight: bold;
  color: var(--brand-blue);        /* ~11:1 on white */
  letter-spacing: 0.02em;
}

.reading-part {
  padding: 22px 0;
}

.reading-part + .reading-part {
  border-top: 1px solid var(--line);
}

.part-kicker {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: 0.12em;
  color: var(--brand-teal-text);   /* >= 4.5:1 on white */
}

.part-heading {
  margin: 0 0 12px;
  font-size: 1.5rem;
  color: var(--brand-blue);
}

.part-text {
  margin: 0;
  font-size: 1.125rem;   /* 20.25px — comfortably above the WCAG floor */
  color: var(--text);
}

/* The five lines of the galactic signature — one verse line per paragraph */
.five-lines p {
  margin: 0 0 8px;
  font-size: 1.125rem;   /* 20.25px — comfortably above the WCAG floor */
  color: var(--text);
}
.five-lines p:last-child {
  margin-bottom: 0;
}

/* Heptad note under the affirmation, when the spoke carries one */
.part-heptad {
  margin: 10px 0 0;
  font-size: 1rem;                 /* 1rem = 18px, WCAG floor */
  font-style: italic;
  color: var(--text-2);            /* ~8:1 on white */
}

/* Remedy of the Day: name line, then the "For" paragraph, then the caution */
.part-remedy-name {
  margin: 0 0 12px;
  font-size: 1.25rem;              /* 22.5px */
  font-weight: bold;
  color: var(--brand-blue);        /* ~11:1 on white */
}

.remedy-caution {
  margin: 16px 0 0;
  padding: 14px 18px;
  color: var(--text-2);            /* ~8:1 on surface */
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-sand);
  border-radius: 12px;
}

.remedy-caution-label {
  margin: 0 0 6px;
  font-weight: bold;
  color: var(--text);              /* ~17:1 on surface */
}

.remedy-caution-text {
  margin: 0;
  font-size: 1rem;                 /* 1rem = 18px, WCAG floor */
}

/* ---------- Telegram door ---------- */
.telegram-door {
  margin: 40px 0 0;
}

.door-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 26px;
  text-align: center;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(20, 20, 20, 0.08);
}

.door-heading {
  margin: 0 0 12px;
  font-size: 1.6rem;
  color: var(--brand-blue);
}

.door-copy {
  margin: 0 0 22px;
  color: var(--text);
}

.door-action {
  margin: 0;
}

/* ---------- Back to home ---------- */
.door-back {
  margin: 28px 0 0;
  text-align: center;
}

.door-back a {
  display: inline-block;
  padding: 12px 0;               /* WCAG: comfortable touch target */
  color: var(--brand-green-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Small print: the gentle medical note (under the caution, and in the footer).
   Under the Caution it sits on the white card, so it reads in soft grey;
   in the blue footer it reads in sand-light (rule below). */
.footer-note {
  margin: 14px auto 0;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
  color: var(--text-2);            /* on white: ~9.5:1 */
  max-width: 34em;
}

/* In the blue footer the note reads sand-light and sits dead-center. */
.site-footer p.footer-note {
  margin: 10px auto 0;
  color: var(--brand-sand-light);  /* ~6.5:1 on brand blue */
}

/* ---------- Brand sign-off ---------- */
.reading-signoff {
  margin: 40px 0 0;
  text-align: center;
}

.reading-signoff .signoff-text {
  margin: 0;
  font-size: 1.2rem;             /* 21.6px — comfortably above the WCAG floor */
  font-weight: bold;
  color: var(--brand-blue);      /* ~9:1 on bg */
}

/* ---------- Links ---------- */
a {
  color: var(--brand-green-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Buttons (brand lime green — dark text for readable contrast) ---------- */
.btn {
  display: inline-block;
  padding: 12px 30px;
  min-height: 44px;               /* WCAG: touch target >= 44px */
  border-radius: 999px;
  background-color: var(--brand-green);
  color: var(--text);             /* >= 4.5:1 on brand green */
  font-weight: bold;
  text-decoration: none;
  font-size: 1.125rem;            /* >= 18px (WCAG floor) */
  transition: background-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
  background-color: var(--brand-green-deep);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 40px 24px;
  background-color: var(--brand-blue);
  color: #e7ebfa;      /* >= 4.5:1 on brand blue */
  text-align: center;
  font-size: 1rem;     /* 1rem = 18px (root is 18px); >= WCAG floor */
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-block;
  padding: 8px 4px;
  color: var(--brand-sand-light);  /* >= 4.5:1 on brand blue */
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Responsive (mobile-first; text never below 18px) ---------- */
@media (min-width: 1024px) {
  .reading-hero {
    padding: 56px 24px 64px;
  }
  .reading-heading {
    font-size: 2.8rem;
  }
  .reading-section {
    padding: 40px 24px 96px;
  }
  .reading-card,
  .door-card {
    padding: 44px 40px;
  }
}

/* ---------- JS reveal (only active when JS is on) ---------- */
.js-enabled .reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.js-enabled .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js-enabled .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
