/* ============================================================
   Hurtorius.com — foundation, masthead & article typography
   A pure-dark page of luminous prose, set in Libre Baskerville.
   Long-form reading layout adapted from darioamodei.com's
   proportions into our candlelit dark palette.
   Visual effects live in effects.css; their JS in effects.js.
   ============================================================ */

:root {
  --bg:      #070708;   /* deep near-black, a breath of warmth */
  --ink:     #f3eee4;   /* faintly warm near-white — reads as white */
  --ink-dim: #cbc4b6;   /* recessive tone (quotes, captions, markers) */
  --gold:    #e9c878;   /* gilt accent — used sparingly */

  --measure:         34rem;   /* tight column (legacy / short pages) */
  --measure-article: 36rem;   /* ~576px reading column for long-form */

  /* Fluid-but-stable type scale (root-relative). Body stays fixed so
     the reading measure never shifts under the reader. */
  --fs-body:  1.1875rem;  /* 19px — Baskerville's small x-height wants this */
  --fs-small: 0.95rem;
  --fs-h3:    1.35rem;
  --fs-h2:    1.8rem;

  /* THE signature candle glow, tokenized so every effect speaks the
     same light. Four layers, NO blur filter: a sub-pixel inner layer
     keeps serifs razor-crisp, then warm-cream falloffs make the halo. */
  --text-glow:
    0 0 0.018em rgba(255, 251, 244, 0.50),
    0 0 0.5em   rgba(247, 233, 205, 0.20),
    0 0 1.7em   rgba(244, 228, 196, 0.10),
    0 0 3.6em   rgba(240, 222, 186, 0.045);
  --text-glow-strong:
    0 0 0.014em rgba(255, 251, 244, 0.55),
    0 0 0.55em  rgba(247, 233, 205, 0.22),
    0 0 1.9em   rgba(244, 228, 196, 0.11),
    0 0 4em     rgba(240, 222, 186, 0.05);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100svh;
  background-color: var(--bg);
  /* a soft warm pool, like a candle behind vellum — fixed, ambient */
  background-image: radial-gradient(
    54rem 42rem at 50% 28%,
    rgba(247, 233, 205, 0.05) 0%,
    rgba(247, 228, 190, 0.016) 46%,
    rgba(7, 7, 8, 0) 72%
  );
  background-attachment: fixed;
  background-repeat: no-repeat;

  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: var(--fs-body);
  line-height: 1.62;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  position: relative;
  overflow-x: hidden;
}

/* Barely-perceptible film grain over everything — gives the dark genuine
   depth (vellum, not a flat void). Felt as texture, not seen as noise. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;                 /* above content + candle, below progress bar */
  pointer-events: none;
  opacity: 0.38;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------
   MASTHEAD — the "Hurtorius" title with social links at the right
   ------------------------------------------------------------ */
/* ------------------------------------------------------------
   SITE HEADER — centred brand (square pfp · big name) + social, then a
   centred top nav. Everything middle-aligned, with a staggered load rise.
   ------------------------------------------------------------ */
