/* ============================================================
   Take Care of Language — penumbra design system
   A single hand-written stylesheet. No Bootstrap, no resets
   from libraries. Motif: vagueness — the passage from blur to
   clarity, the penumbra of borderline cases, the sorites heap.
   ============================================================ */

:root {
  /* paper & ink */
  --paper:      #faf8f3;
  --paper-2:    #f3efe5;
  --paper-3:    #ece6d8;
  --ink:        #221f1a;
  --ink-soft:   #4a443b;
  --muted:      #857c6c;

  /* the single penumbral accent (a borderline gold) */
  --accent:     #7a5c2e;
  --accent-2:   #9a7b43;
  --accent-pale:#cdb98e;

  --line:       rgba(34, 31, 26, 0.12);
  --line-soft:  rgba(34, 31, 26, 0.06);

  /* type */
  --serif:   "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "Spectral", Georgia, Cambria, "Times New Roman", serif;
  --display: "Baskerville", "Hoefler Text", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono:    ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --measure: 64ch;
  --gap:     clamp(1.2rem, 4vw, 3rem);
  --radius:  2px;
}

/* ---------- reset (minimal) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- base ---------- */
body {
  font-family: var(--serif);
  font-size: clamp(1.02rem, 0.55vw + 0.92rem, 1.18rem);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.18; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p  { max-width: var(--measure); }
p + p { margin-top: 1.05em; }

a.link, .prose a:not(.btn), .ref a, footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-pale);
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
a.link:hover, .prose a:not(.btn):hover, .ref a:hover, footer a:hover {
  color: var(--accent-2); border-color: var(--accent-2);
}
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 1px; }

em, i { font-style: italic; }
strong { font-weight: 600; }
hr { border: 0; height: 1px; background: var(--line); margin: 3rem 0; }
::selection { background: rgba(154, 123, 67, 0.22); }

/* ---------- layout ---------- */
.wrap { width: min(100% - 2.4rem, 1140px); margin-inline: auto; }
.prose { width: min(100% - 2.4rem, 72ch); margin-inline: auto; }
.lede { font-size: 1.18em; color: var(--ink-soft); line-height: 1.7; }
.section { padding-block: clamp(3rem, 8vw, 6.5rem); }
.section--paper2 { background: var(--paper-2); }
.center { text-align: center; }

/* soft penumbral divider instead of a hard rule */
.penumbra-rule {
  height: 1px; border: 0; margin: 0;
  background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}

/* eyebrow / small-caps section label */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.74rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.9rem;
}
.eyebrow::before { content: "§ "; color: var(--accent-pale); }

/* ---------- the sorites strip (a heap fading grain by grain) ---------- */
.sorites {
  height: 14px; width: clamp(120px, 30vw, 280px);
  background-image: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 9px);
  -webkit-mask-image: linear-gradient(90deg, #000 35%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 35%, transparent 100%);
  opacity: 0.42;
}
.sorites--center { margin-inline: auto; }
.sorites--accent { background-image: repeating-linear-gradient(90deg, var(--accent) 0 2px, transparent 2px 9px); opacity: 0.6; }

/* ---------- header / nav ---------- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.site-head__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.85rem; }
.brand { display: inline-flex; align-items: baseline; gap: 0.5ch; font-family: var(--display); font-size: 1.3rem; font-weight: 600; letter-spacing: 0.01em; text-decoration: none; color: var(--ink); }
.brand .lam { font-family: var(--mono); color: var(--accent); font-size: 1.15em; line-height: 1; filter: blur(0.4px); }
.brand:hover .lam { filter: blur(0); }

.nav { display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 1.8rem); }
.nav a {
  font-size: 0.95rem; text-decoration: none; color: var(--ink-soft);
  padding-bottom: 2px; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.6rem; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; transition: transform .25s; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 100%; right: 0; left: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; transition: max-height .3s ease;
  }
  .nav a { width: 100%; padding: 0.85rem 1.2rem; border-bottom: 1px solid var(--line-soft); }
  .site-head.open .nav { max-height: 60vh; }
  .site-head.open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .site-head.open .nav-toggle span:nth-child(2) { opacity: 0; }
  .site-head.open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* ---------- hero ---------- */
