/* ===========================================================
   mathewmoxness.com — Nocturne
   A single typeface. A centered measure. The name is small
   and the thinking is large.
   =========================================================== */

/* ---------- 1. Type (self-hosted, subset, no third-party requests) ---------- */

@font-face {
  font-family: "Spectral";
  src: url("../fonts/Spectral-Light.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("../fonts/Spectral-LightItalic.woff2") format("woff2");
  font-weight: 300; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("../fonts/Spectral-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("../fonts/Spectral-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Spectral SC";
  src: url("../fonts/SpectralSC-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------- 2. Tokens ----------
   Every text color below clears WCAG AA against --night; body and
   headings clear AAA. Thin light type on a dark ground is the one
   place this design can fail a reader, so it doesn't. */

:root {
  --night:  #0c0b09;   /* ground                                   */
  --raised: #131211;   /* form fields                              */
  --bone:   #e9e4da;   /* headings, statements        15.5:1  AAA  */
  --soft:   #aaa298;   /* body prose                   7.8:1  AAA  */
  --mute:   #9a948a;   /* small-caps labels, nav       6.5:1  AA   */
  --faint:  #857f75;   /* numerals, quietest text      5.0:1  AA   */
  --rule:   #2a2823;   /* hairlines (non-text)                     */

  --serif: "Spectral", "Iowan Old Style", Georgia, serif;
  --caps:  "Spectral SC", "Spectral", Georgia, serif;

  /* Note what is not large: the name. */
  --t-statement: clamp(1.6rem, 4.2vw, 2.9rem);
  --t-h2:        clamp(1.2rem, 2.3vw, 1.6rem);
  --t-body:      1.0625rem;
  --t-caps:      0.8125rem;
  --t-caps-sm:   0.6875rem;

  --measure: 33rem;
  --pad:   clamp(1.5rem, 6vw, 3rem);
  --space: clamp(4.5rem, 11vw, 8.5rem);
  --ease:  cubic-bezier(0.25, 0.6, 0.3, 1);
}

/* ---------- 3. Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--soft);
  font-family: var(--serif);
  font-weight: 400;          /* Light is reserved for display sizes */
  font-size: var(--t-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* The only light in the room. */
body::before {
  content: "";
  position: fixed;
  inset: -20vh 0 auto 0;
  height: 90vh;
  background: radial-gradient(60% 55% at 50% 0%, rgba(233, 228, 218, 0.05), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.2; color: var(--bone); }
p { margin: 0 0 1.35em; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }

::selection { background: var(--bone); color: var(--night); }

:focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 4px;
  border-radius: 1px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--bone); color: var(--night);
  padding: 0.8rem 1.25rem;
  font-family: var(--caps); font-weight: 500;
  font-size: var(--t-caps-sm); letter-spacing: 0.18em;
  text-decoration: none;
}
.skip:focus { left: 0; }

.vh {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Everything lives in one centered measure. */
.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--pad);
  position: relative;
  z-index: 1;
}

.center { text-align: center; }

/* Small caps carry every label on the site. */
.sc {
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps);
  letter-spacing: 0.22em;
  color: var(--mute);
  margin: 0;
}
.sc--sm { font-size: var(--t-caps-sm); letter-spacing: 0.26em; }

/* A short centered hairline — the only structural device on the site. */
.mark-rule {
  width: 44px; height: 1px;
  background: var(--rule);
  margin: clamp(2rem, 4vw, 3rem) auto;
  border: 0;
}

/* ---------- 4. Navigation ---------- */

.nav {
  padding-block: clamp(1.75rem, 3.5vw, 2.5rem);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 4vw, 3rem);
  position: relative;
  z-index: 2;
}
.nav a {
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps-sm);
  letter-spacing: 0.24em;
  text-decoration: none;
  color: var(--mute);
  padding-block: 0.35rem;
  border-bottom: 1px solid transparent;
  transition: color 450ms var(--ease), border-color 450ms var(--ease);
}
.nav a:hover { color: var(--bone); }
.nav a[aria-current="page"] { color: var(--bone); border-bottom-color: var(--rule); }

/* ---------- 5. Hero ---------- */

.hero { padding-block: clamp(3.5rem, 10vw, 8rem) clamp(3rem, 7vw, 5.5rem); }

.hero-name {
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps);
  letter-spacing: 0.42em;
  text-indent: 0.42em;      /* balances the trailing letterspace */
  color: var(--bone);
}

.statement {
  font-size: var(--t-statement);
  font-weight: 300;
  line-height: 1.26;
  letter-spacing: -0.012em;
  color: var(--bone);
  max-width: 22ch;
  margin-inline: auto;
  text-wrap: balance;
}
.statement--sm {
  font-size: var(--t-h2);
  line-height: 1.4;
  max-width: 30ch;
}

