@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/InstrumentSerif-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/InstrumentSans.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/InstrumentSans-Italic.ttf") format("truetype");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Exact hand-study paper (#ECE7DD) so the field is continuous */
  --paper: #ece7dd;
  --ink: #141413;
  --muted: #6a6963;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino,
    serif;
  --sans: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 20;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper);
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

.top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.35rem clamp(1.25rem, 3vw, 2.5rem);
  pointer-events: none;
}

.top a {
  pointer-events: auto;
}

.mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  text-decoration: none;
  opacity: 0;
  animation: fade-in 1s var(--ease) 0.1s forwards;
}

.mark__glyph {
  display: block;
  font-family: var(--serif);
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: -0.05em;
  color: var(--ink);
}

.mail {
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  opacity: 0;
  animation: fade-in 1s var(--ease) 0.2s forwards;
  transition: color 0.25s ease;
}

.mail:hover,
.mail:focus-visible {
  color: var(--ink);
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: clip;
}

.hands {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hands__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Keep the meeting hands lower so Tacitus sits in open paper */
  object-position: 50% 72%;
  animation: reveal-hands 1.5s var(--ease) both;
}

.identity {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 1.25rem 42vh;
  margin-top: -8vh;
}

.brand {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(4.6rem, 14vw, 9.5rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.04em;
  opacity: 0;
  animation: fade-in 1.15s var(--ease) 0.35s forwards;
}

h1 {
  margin: 0.55rem 0 0;
  font-family: var(--sans);
  font-size: clamp(0.78rem, 1.4vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  animation: fade-in 1.15s var(--ease) 0.5s forwards;
}

.page--short {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.not-found {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 1.25rem 10vh;
}

.not-found .brand,
.not-found h1 {
  animation: none;
  opacity: 1;
}

.not-found .brand {
  font-size: clamp(3.2rem, 12vw, 6rem);
}

.not-found h1 {
  letter-spacing: 0.08em;
  text-transform: none;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  font-weight: 500;
  color: var(--ink);
  max-width: 18ch;
}

.return-link {
  margin-top: 1.75rem;
}

.return-link a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.return-link a:hover,
.return-link a:focus-visible {
  color: var(--ink);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes reveal-hands {
  from {
    transform: scale(1.03);
  }
  to {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .mark,
  .mail,
  .brand,
  h1,
  .hands__image {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  .top {
    padding: 1.1rem 1.15rem;
  }

  .mail {
    font-size: 0.75rem;
  }

  .hands__image {
    object-position: 50% 68%;
  }

  .identity {
    margin-top: 0;
    padding-bottom: 46vh;
  }

  h1 {
    letter-spacing: 0.32em;
  }
}
