/* ============================================
   Morgan Alder — author site
   ============================================ */

/* ---- Self-hosted EB Garamond (variable, latin subset) ---- */

@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/ebgaramond-roman.woff2') format('woff2');
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/ebgaramond-italic.woff2') format('woff2');
}

:root {
  /* Paper and ink. The ground is a warm off-white rather than pure
     white so the page reads as a printed page, not a screen. */
  --paper: #faf7f1;
  --paper-edge: #f2ede4;
  --ink: #1c1a17;
  --ink-soft: #4a4640;
  --ink-faint: #8a8378;
  --rule: #d8d1c4;
  --accent: #7a3b2e; /* oxblood, used sparingly for links */

  --font: 'EB Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino,
    Georgia, 'Times New Roman', serif;

  --measure: 34rem;
  --transition: 0.25s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14120f;
    --paper-edge: #1b1815;
    --ink: #ece6da;
    --ink-soft: #b3aa9b;
    --ink-faint: #7d7568;
    --rule: #35302a;
    --accent: #c98a6b;
  }
}

/* ---- Reset ---- */

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1.0625rem, 0.98rem + 0.42vw, 1.25rem);
  font-weight: 400;
  line-height: 1.65;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Layout ----
   One centred column. The page is a single screen on desktop and
   scrolls naturally when the viewport is short. */

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2.5rem, 8vh, 6rem) clamp(1.5rem, 6vw, 3rem);
}

.masthead {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
}

/* ---- Name ---- */

.name {
  font-size: clamp(2.5rem, 1.9rem + 3vw, 4.25rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.005em;
  margin-bottom: 1.1rem;
}

.role {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 2.25rem;
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin-bottom: 2.25rem;
}

/* ---- Body copy ---- */

.note {
  color: var(--ink-soft);
  max-width: 30rem;
}

.note + .note {
  margin-top: 1.15rem;
}

.note em {
  font-style: italic;
  color: var(--ink);
}

/* ---- Contact ---- */

.contact {
  margin-top: 2.75rem;
}

.contact-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding-bottom: 0.05em;
  transition: border-color var(--transition), color var(--transition);
}

a:hover,
a:focus-visible {
  border-bottom-color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

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

.colophon {
  margin-top: clamp(3rem, 10vh, 5.5rem);
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

/* ---- Motion ----
   A single quiet entrance. Nothing loops, nothing repeats. */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
  }

  .reveal:nth-child(1) { animation-delay: 0.05s; }
  .reveal:nth-child(2) { animation-delay: 0.14s; }
  .reveal:nth-child(3) { animation-delay: 0.21s; }
  .reveal:nth-child(4) { animation-delay: 0.28s; }
  .reveal:nth-child(5) { animation-delay: 0.35s; }
  .reveal:nth-child(6) { animation-delay: 0.42s; }
  .reveal:nth-child(7) { animation-delay: 0.49s; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Print ---- */

@media print {
  :root {
    --paper: #ffffff;
    --ink: #000000;
    --ink-soft: #222222;
    --ink-faint: #555555;
  }

  .page {
    min-height: 0;
  }

  .reveal {
    animation: none;
  }

  a {
    border-bottom: 0;
  }
}