.hero-roles  { margin-top: clamp(2.25rem, 4.5vw, 3.25rem); color: var(--bone); }
.hero-fields { margin-top: 0.9rem; }

/* ---------- 6. Sections ---------- */

.sec { padding-block: 0 var(--space); }

.sec-open { padding-top: clamp(1.5rem, 5vw, 3.5rem); }

.entry { padding-block: clamp(2.5rem, 5.5vw, 4rem) 0; }

.numeral {
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps-sm);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--faint);
  margin: 0 0 1.5rem;
  font-variant-numeric: normal;
}

.entry-title {
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  color: var(--mute);
  margin-bottom: 1.4rem;
}

.entry-statement {
  font-size: var(--t-h2);
  font-weight: 300;
  font-style: italic;
  line-height: 1.4;
  color: var(--bone);
  margin-bottom: 1.5rem;
  max-width: 26ch;
  margin-inline: auto;
  text-wrap: balance;
}

.entry-body { text-align: left; }

/* ---------- 7. Prose ---------- */

.prose { text-align: left; }
.prose .lead {
  font-size: var(--t-h2);
  font-weight: 300;
  line-height: 1.5;
  color: var(--bone);
  margin-bottom: 1.5em;
}
.prose .close {
  font-style: italic;
  color: var(--bone);
  margin-top: 2em;
  padding-top: 1.6em;
  border-top: 1px solid var(--rule);
}
.prose h2 {
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps-sm);
  letter-spacing: 0.24em;
  color: var(--mute);
  margin: 2.8em 0 1em;
}

.link {
  color: var(--bone);
  text-decoration: none;
  border-bottom: 1px solid var(--faint);
  transition: border-color 400ms var(--ease);
}
.link:hover { border-bottom-color: var(--bone); }

/* ---------- 8. Form ---------- */

.form { margin-top: 2.5rem; text-align: left; }
.field { margin-bottom: 1.9rem; }
.field label {
  display: block;
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps-sm);
  letter-spacing: 0.24em;
  color: var(--mute);
  margin-bottom: 0.65rem;
}
.field input,
.field textarea {
  width: 100%;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--bone);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  padding: 0.8rem 0.9rem;
  transition: border-color 400ms var(--ease);
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--mute); }
.field input:focus-visible,
.field textarea:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; }
.field .err {
  display: none;
  margin: 0.55rem 0 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--bone);
}
.field.is-error input,
.field.is-error textarea { border-color: var(--mute); }
.field.is-error .err { display: block; }

/* honeypot — off-screen, never focusable */
.trap {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

.btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--faint);
  color: var(--bone);
  font-family: var(--caps);
  font-weight: 500;
  font-size: var(--t-caps-sm);
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  padding: 1rem 2.25rem;
  cursor: pointer;
  transition: background-color 450ms var(--ease), color 450ms var(--ease),
              border-color 450ms var(--ease);
}
.btn:hover { background: var(--bone); border-color: var(--bone); color: var(--night); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn[disabled]:hover { background: transparent; color: var(--bone); border-color: var(--faint); }

.form-note {
  margin-top: 1.6rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--faint);
}
.status {
  display: none;
  margin-top: 1.2rem;
  font-style: italic;
  color: var(--bone);
}
.status.is-on { display: block; }

/* ---------- 9. Footer ---------- */

.foot {
  padding-block: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--rule);
  margin-top: var(--space);
}
.foot p + p { margin-top: 0.85rem; }
.foot a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 400ms var(--ease), color 400ms var(--ease);
}
.foot a:hover { color: var(--bone); border-bottom-color: var(--faint); }

/* ---------- 10. Motion: slow, and only once ---------- */

.rise {
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 1100ms var(--ease), transform 1100ms var(--ease);
}
.rise.is-in { opacity: 1; transform: none; }

/* No script, no hidden content. */
.no-js .rise { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
  .rise { opacity: 1; transform: none; }
}

/* ---------- 11. Responsive ----------
   A centered measure is already a phone layout, so little changes. */

@media (max-width: 540px) {
  :root { --t-caps: 0.75rem; }
  .hero-name { letter-spacing: 0.28em; text-indent: 0.28em; }
  .nav { gap: 1rem 1.1rem; }
  .statement { max-width: 18ch; }
  .entry-statement { max-width: 22ch; }
}

/* ---------- 12. Print ---------- */

@media print {
  body { background: #fff; color: #000; }
  body::before, .nav, .form, .btn { display: none; }
  .statement, h1, h2, h3, .prose .close { color: #000; }
  .sc, .numeral, .entry-title { color: #444; }
}
