/* ABOUTME: Shared styles for every page: fonts, colour themes per book, typography, top bar, buttons and footer. */
/* ABOUTME: Each theme class on <body> sets the colour tokens; components only ever use the tokens. */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-500-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/fonts/source-sans-3.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("/fonts/source-sans-3-italic.woff2") format("woff2");
}

:root {
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 40rem;
  --topbar-h: 64px;
  --radius: 6px;

  /* Split panel backgrounds belong to the books, so they are the same on every page. */
  --panel-morphic-fields-made-simple:
    radial-gradient(ellipse at 25% 15%, rgb(48 180 207 / 0.45), transparent 55%),
    linear-gradient(145deg, #0b3352 0%, #0f5a5c 48%, #23803c 100%);
  --panel-tarot-made-simple:
    radial-gradient(circle at 50% 38%, #c9242c 0%, #93101a 52%, #5c0a10 100%);
  --panel-les-champs-morphiques:
    radial-gradient(circle at 50% 30%, #b0472a 0%, #6a1a1c 45%, #22090c 100%);
}

@media (max-width: 639px) {
  :root { --topbar-h: 88px; }
}

.theme-morphic {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --text: #1d2a2a;
  --muted: #4f5f5d;
  --heading: #22703a;
  --subheading: #0f6f86;
  --accent: #12615c;
  --accent-hover: #0c4a46;
  --accent-text: #ffffff;
  --link: #0f6577;
  --band: #e4eeeb;
  --band-text: var(--text);
  --rule: #cfdcd8;
  --marker: #2f9a4c;
  --footer-bg: #0d3640;
  --footer-text: #d9e8e5;
  --footer-muted: #a9c3be;
}

.theme-tarot {
  --bg: #fffaea;
  --surface: #ffffff;
  --text: #1c1612;
  --muted: #5a4939;
  --heading: #a3121b;
  --subheading: #1c1612;
  --accent: #a3121b;
  --accent-hover: #7c0d14;
  --accent-text: #ffffff;
  --link: #970f18;
  --band: #ffdb2f;
  --band-text: #1c1612;
  --rule: #ead79c;
  --marker: #a3121b;
  --footer-bg: #1c1612;
  --footer-text: #f6ebcb;
  --footer-muted: #cdbf98;
}

.theme-french {
  --bg: #1b0c0f;
  --surface: #2a1418;
  --text: #f2e5d6;
  --muted: #cdb7a4;
  --heading: #efb65a;
  --subheading: #e9a27c;
  --accent: #e3692f;
  --accent-hover: #f08048;
  --accent-text: #1b0c0f;
  --link: #f3c47e;
  --band: #26111a;
  --band-text: var(--text);
  --rule: #4b2a2c;
  --marker: #efb65a;
  --footer-bg: #110607;
  --footer-text: #e8d6c4;
  --footer-muted: #b49c89;
}

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

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

/* Smooth scrolling starts only once the page has loaded (see js/switcher.js): a smooth jump to a
   #fragment in the address bar is cancelled by the browser while the page is still loading. */
@media (prefers-reduced-motion: no-preference) {
  html.smooth-scroll { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
picture { display: contents; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--marker); outline-offset: 3px; }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; }
h1, h2 { font-family: var(--font-display); font-weight: 500; color: var(--heading); }

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  height: var(--topbar-h);
  padding-inline: var(--gutter);
  background: var(--bg);
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
}

.topbar__nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topbar__nav a {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding-block: 0.4rem;
  border-bottom: 2px solid transparent;
}
.topbar__nav a:hover { color: var(--text); }
.topbar__nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--marker); }

@media (max-width: 639px) {
  .topbar {
    flex-direction: column;
    justify-content: center;
    gap: 0.55rem;
  }
  .wordmark { font-size: 1.15rem; }
  .topbar__nav ul { justify-content: center; gap: 0.25rem 1.25rem; }
  .topbar__nav a { font-size: 0.72rem; letter-spacing: 0.12em; }
}

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

/* Buttons */

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 0;
}

.button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
}
.button--primary { background: var(--accent); color: var(--accent-text); }
.button--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button--quiet { background: transparent; color: var(--text); border-color: var(--rule); }
.button--quiet:hover { border-color: var(--text); }

/* Running text */

.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul { margin: 0 0 1.15em; }
.prose h2 {
  margin-top: 2em;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
}
.prose code { font-size: 0.9em; }

/* Footer */

.site-footer {
  margin-top: clamp(4rem, 8vw, 7rem);
  padding-block: 3rem;
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.95rem;
}
.site-footer__inner {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
  text-align: center;
}
.site-footer .wordmark { color: var(--footer-text); font-size: 1.1rem; }
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.75rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}
.site-footer a { color: var(--footer-text); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer__links--small { font-size: 0.85rem; }
.site-footer__links--small a { color: var(--footer-muted); }
.site-footer__legal { color: var(--footer-muted); font-size: 0.85rem; }
.site-footer__legal p { margin: 0 0 0.35rem; }