.siteheader {
  text-align: center;
  padding: clamp(2.4rem, 8vh, 5rem) 1.5rem 0;
  position: relative;
  z-index: 1;
}
.siteheader__inner {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}
.brand__pfp {
  display: block;
  width: clamp(3rem, 8vw, 4rem);
  height: clamp(3rem, 8vw, 4rem);
  border-radius: 0;                 /* square — no rounded corners */
  background: #000;
  transition: transform 0.45s cubic-bezier(0.2, 0.6, 0.3, 1), filter 0.45s ease;
}
.brand:hover .brand__pfp { transform: scale(1.06); filter: drop-shadow(0 0 0.6em rgba(247, 233, 205, 0.4)); }
.brand__name {
  font-size: clamp(2.1rem, 4vw + 1rem, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-shadow: var(--text-glow-strong);
  white-space: nowrap;
  transition: text-shadow 0.4s ease;
}
.brand:hover .brand__name { text-shadow: var(--text-glow-strong), 0 0 1.4em rgba(255, 236, 196, 0.35); }

.siteheader__social { display: flex; justify-content: center; align-items: center; gap: 1.3rem; }
.siteheader__social .social-link svg { width: 1.55rem; height: 1.55rem; }

/* centred top nav, framed by hairlines; underline grows in on active/hover */
.topnav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 44rem;
  margin: 1.8rem auto 0;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(243, 238, 228, 0.12);
  border-bottom: 1px solid rgba(243, 238, 228, 0.12);
}
.topnav__link {
  position: relative;
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 0.25rem 0.15rem;
  transition: color 0.3s ease;
}
.topnav__link:hover { color: var(--ink); }
.topnav__link.is-active { color: var(--ink); text-shadow: var(--text-glow); }
.topnav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.9rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 196, 0.85), rgba(200, 210, 255, 0.3), transparent);
  box-shadow: 0 0 8px rgba(255, 236, 196, 0.45);
  transform: scaleX(0);
  transition: transform 0.35s cubic-bezier(0.2, 0.6, 0.3, 1);
}
.topnav__link:hover::after { transform: scaleX(0.6); }
.topnav__link.is-active::after { transform: scaleX(1); }
.topnav__link:focus-visible { outline: 2px solid rgba(247, 233, 205, 0.7); outline-offset: 4px; }

@media (max-width: 600px) {
  .brand { gap: 0.8rem; }
  .topnav { gap: 1.6rem; }
  .topnav__link { font-size: 0.74rem; letter-spacing: 0.18em; }
}

/* staggered load entrance for the header (skipped under reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  .brand              { animation: rise 0.9s cubic-bezier(0.2, 0.6, 0.3, 1) 0.05s both; }
  .siteheader__social { animation: rise 0.9s cubic-bezier(0.2, 0.6, 0.3, 1) 0.2s both; }
  .topnav             { animation: rise 0.9s cubic-bezier(0.2, 0.6, 0.3, 1) 0.34s both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   VIEWS — animated tab transitions (fade + slide).
   nav.js toggles .is-active / .is-entering / .is-leaving.
   ------------------------------------------------------------ */
.js .view { transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.6, 0.3, 1); }
.js .view:not(.is-active) { display: none; }
.js .view.is-active { opacity: 1; transform: none; }
.js .view.is-active.is-entering { opacity: 0; transform: translateY(18px); }
.js .view.is-active.is-leaving  { opacity: 0; transform: translateY(-14px); }

/* MAIN — the hero line, centred, with a gentle glow breath */
.main-view {
  display: grid;
  place-items: center;
  min-height: 46vh;
  padding: clamp(2rem, 7vh, 4.5rem) 1.5rem clamp(3rem, 9vh, 6rem);
  text-align: center;
}
.hero-line {
  margin: 0;
  max-width: 24rem;
  font-size: clamp(1.7rem, 1rem + 3vw, 2.8rem);
  line-height: 1.42;
  color: var(--ink);
  text-shadow: var(--text-glow-strong);
  text-wrap: balance;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-line { animation: rise 1s cubic-bezier(0.2, 0.6, 0.3, 1) 0.5s both, glow-breathe 6s ease-in-out 1.6s infinite; }
}
@keyframes glow-breathe {
  0%, 100% { text-shadow: var(--text-glow-strong); }
  50%      { text-shadow: var(--text-glow-strong), 0 0 1.6em rgba(255, 236, 196, 0.22); }
}

.social-link {
  display: inline-flex;
  color: var(--ink-dim);            /* visible, not pure black; fits the palette */
  opacity: 0.82;
  transition: color 0.25s ease, opacity 0.25s ease,
              transform 0.25s ease, filter 0.25s ease;
}
.social-link svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: currentColor;
  display: block;
}
.social-link:hover,
.social-link:focus-visible {
  color: var(--ink);                /* catches the candlelight */
  opacity: 1;
  transform: translateY(-1px);
  filter: drop-shadow(0 0 0.4em rgba(247, 233, 205, 0.55));
}
.social-link:focus-visible {
  outline: 2px solid rgba(247, 233, 205, 0.7);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   ARTICLE — the reading column
   ------------------------------------------------------------ */
.article {
  max-width: var(--measure-article);
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 3.2rem) 1.25rem clamp(4rem, 12vh, 7rem);
  position: relative;
  z-index: 1;
}