.hero { position: relative; padding-block: clamp(4rem, 14vh, 9rem); overflow: hidden; }
.hero__inner { max-width: 56ch; }
.hero h1 { margin-bottom: 1.2rem; }
.hero .lede { margin-bottom: 2rem; }
.hero__theme { font-family: var(--display); font-style: italic; color: var(--accent); }

/* the title resolves from blur to clarity once on load */
.blur-in { animation: blurIn 1.6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes blurIn {
  from { filter: blur(14px); opacity: 0; letter-spacing: 0.04em; }
  60%  { filter: blur(3px);  opacity: 1; }
  to   { filter: blur(0);    opacity: 1; letter-spacing: -0.01em; }
}

/* a faint penumbra glow behind the hero */
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 420px; z-index: -1;
  background: radial-gradient(60% 70% at 30% 30%, rgba(154,123,67,0.10), transparent 70%);
  pointer-events: none;
}

.btnrow { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 0.5rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5ch;
  font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.04em;
  padding: 0.7rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); background: var(--paper);
  transition: border-color .2s, background .2s, transform .2s;
}
.btn:hover { border-color: var(--accent); background: var(--paper-2); transform: translateY(-1px); }
.btn--solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--solid:hover { background: #000; color: #fff; }
.btn .arr { color: var(--accent-2); }

/* ---------- reveal: a pure-CSS entrance animation with no JS dependency, so
   content is always visible even if scripts fail to load ---------- */
.reveal { animation: reveal 1s cubic-bezier(.2,.7,.2,1) both; }
@keyframes reveal { from { opacity: 0; filter: blur(7px); transform: translateY(10px); } to { opacity: 1; filter: blur(0); transform: none; } }

/* ---------- card grid ---------- */
.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.6rem 1.5rem;
  transition: border-color .25s, transform .25s, box-shadow .25s;
}
.card:hover { border-color: var(--accent-pale); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(34,31,26,0.06); }
.card h3 { margin-bottom: 0.4rem; }
.card h3 a { text-decoration: none; }
.card .meta { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.8rem; }
.card p { color: var(--ink-soft); font-size: 0.98rem; }

/* ---------- bibliography (canon) ---------- */
.canon-group { margin-top: 2.6rem; }
.canon-group__head { display: flex; align-items: baseline; gap: 1ch; flex-wrap: wrap; margin-bottom: 0.4rem; }
.canon-group__head .tag { font-family: var(--mono); color: var(--accent); font-size: 0.9rem; }
.canon-group > p.note { color: var(--muted); font-style: italic; margin-bottom: 1.2rem; }

ol.refs, ul.refs { list-style: none; padding: 0; margin: 0; }
.ref {
  padding: 0.95rem 0 0.95rem 1.4rem; border-bottom: 1px solid var(--line-soft);
  position: relative; max-width: 80ch;
}
.ref::before { content: ""; position: absolute; left: 0; top: 1.35rem; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-pale); }
.ref:hover::before { background: var(--accent); }
.ref .who { font-variant: small-caps; letter-spacing: 0.02em; color: var(--ink); }
.ref .title { font-style: italic; }
.ref .yr { font-family: var(--mono); font-size: 0.82em; color: var(--muted); }
.ref .sig { display: block; color: var(--ink-soft); font-size: 0.95rem; margin-top: 0.15rem; }
.ref .sep { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; }

/* ---------- margin gloss ---------- */
.glossed { position: relative; }
.gloss {
  font-size: 0.86rem; line-height: 1.55; color: var(--muted); font-style: italic;
  border-left: 2px solid var(--accent-pale); padding-left: 0.9rem; margin: 1.4rem 0;
}
@media (min-width: 1080px) {
  .gloss {
    position: absolute; right: -16.5rem; width: 14.5rem; margin: 0; border-left: 0;
    padding-left: 0; border-top: 1px solid var(--accent-pale); padding-top: 0.5rem;
  }
}

