/* Alfaopus — shared stylesheet.
   Dark navy ground, ivory text, brass accent. Bodoni Moda for display,
   IBM Plex Sans for prose, IBM Plex Mono for the register/label voice.

   Fonts are SELF-HOSTED, not loaded from the Google Fonts CDN. That keeps the
   `default-src 'none'` CSP intact and keeps the privacy statement true: no
   request on this site reaches a third party. They are subset to Latin +
   Latin-1 + the punctuation used here, and instanced to weight 400 (Bodoni and
   Plex Sans are used at one weight only), which takes them from 224KB to 54KB.
   Bodoni keeps its optical-size axis so it adapts between the 20px thesis and
   the 46px wordmark. */

/* ---------- Faces ---------- */

@font-face {
  font-family: "Bodoni Moda";
  src: url("/assets/fonts/bodoni-moda.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Bodoni Moda has no Greek, so the masthead alpha would otherwise fall back to
   whatever serif the visitor happens to have — or to tofu. This is a 772-byte
   face holding exactly one glyph, fetched only because U+03B1 is on the page. */
@font-face {
  font-family: "Alfaopus Alpha";
  src: url("/assets/fonts/alfaopus-alpha.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+03B1;
}

/* ---------- Tokens ---------- */

:root {
  --ink:        #0F1626;
  --ink-raised: #151E32;
  --ivory:      #F2EFE7;
  --muted:      #98A1B4;
  --brass:      #C9A961;
  --rule:       rgba(242, 239, 231, .14);

  --measure: 34rem;

  --display: "Bodoni Moda", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(3rem, 10vw, 6.5rem) 1.5rem clamp(3rem, 8vw, 5rem);
}

a { color: inherit; }

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

/* ---------- Masthead ---------- */

.mark {
  display: flex;
  align-items: baseline;
  gap: .7rem;
}

.alpha {
  font-family: "Alfaopus Alpha", var(--display);
  font-size: 1.6rem;
  color: var(--brass);
  line-height: 1;
}

.wordmark {
  font-family: var(--display);
  font-size: clamp(2.1rem, 8vw, 2.9rem);
  font-weight: 400;
  letter-spacing: .055em;
  line-height: 1;
  margin: 0;
}

.masthead-rule {
  height: 1px;
  background: var(--brass);
  margin: 1.6rem 0 2.2rem;
  transform-origin: left;
}

.thesis {
  font-family: var(--display);
  font-size: clamp(1.25rem, 4.6vw, 1.55rem);
  line-height: 1.45;
  margin: 0 0 .8rem;
  max-width: 26ch;
}

.thesis-sub {
  color: var(--muted);
  margin: 0;
  max-width: 44ch;
}

/* ---------- Sections ---------- */

section { margin-top: clamp(3rem, 9vw, 4.5rem); }

.eyebrow {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.6rem;
}

.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ---------- Works catalogue ---------- */

.work {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0 1rem;
  align-items: baseline;
  text-decoration: none;
  padding: 1.15rem 0;
  border-top: 1px solid var(--rule);
}

.work:last-of-type { border-bottom: 1px solid var(--rule); }

.opus {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--brass);
  letter-spacing: .04em;
}

.work-name {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: .01em;
}

.work-note {
  grid-column: 2;
  color: var(--muted);
  font-size: .94rem;
  margin-top: .15rem;
}

/* The outbound arrow is an inline SVG, not the character U+2197: none of the
   three typefaces here carry that glyph, so as text it would fall back to an
   arbitrary system font or render as tofu. */
.work-arrow {
  width: .62em;
  height: .62em;
  margin-left: .5rem;
  color: var(--brass);
  opacity: 0;
  vertical-align: baseline;
}

@media (prefers-reduced-motion: no-preference) {
  .work-arrow { transition: opacity .25s ease, transform .25s ease; }
}

a.work:hover .work-arrow,
a.work:focus-visible .work-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.work--pending .opus,
.work--pending .work-name { color: var(--muted); }

/* ---------- Prose ---------- */

p.body {
  margin: 0 0 1rem;
  max-width: 46ch;
}

p.body:last-child { margin-bottom: 0; }

.contact-line {
  font-family: var(--display);
  font-size: 1.3rem;
  margin: 0;
}

.contact-line a {
  display: inline-block;
  text-decoration: none;
  border-bottom: 1px solid var(--brass);
  padding-bottom: 1px;
}

/* Was an inline style attribute in the source design. Moved to a class because
   `style-src 'self'` blocks style attributes — they need 'unsafe-inline', and
   weakening the CSP for one margin is the wrong trade. */
/* `p.` prefix is load-bearing: `p.body` above sets the `margin` shorthand,
   so a bare `.contact-note` (lower specificity) loses margin-top to it. */
p.contact-note { margin-top: 1.1rem; }

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

footer {
  margin-top: clamp(3rem, 9vw, 4.5rem);
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem 1.2rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
}

footer a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  /* WCAG 2.2 target size: these are standalone links, so they need a 24px
     hit area even though the type is small. */
  padding: .5rem 0;
}

footer a:hover {
  color: var(--ivory);
  border-color: var(--brass);
}

/* ---------- Document pages (legal, privacy, terms, 404) ---------- */

.back {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem 0;
  margin-bottom: 2.4rem;
}

.back:hover { color: var(--ivory); }

.back svg { width: .8em; height: .8em; }

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
  letter-spacing: .02em;
  line-height: 1.2;
  margin: 0 0 .6rem;
}

.lede {
  color: var(--muted);
  margin: 0 0 2.6rem;
  max-width: 44ch;
}

.doc .eyebrow { margin: 2.6rem 0 1.2rem; }

dl {
  margin: 0;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.8;
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: .55rem 1rem;
}

dt { color: var(--muted); }
dd { margin: 0; }

dd a {
  display: inline-block;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding: .1rem 0;
}

dd a:hover { border-color: var(--brass); }

.doc p.body {
  font-size: .95rem;
  color: var(--muted);
}

.doc p.body a { color: var(--ivory); }

.doc ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  max-width: 46ch;
  font-size: .95rem;
  color: var(--muted);
}

.doc li { margin-bottom: .35rem; }

.doc li > a:only-child {
  display: inline-block;
  color: var(--ivory);
  padding: .2rem 0;
}

.doc li a { color: var(--ivory); }

@media (max-width: 30rem) {
  dl { grid-template-columns: 1fr; gap: .1rem; }
  dt { margin-top: .9rem; }
}

/* ---------- Load sequence ---------- */

@media (prefers-reduced-motion: no-preference) {
  .mark, .thesis, .thesis-sub, section, footer {
    animation: rise .7s cubic-bezier(.2, .7, .3, 1) backwards;
  }
  .mark { animation-delay: .05s; }
  .thesis { animation-delay: .18s; }
  .thesis-sub { animation-delay: .24s; }
  section:nth-of-type(1) { animation-delay: .32s; }
  section:nth-of-type(2) { animation-delay: .38s; }
  section:nth-of-type(3) { animation-delay: .44s; }
  footer { animation-delay: .55s; }
  .masthead-rule { animation: draw .8s cubic-bezier(.2, .7, .3, 1) .1s backwards; }
  .alpha { animation: kindle 1.4s ease-out .3s backwards; }
}

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

@keyframes draw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes kindle {
  0%   { opacity: .25; }
  45%  { opacity: 1; text-shadow: 0 0 18px rgba(201, 169, 97, .55); }
  100% { opacity: 1; text-shadow: none; }
}
