/* ============================================================
   azur — warm, restrained, editorial.
   Côte d'Azur cream + one coral accent. Spectral + Inter.
   WebGL coral metaball header (see azur.js).
   ============================================================ */

:root {
  --paper:    #FAF5EA;   /* sun-washed cream */
  --paper-2:  #F2EAD9;
  --ink:      #211F1A;   /* warm near-black */
  --ink-soft: #56524A;
  --muted:    #948E80;
  --rule:     #E7DECB;
  --coral:    #1A8A9C;   /* teal-azure — links & marks (ties to sky/water) */
  --coral-2:  #D26A38;   /* terracotta — secondary pops */
  --sea:      #4E8A3F;   /* leaf green, used sparingly */
  --mark:     #F4DA94;
  --mark-edge:#E8C879;

  /* lucumr's type: Merriweather body · Lora headings · Ubuntu Mono code (all OFL/libre) */
  --display: "Lora", Georgia, "Times New Roman", serif;
  --serif:   "Merriweather", Georgia, serif;
  --sans:    "Lora", Georgia, serif;
  --mono:    "Ubuntu Mono", ui-monospace, "Consolas", monospace;

  --measure: 39rem;
  --margin-col: 14rem;
  --gap: 2.75rem;
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh; display: flex; flex-direction: column;   /* sticky bottom banner */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.62;
  font-feature-settings: "onum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .5s var(--ease), color .5s var(--ease);
}
::selection { background: var(--mark); color: var(--ink); }

.wrap { max-width: 62rem; width: 100%; margin: 0 auto; padding: 0 2.2rem; flex: 1 0 auto; display: flex; flex-direction: column; }
.content { flex: 1 0 auto; }
.reading { max-width: var(--measure); margin-left: auto; margin-right: auto; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding: 1.5rem 0 1.3rem;
  font-family: var(--sans);
}
.brand {
  font-family: var(--display); font-weight: 500; font-size: 1.16rem;
  letter-spacing: -0.01em; color: var(--ink); text-decoration: none;
}
.brand .leaf { display: none; }
.topnav { display: flex; gap: 0.95rem; align-items: center; flex-wrap: wrap; }
.topnav a {
  font-size: .9rem; font-weight: 450; color: var(--ink-soft); text-decoration: none;
  letter-spacing: .005em; transition: color .15s;
}
.topnav a:hover { color: var(--coral); }
.theme-toggle {
  font-size: .95rem; background: none; border: 1px solid var(--rule);
  width: 1.85rem; height: 1.85rem; border-radius: 50%; color: var(--ink-soft);
  cursor: pointer; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, color .2s, transform .5s var(--ease);
}
.theme-toggle:hover { border-color: var(--coral); color: var(--coral); transform: rotate(35deg); }