/* ---------- blockquote ---------- */
blockquote {
  font-family: var(--display); font-size: 1.3rem; line-height: 1.5; font-style: italic;
  color: var(--ink); border-left: 3px solid var(--accent-pale); padding: 0.2rem 0 0.2rem 1.4rem; margin: 2rem 0;
}
blockquote cite { display: block; font-family: var(--mono); font-style: normal; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 0.8rem; }

/* ---------- note article (notes/*.html) ---------- */
.article-head { padding-block: clamp(3rem, 9vw, 5.5rem) 1.5rem; }
.article-head .kicker { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.8rem; }
.article-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-top: 1rem; }
.draft-flag {
  display: inline-block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
  color: var(--accent); background: var(--paper-2); border: 1px dashed var(--accent-pale);
  border-radius: var(--radius); padding: 0.25rem 0.6rem; margin-bottom: 1.4rem;
}
.prose h2 { margin-top: 2.4rem; margin-bottom: 0.6rem; }
.prose h3 { margin-top: 1.8rem; margin-bottom: 0.4rem; }
.prose ul, .prose ol { max-width: var(--measure); padding-left: 1.3rem; }
.prose li { margin-top: 0.4rem; }
.footnote { font-size: 0.86rem; color: var(--muted); }

/* ---------- audio player (lecture hall) ---------- */
.player { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.2rem, 3vw, 2rem); }
.player__now { display: flex; align-items: center; gap: 1rem; }
.player__disc {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--paper) 18%, var(--accent-pale) 19% 22%, var(--paper-3) 23%, var(--accent-pale) 60%, var(--accent-2) 100%);
  box-shadow: inset 0 0 0 1px var(--line);
}
.player.is-playing .player__disc { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player__meta { min-width: 0; }
.player__title { font-family: var(--display); font-size: 1.15rem; font-weight: 600; }
.player__sub { font-size: 0.9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player__bar { margin-top: 1.1rem; }
.player__progress { height: 6px; background: var(--paper-3); border-radius: 99px; overflow: hidden; cursor: pointer; }
.player__progress > span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.player__times { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin-top: 0.4rem; }

.player__controls { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.pbtn { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); display: inline-flex; align-items: center; justify-content: center; transition: border-color .2s, background .2s; }
.pbtn:hover { border-color: var(--accent); background: var(--paper); }
.pbtn--play { width: 52px; height: 52px; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pbtn--play:hover { background: #000; }
.pbtn svg { width: 18px; height: 18px; fill: currentColor; }
.player__spacer { flex: 1; }
.player__hint { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

.playlist { list-style: none; padding: 0; margin: 1.6rem 0 0; border-top: 1px solid var(--line); }
.playlist li { display: flex; gap: 0.9rem; align-items: baseline; padding: 0.8rem 0.4rem; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .15s; }
.playlist li:hover { background: var(--paper); }
.playlist li.active { background: var(--paper); }
.playlist li.active .pl-title { color: var(--accent); }
.pl-n { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); flex: 0 0 1.8rem; }
.pl-main { min-width: 0; }
.pl-title { font-weight: 600; }
.pl-sub { font-size: 0.86rem; color: var(--muted); }
.pl-dur { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); margin-left: auto; }

/* ---------- footer ---------- */
.site-foot { background: var(--paper-2); border-top: 1px solid var(--line); padding-block: 3rem 2.4rem; margin-top: 4rem; }
.site-foot .wrap { display: grid; gap: 1.4rem; }
.foot-quote { font-family: var(--display); font-style: italic; font-size: 1.1rem; color: var(--ink-soft); max-width: 52ch; }
.foot-row { display: flex; flex-wrap: wrap; gap: 1.4rem 2rem; align-items: center; justify-content: space-between; }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.foot-links a { font-size: 0.92rem; text-decoration: none; border-bottom: 1px solid transparent; color: var(--ink-soft); }
.foot-links a:hover { border-bottom-color: var(--accent); color: var(--ink); }
.foot-fine { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); letter-spacing: 0.03em; }
.foot-mail { font-family: var(--mono); }

/* ---------- utilities ---------- */
.stack > * + * { margin-top: 1.1rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; } .mt-3 { margin-top: 3rem; }
.mb-2 { margin-bottom: 2rem; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }

/* ============================================================
   Enhancement layer: penumbra & ink — added June 2026
   Keeps the quiet, scholarly mood; adds subtle motion, texture
   and interactivity. All effects respect reduced-motion.
   ============================================================ */

/* ---------- 1. living paper grain (very subtle) ---------- */
.paper-grain {
  position: fixed; inset: 0; z-index: 50;
  pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  mix-blend-mode: multiply;
  animation: grainBreathe 6s ease-in-out infinite;
}
@keyframes grainBreathe {
  0%, 100% { opacity: 0.03; }
  50% { opacity: 0.055; }
}
@media (max-width: 720px), (prefers-reduced-motion: reduce) {
  .paper-grain { animation: none; opacity: 0.03; }
}

/* ---------- 2. ink-bleed hover on links ---------- */
a.link, .prose a:not(.btn), .ref a, footer a, .nav a {
  transition: color .25s ease, border-color .25s ease, background .25s ease,
              filter .35s ease, text-shadow .35s ease;
}
a.link:hover, .prose a:not(.btn):hover, .ref a:hover, footer a:hover, .nav a:hover {
  filter: blur(0.25px);
  text-shadow: 0 0 0.6px currentColor;
}
.nav a:hover { text-shadow: 0 0 0.8px currentColor; }

/* ---------- 3. penumbra cursor (desktop only) ---------- */
.penumbra-cursor {
  position: fixed; left: 0; top: 0;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(154,123,67,0.25) 0%, rgba(154,123,67,0.12) 35%, transparent 70%);
  transform: translate(-50%, -50%) scale(0.92);
  pointer-events: none; z-index: 45;
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity .5s ease;
  will-change: transform;
}
body.cursor-ready .penumbra-cursor { opacity: 1; }
@media (pointer: coarse), (max-width: 720px), (prefers-reduced-motion: reduce) {
  .penumbra-cursor { display: none; }
}

/* ---------- 4. hero parallax penumbra layers ---------- */
.hero { position: relative; overflow: hidden; }
.hero__parallax {
  position: absolute; inset: -15% -10%;
  pointer-events: none; z-index: -1;
  opacity: 0.6;
}
.hero__parallax .pen-layer {
  position: absolute;
  will-change: transform;
  transition: opacity .4s ease;
}
.hero__parallax .pen-layer--1 {
  top: 12%; left: 8%;
  width: clamp(180px, 28vw, 360px); height: clamp(180px, 28vw, 360px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(154,123,67,0.10), transparent 65%);
  filter: blur(20px);
}
.hero__parallax .pen-layer--2 {
  bottom: 5%; right: 5%;
  width: clamp(140px, 22vw, 280px); height: clamp(140px, 22vw, 280px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34,31,26,0.06), transparent 60%);
  filter: blur(16px);
}
.hero__parallax .pen-layer--3 {
  top: 35%; right: 18%;
  font-family: var(--display); font-style: italic; font-size: clamp(1rem, 2vw, 1.4rem);
  color: var(--accent-pale); opacity: 0.35;
  transform: rotate(-12deg);
  filter: blur(0.8px);
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
  .blur-in { animation: none; }
  .player.is-playing .player__disc { animation: none; }
  .paper-grain { animation: none; }
  .penumbra-cursor { display: none; }
  .hero__parallax .pen-layer { transform: none !important; }
  * { scroll-behavior: auto !important; }
}
