/* Element defaults and page layouts. Reads roles from identity.css and
   declares no color, face or size of its own. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--body-md);
  line-height: var(--body-md-lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── theme selector ──────────────────────────────────────────────────────────
   Fixed to the top right on every page. A sunken track holds three options;
   the chosen one sits on the surface, one step off the page. */

.theme {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 10;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-sunken);
}

.theme__option {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard);
}

.theme__option:hover,
.theme__option:has(input:checked) {
  color: var(--text);
}

.theme__option:has(input:checked) {
  background: var(--surface);
}

.theme__option:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.theme__option svg {
  width: 1rem;
  height: 1rem;
}

/* ── footer ──────────────────────────────────────────────────────────────── */

.site-footer {
  padding: var(--space-6);
  color: var(--text-muted);
  font-size: var(--caption);
  line-height: var(--caption-lh);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* ── home ────────────────────────────────────────────────────────────────────
   Two equal outer rows keep the title on the true center of the viewport,
   and the footer rests at the bottom of the lower one. */

.home {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
}

.home main {
  grid-row: 2;
  padding-inline: var(--space-6);
}

.home .site-footer {
  grid-row: 3;
  align-self: end;
}

.home__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(var(--display-md), 7vw, var(--display-xl));
  line-height: var(--display-xl-lh);
  letter-spacing: var(--display-xl-ls);
  text-align: center;
}