/* ---------- WebGL coral banners (full-bleed top & bottom, like lucumr) ---------- */
.banner {
  position: relative; width: 100%; height: 240px; overflow: hidden; flex: 0 0 auto;
}
.banner canvas { display: block; width: 100%; height: 100%; }
.banner.img-fallback { background-size: cover; background-position: center; }
.banner.no-webgl { height: 0; }
.banner-top {
  -webkit-mask-image: linear-gradient(to bottom, #000 74%, transparent);
          mask-image: linear-gradient(to bottom, #000 74%, transparent);
}
.banner-bottom {
  -webkit-mask-image: linear-gradient(to top, #000 74%, transparent);
          mask-image: linear-gradient(to top, #000 74%, transparent);
}

/* ---------- hero text ---------- */
.hero-head { padding: 1.4rem 0 .5rem; }
.hero-head h1 {
  font-family: var(--display); font-weight: 500; font-size: 2.55rem; line-height: 1.1;
  letter-spacing: -0.02em; margin: 0 0 .55rem;
}
.hero-head p { margin: 0; font-size: 1.12rem; color: var(--ink-soft); }
.hero-head p a { color: var(--coral); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--coral) 35%, transparent); }

/* ---------- sections ---------- */
section.block { padding: 2.6rem 0; }
.kicker {
  font-family: var(--sans); font-size: .74rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 1rem;
}
.block > h1, .block > h2 { font-family: var(--display); font-weight: 500; letter-spacing: -0.015em; }

/* ---------- blog list (date + title, lucumr-style) ---------- */
.entry-wrapper { max-width: var(--measure); margin: 0 auto; }
.entry-overview {
  display: grid; grid-template-columns: 92px minmax(0, 1fr);
  column-gap: 1.5rem; align-items: baseline; margin: .5rem 0;
}
.entry-overview .date { text-align: right; font-style: italic; font-size: .82rem; color: var(--muted); }
.entry-overview h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 1.04rem; line-height: 1.6; letter-spacing: 0; }
.entry-overview h1 a { color: var(--ink); text-decoration: none; }
.entry-overview h1 a:hover { color: var(--coral); }
@media (max-width: 640px) {
  .entry-overview { grid-template-columns: 1fr; column-gap: 0; }
  .entry-overview .date { text-align: left; }
}

/* ---------- archive (lucumr year → months) ---------- */
.blog-archive { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.blog-archive > li { margin: 1.1rem 0; }
.blog-archive > li > a { font-family: var(--display); font-weight: 500; font-size: 1.18rem; color: var(--ink); text-decoration: none; }
.blog-archive ul { list-style: none; padding: 0; margin: .25rem 0 0 1.4rem; }
.blog-archive ul li { line-height: 1.75; }
.blog-archive ul li a { color: var(--coral); text-decoration: none; }
.blog-archive ul li a:hover { text-decoration: underline; }
.blog-archive .count { color: var(--muted); font-size: .92rem; }
.pagination {
  max-width: var(--measure); margin: 2.6rem auto 0; text-align: center;
  font-family: var(--serif); font-size: 1rem; color: var(--ink-soft);
}
.pagination a { color: var(--coral); text-decoration: none; }
.pagination a:hover { text-decoration: underline; }
.pagination .disabled { color: var(--muted); }
.pagination strong { font-weight: normal; font-style: italic; }

/* ---------- writing list (archive/tags) ---------- */
.entries { border-top: 1px solid var(--rule); }
.entry {
  display: block; padding: 1.05rem 0; border-bottom: 1px solid var(--rule);
  text-decoration: none; color: inherit;
}
.entry .row { display: flex; justify-content: space-between; align-items: baseline; gap: 1.2rem; }
.entry .t { font-family: var(--display); font-weight: 500; font-size: 1.22rem; letter-spacing: -0.01em; line-height: 1.3; transition: color .15s; }
.entry .d { font-family: var(--sans); font-size: .78rem; color: var(--muted); white-space: nowrap; letter-spacing: .01em; }
.entry .desc { margin: .25rem 0 0; color: var(--ink-soft); font-size: .98rem; }
.entry:hover .t { color: var(--coral); }

.tags { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-top: .5rem; }
.tag { font-family: var(--sans); font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.tag::before { content: "#"; opacity: .5; }

/* ---------- tag cloud (lucumr-style: size = frequency, no hashtag) ---------- */
.tagcloud {
  list-style: none; margin: 1.5rem 0; padding: 0; max-width: var(--measure);
  line-height: 1.7; text-align: justify;
}
.tagcloud li { display: inline; margin: 0; padding: 0 .55rem; }
.tagcloud a { color: var(--coral); text-decoration: none; white-space: nowrap; }
.tagcloud a:hover { text-decoration: underline; }

/* ---------- long-form ---------- */
.article-head { padding: 1.6rem 0 1.4rem; }
.article-head h1 { font-family: var(--display); font-weight: 500; font-size: 2.5rem; line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 .5rem; }
.article-head .meta { font-family: var(--sans); font-size: .82rem; color: var(--muted); letter-spacing: .01em; }
.prose .body, .article-head { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.prose { font-size: 1.1rem; line-height: 1.72; }
.prose p { margin: 0 0 1.25rem; }
.prose h2 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; letter-spacing: -0.015em; margin: 2.4rem 0 .8rem; }
.prose h3 { font-family: var(--display); font-weight: 500; font-size: 1.22rem; margin: 1.8rem 0 .6rem; }
.prose a { color: var(--coral); text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--coral) 28%, transparent); text-underline-offset: 2.5px; text-decoration-thickness: 1px; transition: text-decoration-color .15s; }
.prose a:hover { text-decoration-color: var(--coral); }
.prose blockquote { margin: 1.6rem 0; padding-left: 1.2rem; border-left: 2px solid var(--coral); color: var(--ink-soft); font-style: italic; }
.prose img { max-width: 100%; height: auto; border-radius: 4px; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .3rem 0; }
.prose code { font-family: var(--mono); font-size: .92em; background: var(--paper-2); padding: .06em .35em; border-radius: 4px; color: var(--ink); }
.prose pre {
  margin: 1.4rem 0; padding: .85rem 1.1rem; background: #FBF7EC;
  border: 1px solid var(--rule); border-radius: 6px; overflow-x: auto;
  box-shadow: 0 1px 3px rgba(90, 78, 52, .07);
}
.prose pre code { background: none; padding: 0; font-family: var(--mono); font-size: .9rem; line-height: 1.55; color: var(--ink); }
.hljs { background: transparent !important; padding: 0 !important; }

.prose hr {
  border: 0; height: 1px; width: 100%; background: var(--rule);
  margin: 2.6rem 0;
}
.dropcap::first-letter { font-family: var(--display); font-weight: 500; float: left; font-size: 3.4rem; line-height: .76; padding: .35rem .5rem .1rem 0; color: var(--coral); }

/* ---------- margin sidenotes ---------- */
@media (min-width: 1080px) {
  .prose .body { position: relative; }
  .sidenote {
    float: right; clear: right; width: var(--margin-col);
    margin-right: calc(-1 * (var(--margin-col) + var(--gap)));
    margin-top: .35rem; margin-bottom: 1rem;
    font-family: var(--sans); font-size: .8rem; line-height: 1.55; color: var(--muted);
  }
  .sidenote::before { content: attr(data-n); color: var(--coral); font-weight: 600; margin-right: .35rem; }
}
@media (max-width: 1079px) {
  .sidenote { display: block; border-left: 2px solid var(--rule); padding-left: 1rem; margin: 1rem 0; font-family: var(--sans); font-size: .86rem; color: var(--muted); line-height: 1.55; }
  .sidenote::before { content: attr(data-n) "  "; color: var(--coral); font-weight: 600; }
}

mark, .frag { background: var(--mark); box-shadow: 0 0 0 1px var(--mark-edge); color: var(--ink); border-radius: 2px; padding: 0 .06em; }

/* ---------- link popup ---------- */
.popup {
  position: absolute; z-index: 50; width: 18rem; max-width: 82vw;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 14px 40px -14px rgba(0,0,0,.3); padding: .85rem .95rem;
  font-family: var(--sans); opacity: 0; pointer-events: none; transform: translateY(5px);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.popup.on { opacity: 1; pointer-events: auto; transform: translateY(0); }
.popup .ttl { font-family: var(--display); font-size: 1rem; font-weight: 500; margin-bottom: .2rem; }
.popup .src { font-size: .72rem; color: var(--coral); margin-bottom: .35rem; }
.popup .dsc { font-family: var(--serif); font-size: .9rem; color: var(--ink-soft); line-height: 1.5; }

/* ---------- footer ---------- */
footer {
  margin-top: 2.5rem; padding: 1.6rem 0;
  font-family: var(--sans); font-size: .82rem; color: var(--muted);
  display: flex; flex-direction: column; align-items: flex-end; gap: .45rem; text-align: right;
}
footer a { color: var(--ink-soft); text-decoration: none; }
footer a:hover { color: var(--coral); }
.footer-social { display: flex; gap: 1.1rem; font-size: 1rem; margin-bottom: .15rem; }
.footer-rc a { color: var(--coral); }

@media (max-width: 640px) {
  .wrap { padding: 0 1.3rem; }
  body { font-size: 17px; }
  .banner { height: 175px; }
  .hero-head h1 { font-size: 2rem; }
  .article-head h1 { font-size: 1.95rem; }
  .topnav { gap: 1.1rem; }
  .entry .row { flex-direction: column; gap: .15rem; }
}