@media (max-width: 600px) {
  .masthead, .article { padding-left: 1rem; padding-right: 1rem; }
}

/* Block paragraphs, left-aligned (justified serif + glow = rivers of light). */
.article p {
  margin: 0 0 1em;
  text-align: left;
  text-wrap: pretty;
  hyphens: none;
}
.article p,
.article li { text-shadow: var(--text-glow); }

/* .prose keeps working standalone (color + glow). */
.prose { color: var(--ink); text-shadow: var(--text-glow); }
.name  { font-style: italic; letter-spacing: 0.012em; }

/* Lead paragraph — a touch larger and brighter; the page's first breath. */
.lead {
  font-size: 1.26rem;
  line-height: 1.6;
  color: var(--ink);
  text-shadow: var(--text-glow-strong);
}

/* Headings — differentiated by size + spacing + glow, not heavy body weight.
   Bold Baskerville is fine at heading size; risky at body size. */
.article h1, .article h2, .article h3 {
  color: var(--ink);
  text-shadow: var(--text-glow-strong);
  text-wrap: balance;
}
.article h1 {
  font-size: clamp(2.3rem, 6vw + 1rem, 3.25rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
}
.article h2 {
  font-size: var(--fs-h2);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.005em;
  margin: 2.6em 0 0.55em;
}
.article h3 {
  font-size: var(--fs-h3);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 2em 0 0.4em;
}

/* Links — Dario's restraint: same ink, a dim warm underline that catches
   the candlelight on hover. No jarring colored links. */
.article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(243, 238, 228, 0.32);
  text-decoration-thickness: 0.5px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.25s ease, text-shadow 0.25s ease;
}
.article a:hover {
  text-decoration-color: rgba(255, 247, 230, 0.85);
  text-shadow: var(--text-glow);
}
.article a:focus-visible {
  outline: 2px solid rgba(247, 233, 205, 0.7);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Lists — warm candlelight bullets; numerals recede so text leads. */
.article ul, .article ol { margin: 0 0 1em; padding-left: 1.9rem; }
.article li { margin-bottom: 0.35rem; line-height: 1.62; }
.article ul { list-style: none; }
.article ul > li { position: relative; }
.article ul > li::before {
  content: "·";
  position: absolute;
  left: -1.1rem;
  color: rgba(255, 236, 196, 0.6);
  text-shadow: 0 0 0.45em rgba(255, 236, 196, 0.5);
}
.article ol { list-style: decimal; }
.article ol > li::marker { color: var(--ink-dim); }

/* Blockquote — a hush: recessive, italic, lit by one warm edge. */
.article blockquote {
  margin: 1.8em 0;
  padding: 0.1em 0 0.1em 1.4rem;
  border-left: 1px solid rgba(255, 236, 196, 0.22);
  font-style: italic;
  color: var(--ink-dim);
}
.article blockquote p:last-child { margin-bottom: 0; }

/* Figures */
.article figure { margin: 2em 0; }
.article figcaption {
  margin-top: 0.6em;
  font-size: var(--fs-small);
  color: var(--ink-dim);
  text-align: center;
}

/* Footnotes — base styling (effects.css adds the refraction glint + flare). */
.footnotes {
  margin-top: 3em;
  padding-top: 1.4em;
  border-top: 1px solid rgba(243, 238, 228, 0.1);
  font-size: var(--fs-small);
  color: var(--ink-dim);
}
.footnotes li { margin-bottom: 0.5rem; }
.footnote { scroll-margin-top: 4rem; }   /* clear the fixed progress bar */

/* Reduced motion: the static page is already the finished page. */
@media (prefers-reduced-motion: reduce) {
  body { background-attachment: scroll; }
}

/* ============================================================
   PROJECTS — an illuminated register of works (paper / index vibe)
   A numbered list set in the page's own voice: roman numeral · title ·
   one line · year, with hairline rules between entries. On hover/focus
   the line catches the candlelight and a gilt rule lights in the left
   margin (an illuminated initial). Reuses tokens + .heading-lum / .reveal.
   Luminance over motion — it should read like a paper's contents page.
   ============================================================ */
.works {
  max-width: 38rem;                 /* stays close to the reading column */
  margin: clamp(3rem, 9vh, 5.5rem) auto;
  padding: 0 1.25rem;
  position: relative;
  z-index: 1;
}
.works > .heading-lum {
  font-size: var(--fs-h2);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.005em;
  margin: 0;
}
.works__intro {
  max-width: 34rem;
  margin: 1em 0 1.8em;
  color: var(--ink-dim);
  text-shadow: var(--text-glow);
  text-wrap: pretty;
}

.works__list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: work;
  border-top: 1px solid rgba(243, 238, 228, 0.12);
}
.works__list > li { margin: 0; }

