/* Light: Warm sand. Dark: Evening foliage. Both from colours in her photos.
   --bar is a slightly deeper shade of the background, for the top bar. */
:root {
  --bg: #ebe1d5;
  --bar: #ddcfbe;
  --fg: #4a3022;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #23261b;
    --bar: #181a12;
    --fg: #e8dab5;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #23261b;
  --bar: #181a12;
  --fg: #e8dab5;
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.45 Aptos, "Segoe UI", system-ui, sans-serif;
}

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

a {
  color: inherit;
}

/* Top bar: full width, with its contents lined up with the page column. */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.9rem max(1.25rem, (100% - 64rem) / 2);
  margin-bottom: 2.5rem;
  background: var(--bar);
}

.site-name {
  font-weight: bold;
  text-decoration: none;
}

nav {
  margin-left: auto;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav a[aria-current="page"] {
  text-decoration: none;
}

/* Light/dark switch: a sun and a moon in a pill, with a disc that slides
   behind whichever one is active. */
#theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 3.5rem;
  height: 1.8rem;
  padding: 0 0.3rem;
  color: inherit;
  background: none;
  border: 1px solid;
  border-radius: 999px;
  cursor: pointer;
}

#theme-toggle[hidden] {
  display: none;
}

#theme-toggle::before {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 0.2s ease;
}

#theme-toggle[aria-checked="true"]::before {
  transform: translateX(1.7rem);
}

#theme-toggle svg {
  position: relative;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The active icon sits on the disc, so it takes the bar colour. */
#theme-toggle[aria-checked="false"] .sun,
#theme-toggle[aria-checked="true"] .moon {
  stroke: var(--bar);
}

@media (prefers-reduced-motion: reduce) {
  #theme-toggle::before {
    transition: none;
  }
}

/* Spacing scale: lines within a group sit close, headings get clear space
   above, and each two-column row is well separated from the next. */
:root {
  --space-line: 0.3rem;
  --space-heading: 1.75rem;
  --space-row: 3rem;
}

/* Three levels of text. Headings are larger and the only bold; body text
   is the plain baseline; lists and thoughts sit a little quieter. */
h1 {
  font-size: 1.75rem;
  margin: 0 0 1.5rem;
}

h2 {
  font-size: 1.3rem;
  margin: var(--space-heading) 0 0.4rem;
}

p {
  margin: 0 0 var(--space-line);
}

/* Repeated lists: lines that share an opening ("We ...", "You don't have
   to ...", "Perhaps ..."). Small, faded dots. */
ul.repeat {
  list-style: none;
  margin: 0.35rem 0 0.6rem;
  padding: 0;
}

ul.repeat li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: var(--space-line);
}

ul.repeat li:last-child {
  margin-bottom: 0;
}

ul.repeat li::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.62em;
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

/* Thoughts: words in a person's own head. Faded italic, indented to line
   up with the list text. The key thought is left unfaded. */
i {
  opacity: 0.8;
}

p.thought {
  margin-block: 0.5rem;
  margin-left: 1.4rem;
}

br + i {
  display: inline-block;
  margin-left: 1.4rem;
}

p.key i {
  opacity: 1;
}

/* About Me is written in full paragraphs, so those keep paragraph spacing. */
.portrait p {
  margin-bottom: 0.9rem;
}

.center {
  text-align: center;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
  border-radius: 12px;
}

img.small {
  width: 70%;
}

img.center {
  margin-inline: auto;
}

/* Two columns, matching the layout tables in the Word documents. */
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-block: var(--space-row);
}

h1 + .pair {
  margin-top: 0;
}

.pair.portrait {
  grid-template-columns: 2fr 3fr;
}

/* Both columns start at exactly the same height. */
.pair > div > :first-child {
  margin-top: 0;
}

.pair > div > :last-child {
  margin-bottom: 0;
}

/* A photo on its own beside text is centred vertically against it. */
.pair > div:has(> img:only-child) {
  align-self: center;
}

/* On Guided Releasing the text is centred against its photo too. */
.pair.centred > div {
  align-self: center;
}

@media (max-width: 700px) {
  /* Stack into one column, with every photo directly above the text it
     sits beside, so photos and text alternate down the page. */
  .pair,
  .pair.portrait {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-block: 2.5rem;
  }

  .pair > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .pair > div > img,
  .pair > div:has(> img:only-child) {
    order: -1;
  }

  .pair > div > img {
    margin: 0 0 1rem;
  }

  .pair > div:has(> img:only-child) > img {
    margin: 0;
  }

  /* Flex items don't collapse margins, so a heading right under a photo
     relies on the photo's margin alone. */
  .pair > div > img + h2 {
    margin-top: 0;
  }

  /* Her hand-placed line breaks only suit a wide line. */
  .center p br {
    display: none;
  }

  /* Site name and toggle share the first row; page links go below. */
  .site-name {
    flex: 1;
  }

  nav {
    order: 1;
    width: 100%;
    margin-left: 0;
  }
}
