/* ==========================================================================
   Monosaic - site styles (home, about, privacy)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts - self-hosted (assets/fonts), SIL Open Font License 1.1.
   "latin-ext" files only download if a page uses those characters.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("assets/fonts/instrument-serif-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("assets/fonts/instrument-serif-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Instrument Sans is a variable font: one file covers weights 400–500. */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: block;
  src: url("assets/fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 500;
  font-display: block;
  src: url("assets/fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Newsreader - reading serif for body content. Static cut tuned for
   text sizes (optical size 16), much smaller than the full variable font. */
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("assets/fonts/newsreader-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("assets/fonts/newsreader-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #000;
  --paper: #ecebe6; /* warm off-white, close to the drawing's line colour */
  --soft: rgb(236 235 230 / 0.72);
  --muted: rgb(236 235 230 / 0.5);
  --hairline: rgb(236 235 230 / 0.14);

  --serif: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif; /* display */
  --text-serif: "Newsreader", "Iowan Old Style", Georgia, serif; /* reading text */
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /*
    The source image is square; the temple fills ~50% of its height.
    Size it by viewport HEIGHT only, so changing the width never scales
    the drawing - narrower windows simply crop the left and right sides.
  */
  --temple-size: 125svh;

  /* Fixed wordmark size - does not change with window size. */
  --wordmark-size: 2.5rem; /* 40px */

  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

html {
  background: var(--ink);
  color-scheme: dark;
}

body {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto; /* header / main / footer */
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   Background drawing
   -------------------------------------------------------------------------- */

.backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop__image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: var(--temple-size);
  max-width: none;
  aspect-ratio: 1;
  /* Centre in the viewport (the temple is centred within the image). */
  translate: -50% -50%;
  user-select: none;
  -webkit-user-drag: none;
}

/* Home: slightly dimmed. */
.backdrop--home {
  opacity: 0.6;
}

/* About: strongly dimmed so the text stays readable over it. */
.backdrop--muted {
  opacity: 0.18;
}

/* --------------------------------------------------------------------------
   Header / wordmark
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem var(--gutter) 0;
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--wordmark-size);
  line-height: 0.9;
  letter-spacing: -0.015em;
  text-align: center;
  color: var(--paper);
}

/* On inner pages the wordmark is a link back home. */
a.wordmark {
  text-decoration: none;
}

a.wordmark:focus-visible {
  outline: 1px solid var(--paper);
  outline-offset: 6px;
}

/* --------------------------------------------------------------------------
   About page
   -------------------------------------------------------------------------- */

.about {
  display: grid;
  place-items: center;
  padding: 4rem var(--gutter);
}

.about__inner {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  text-align: center;
}

/* Hidden on screen, still read by screen readers and search engines. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.about__lead {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.25rem; /* 36px */
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--paper);
  text-wrap: balance;
}

.about__body {
  max-width: 28rem;
  margin: 1.75rem auto 0;
  font-family: var(--text-serif);
  font-size: 1.125rem; /* 18px - serifs read smaller than sans at the same size */
  line-height: 1.55;
  color: var(--soft);
  text-wrap: pretty;
}

@media (max-width: 560px) {
  .about__lead {
    font-size: 1.75rem; /* 28px */
  }

  .about__body {
    font-size: 1.0625rem; /* 17px */
  }
}

/* --------------------------------------------------------------------------
   Legal pages (privacy policy) - long-form, left-aligned for readability
   -------------------------------------------------------------------------- */

.legal {
  display: flex;
  justify-content: center;
  padding: 4rem var(--gutter) 6rem;
}

.legal__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 40rem;
}

.legal__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 2.75rem; /* 44px */
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--paper);
}

/* `.legal .legal__meta` so it outranks the generic `.legal p` rule below */
.legal .legal__meta {
  margin: 1rem 0 2.5rem;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Section titles ("Legal bases for processing", etc.): Newsreader */
.legal h2 {
  margin: 3.5rem 0 1rem;
  font-family: var(--text-serif);
  font-weight: 400;
  font-size: 1.5rem; /* 24px - Newsreader is wider than Instrument Serif */
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--paper);
}

/* Subheadings ("Information you give us"): Newsreader, set apart from body
   text by size and brighter colour. Weight stays 400 - only that weight is
   loaded, so anything heavier would be a blurry browser-faked bold. */
.legal h3 {
  margin: 2rem 0 0.5rem;
  font-family: var(--text-serif);
  font-size: 1.25rem; /* 20px */
  font-weight: 400;
  line-height: 1.3;
  color: var(--paper);
}

/* Reading text: Newsreader */
.legal p,
.legal li {
  font-family: var(--text-serif);
  font-size: 1.125rem; /* 18px */
  line-height: 1.6;
  color: var(--soft);
}

.legal p {
  margin: 0 0 1rem;
}

.legal ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal li + li {
  margin-top: 0.5rem;
}

.legal li::marker {
  color: var(--muted);
}

.legal a {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

.legal a:hover,
.legal a:focus-visible {
  text-decoration-color: var(--paper);
}

@media (max-width: 560px) {
  .legal {
    padding-top: 3rem;
  }

  .legal__title {
    font-size: 2.25rem; /* 36px */
  }

  .legal p,
  .legal li {
    font-size: 1.0625rem; /* 17px */
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

/* Name (left) · links (true centre) · © (right) */
.site-footer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem 2rem;
  margin: 0 var(--gutter);
  padding: 1.25rem 0 max(1.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer__name,
.site-footer__copy {
  margin: 0;
}

.site-footer__name {
  justify-self: start;
}

.site-footer__copy {
  justify-self: end;
}

.site-footer__nav ul {
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible,
.site-footer a[aria-current="page"] {
  color: var(--paper);
}

.site-footer a:focus-visible {
  outline: 1px solid var(--paper);
  outline-offset: 4px;
}

/* Phones: stack everything, centred - links on top, then name, then © */
@media (max-width: 560px) {
  .site-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .site-footer__name,
  .site-footer__copy {
    justify-self: center;
  }

  .site-footer__nav {
    order: -1;
  }

  .site-footer__nav ul {
    gap: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   Entrance motion
   -------------------------------------------------------------------------- */

/*
  The page is hidden while `.is-loading` is set - that rule is inlined in
  each page's <head> so it works even if this stylesheet fails to load.
  Animations only start once main.js removes `.is-loading`.
*/
@media (prefers-reduced-motion: no-preference) {
  html:not(.is-loading) .backdrop__image {
    animation: reveal 2.4s cubic-bezier(0.2, 0.6, 0.2, 1) both;
  }

  html:not(.is-loading) .wordmark {
    animation: rise 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both;
  }

  html:not(.is-loading) .about__inner,
  html:not(.is-loading) .legal__inner {
    animation: rise 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.45s both;
  }

  html:not(.is-loading) .site-footer {
    animation: fade 1.2s ease 0.8s both;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    scale: 1.03;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.25em);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}