/* a register row: numeral · (title + line) · year */
.work {
  position: relative;
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: baseline;
  column-gap: 1.1rem;
  padding: 1.15rem 0.2rem 1.15rem 1.2rem;
  text-decoration: none;
  color: var(--ink-dim);
  border-bottom: 1px solid rgba(243, 238, 228, 0.12);
  transition: color 0.4s ease, padding-left 0.4s ease;
}
/* gilt sentinel rule in the margin — an illuminated initial, lit on hover */
.work::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 60%;
  transform: translateY(-50%) scaleY(0);
  transform-origin: 50% 50%;
  background: linear-gradient(rgba(233, 200, 120, 0), var(--gold), rgba(233, 200, 120, 0));
  box-shadow: 0 0 8px rgba(233, 200, 120, 0.5);
  transition: transform 0.45s cubic-bezier(0.2, 0.6, 0.3, 1);
}
.work__index {
  align-self: baseline;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: rgba(233, 200, 120, 0.62);    /* gilt roman numeral */
  text-shadow: var(--text-glow);
}
.work__index::before { counter-increment: work; content: counter(work, upper-roman); }
.work__main { min-width: 0; }
.work__title {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
  text-shadow: var(--text-glow);
  transition: color 0.4s ease, text-shadow 0.4s ease;
}
.work__desc {
  display: block;
  margin-top: 0.3rem;
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink-dim);
  text-shadow: var(--text-glow);
  text-wrap: pretty;
}
.work__year {
  align-self: baseline;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: rgba(223, 230, 242, 0.4);     /* cool, recessive — a marginal date */
  white-space: nowrap;
}

/* lit: hover OR keyboard focus = the line catches the candlelight */
.work:hover, .work:focus-visible { color: var(--ink); padding-left: 1.55rem; }
.work:hover::before, .work:focus-visible::before { transform: translateY(-50%) scaleY(1); }
.work:hover .work__title, .work:focus-visible .work__title { color: var(--ink); text-shadow: var(--text-glow-strong); }
.work:focus-visible { outline: 2px solid rgba(247, 233, 205, 0.7); outline-offset: 4px; border-radius: 2px; }

@media (max-width: 600px) {
  .works { padding-left: 1rem; padding-right: 1rem; }
  .work { grid-template-columns: 1.8rem 1fr auto; column-gap: 0.8rem; padding-left: 1rem; }
  .work:hover, .work:focus-visible { padding-left: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .work, .work__title, .work::before { transition: none; }
}

@media (forced-colors: active) {
  .works__list, .work { border-color: CanvasText; }
  .work::before { background: CanvasText; box-shadow: none; }
  .work:focus-visible { outline: 2px solid Highlight; }
}
