/* ==========================================================================
   pal.codes — one stylesheet, whole site.
   Edit the tokens below to retheme everything. No build step needed for CSS:
   run `site build` (or let `site dev` pick it up) and refresh.

   One typeface (Newsreader) and one calm palette run the whole site — chrome
   included. Hard rules are gone in favor of a woven-thread divider
   (templates/thread.html); --brand-accent survives only as a semantic alert
   color and as the landing poster's own deliberate hero accent, not as a
   competing site identity.
   ========================================================================== */

@font-face {
  font-family: "Newsreader Text";
  src: url("/fonts/newsreader-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader Text";
  src: url("/fonts/newsreader-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader Text";
  src: url("/fonts/newsreader-400i.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  /* -- palette: "Salt" — cool, overcast, quiet ---------------------------- */
  --paper:      #f4f3ee;
  --paper-2:    #e8e6dd;   /* raised surfaces: code, notes */
  --ink:        #1b2023;
  --ink-soft:   #5b6469;
  --accent:     #3d6273;   /* the one accent: dateline, links, nav/footer hover */
  --rule:       #1b2023;

  --brand-accent: #e02020; /* semantic alert + the landing poster's own hero color */

  /* -- accent family: borders, drop cap, blockquote mark ------------------ */
  --sea-deep:   #26404a;
  --sea-line:   #9fb0ac;
  --sun-glow:   #c7cabb;

  /* -- type -------------------------------------------------------------- */
  --sans:  system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Newsreader Text", "Iowan Old Style", "Sitka Text",
           "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono:  ui-monospace, "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;

  /* -- reading measure ---------------------------------------------------- */
  --measure: 39rem;        /* article column width, tuned for Newsreader at 1.1rem */
  --margin-col: 19rem;     /* sidenote column width */
  --gap: 2.5rem;           /* gap between article and sidenotes */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; }

/* ==========================================================================
   Landing page — the punk poster
   ========================================================================== */

body.landing { font-size: 12px; line-height: 18px; text-align: justify; }

.land-container { max-width: 600px; margin: 0 auto; min-height: 100vh; padding: 0 12px; }

.land-row {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: space-between;
}

.land-left { display: flex; flex-direction: column; flex-shrink: 0; width: 260px; }

.land-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 18px;
}

/* --- carrier-signal animation: the one script on the site ---------------- */
.wf { width: 100%; max-width: 720px; margin: 40px 0 10px; }
.wf canvas { display: block; width: 100%; height: 100px; }
.wf-status {
  margin: 2px 0 0;
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-soft);
  min-height: 16px;
  transition: opacity 0.25s;
}

.poster-box {
  color: #fff;
  height: 300px;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 4px 18px;
  margin-bottom: 12px;
}

.poster-logo { width: 80%; align-self: center; }

.poster-nav { display: flex; justify-content: center; width: 100%; margin-top: 20px; }

.poster-nav-list {
  display: flex;
  flex-direction: column;
  margin: 0 16px;
  text-align: left;
}

.poster-box a { text-decoration: none; color: #fff; height: 28px; }
.poster-box a:hover { color: var(--brand-accent); }
.soon { font-size: 8px; }

.picture { height: 150px; width: 100%; background: var(--brand-accent); }
.picture img { width: 100%; height: 100%; object-fit: cover; display: block; }

.recent { margin-top: 22px; width: 100%; text-align: left; }
.recent-head {
  font-style: italic;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  border-top: 2px solid var(--rule);
  padding-top: 8px;
  margin: 0 0 6px;
}
.recent-item { display: block; text-decoration: none; padding: 2px 0; }
.recent-item:hover { color: var(--brand-accent); }
.recent-date { font-variant-numeric: tabular-nums; font-size: 10px; color: var(--ink-soft); margin-right: 8px; }

@media (max-width: 600px) {
  .land-row { flex-direction: column; justify-content: flex-start; }
  .land-left { flex-direction: row; width: 100%; margin-top: 12px; }
  .poster-box { min-width: 60vw; margin: 0 12px 0 0; }
  .picture { height: auto; }
  .land-right { margin: 0; }
}

/* ==========================================================================
   Reading pages — the book
   ========================================================================== */

body.reading {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* --- site header: a soft woven thread instead of a hard rule -------------- */
.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding: 30px 24px 18px;
}

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0;
  text-decoration: none;
}
.wordmark:hover { color: var(--accent); }

.site-nav { display: flex; flex-wrap: wrap; gap: 20px; font-size: 0.95rem; }
.site-nav a { text-decoration: none; color: var(--ink-soft); }
.site-nav a:hover { color: var(--accent); }

/* --- the woven thread: replaces every hard rule in the site's chrome ------
   Two mirrored sine paths sharing the same nodes — reads as two strands
   twisted together rather than a drawn line. templates/thread.html. */
.thread { display: block; width: 100%; height: 12px; margin: 0 0 6px; }
.thread svg { display: block; width: 100%; height: 100%; }

/* --- page shell ----------------------------------------------------------
   The article column is `--measure` wide; on big screens an extra margin
   column opens on the right for sidenotes. */
.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 20px 0;
}

@media (min-width: 1160px) {
  .article-wrap {
    max-width: calc(var(--measure) + var(--gap) + var(--margin-col));
    padding-right: calc(var(--gap) + var(--margin-col) + 20px);
  }
}

/* --- article header ------------------------------------------------------ */
.art-head { margin: 2.2rem 0 3rem; }

.art-date {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.art-title {
  font-size: 2.15rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  font-weight: 600;
}

.subtitle {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0.6rem 0 0;
}

/* --- article body -------------------------------------------------------- */
article p { margin: 0 0 1.15em; }

article h2, article h3, article h4, article h5 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.25;
  margin: 2.2em 0 0.7em;
}
article h2 { font-size: 1.4rem; }
article h3 { font-size: 1.15rem; }
article h4 { font-size: 1.02rem; }

/* slash mark before section heads — the plain-page default. Real articles
   (.article-wrap) override this below with an italic deck head instead. */
article h2::before { content: "/ "; color: var(--accent); font-weight: 400; }

article a {
  color: var(--accent);
  text-decoration-color: var(--sea-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
article a:hover { text-decoration-color: var(--accent); }

.ul { text-decoration: underline; text-underline-offset: 3px; }

article ul, article ol { padding-left: 1.6em; margin: 0 0 1.15em; }
article li { margin-bottom: 0.45em; }
article li p { margin-bottom: 0.45em; }

article dl { margin: 0 0 1.15em; }
article dt { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
article dd { margin: 0.15em 0 0.9em 0; padding-left: 1.2em; border-left: 2px solid var(--paper-2); }

article blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.5em;
  border-left: 3px solid var(--sun-glow);
  font-style: italic;
  color: var(--ink-soft);
  position: relative;
}
article blockquote::before {
  content: "\201C";
  position: absolute;
  left: 0.1em;
  top: -0.05em;
  font-size: 1.5em;
  color: var(--sun-glow);
  font-style: normal;
  line-height: 1;
}
article blockquote footer { font-style: italic; font-size: 0.85rem; margin-top: 0.5em; }
article blockquote footer::before { content: "— "; }

article hr {
  border: none;
  text-align: center;
  margin: 2.5em 0;
}
article hr::after {
  content: "* * *";
  font-style: italic;
  letter-spacing: 0.6em;
  color: var(--ink-soft);
}

/* --- code -------------------------------------------------------------------
   The one deliberate exception to "one font": actual code stays monospace,
   since that's a legibility need, not a stylistic one. -------------------- */
article code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--paper-2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

article pre {
  background: var(--paper-2);
  border: 1px solid var(--sea-line);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  margin: 1.5em 0;
  line-height: 1.5;
  position: relative;
}
article pre code { background: none; padding: 0; font-size: 0.8rem; }
article pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0; right: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: var(--paper-2);
  padding: 3px 10px;
  border-radius: 0 6px 0 6px;
}

/* --- figures -------------------------------------------------------------- */
article img { max-width: 100%; height: auto; }
article figure { margin: 1.8em 0; }
article figure img { display: block; width: 100%; border: 1px solid var(--sea-line); border-radius: 6px; }
article figcaption {
  font-style: italic;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.5em;
}
article figcaption::before { content: "fig. "; color: var(--accent); font-style: normal; font-weight: 600; }
article figure.plain img { border: none; }

/* --- tables ---------------------------------------------------------------- */
article table {
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
  width: 100%;
}
article th {
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  border-bottom: 1.5px solid var(--sea-line);
  padding: 0.4em 0.8em 0.4em 0;
}
article td { border-bottom: 1px solid var(--paper-2); padding: 0.4em 0.8em 0.4em 0; }
.table-caption { font-style: italic; font-size: 0.82rem; color: var(--ink-soft); margin-top: -1em; }

/* --- math ------------------------------------------------------------------ */
math { font-size: 1.05em; }
math[display="block"] { margin: 1.4em 0; overflow-x: auto; overflow-y: hidden; }

/* --- sidenotes & margin notes ----------------------------------------------
   Numbered [fn:1] sidenotes double as citations; [fn::text] gives an
   unnumbered margin note. On wide screens they sit in the right margin;
   below 1160px they collapse and toggle open inline (CSS only, no JS). */
.sn-check { display: none; }

.sn-toggle { cursor: pointer; }
.sn-ref, .sn-num {
  font-weight: 600;
  font-size: 0.75em;
  color: var(--accent);
}
.mn-mark { color: var(--accent); font-size: 0.9em; }

.sidenote {
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
}

@media (min-width: 1160px) {
  .sidenote {
    float: right;
    clear: right;
    width: var(--margin-col);
    margin-right: calc(-1 * (var(--margin-col) + var(--gap)));
    margin-bottom: 0.8em;
    text-align: left;
  }
  .sn-toggle { cursor: default; }
}

@media (max-width: 1159.98px) {
  .sidenote { display: none; }
  .sn-check:checked + .sidenote {
    display: block;
    margin: 0.8em 0;
    padding: 0.7em 1em;
    border: 1px solid var(--sea-line);
    border-radius: 6px;
    background: var(--paper-2);
  }
  .sn-toggle:hover .sn-ref, .sn-toggle:hover.mn-mark { text-decoration: underline; }
}

/* --- special blocks: #+begin_note / #+begin_aside / #+begin_warning -------- */
.block-note, .block-aside, .block-warning {
  font-size: 0.92rem;
  border: 1px solid var(--sea-line);
  border-radius: 6px;
  padding: 0.9rem 1.2rem;
  margin: 1.6em 0;
  background: var(--paper-2);
}
.block-warning { border-color: var(--brand-accent); } /* semantic alert — the one deliberate exception */
.block-note p:last-child, .block-aside p:last-child, .block-warning p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Article pages only — the "Editorial" system. Larger, airier setting than
   the base reading rules above, plus the two flourishes that only belong on
   an actual post: an italic deck head instead of the punk tick, and a
   two-line drop cap on the opening paragraph.
   ========================================================================== */

.article-wrap article {
  position: relative;
  font-size: 1.1rem;
  line-height: 1.62;
}

.article-wrap article h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.2rem;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
}
.article-wrap article h2::before { content: none; }

.article-wrap article > p:first-of-type::first-letter {
  font-family: var(--serif);
  font-weight: 600;
  float: left;
  font-size: 3.2em;
  line-height: 0.82;
  padding: 0.02em 0.08em 0 0;
  color: var(--sea-deep);
}

/* ==========================================================================
   Words listing
   ========================================================================== */

.list-title {
  font-style: italic;
  font-size: 2.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.4rem;
}
.tick { color: var(--accent); }

.list-blurb { color: var(--ink-soft); margin: 0 0 2.5rem; font-style: italic; }

h2.year {
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background-image: linear-gradient(to right, var(--sea-line) 40%, transparent 0%);
  background-position: bottom;
  background-size: 7px 1.5px;
  background-repeat: repeat-x;
  padding-bottom: 6px;
  margin: 2.2rem 0 0.8rem;
}

.word-list { list-style: none; margin: 0; padding: 0; }
.word-list li { margin: 0; }
.word-list a {
  display: block;
  text-decoration: none;
  padding: 0.55rem 0.4rem;
  margin: 0 -0.4rem;
  border-radius: 6px;
}
.word-list a:hover { background: var(--rule); color: var(--paper); }
.word-list a:hover .wl-date, .word-list a:hover .wl-sub { color: var(--paper); }
.word-list a:hover .wl-title { color: var(--sun-glow); }
.wl-date { font-variant-numeric: tabular-nums; font-size: 0.75rem; color: var(--ink-soft); display: inline-block; width: 7.5rem; }
.wl-title { font-weight: 600; }
.wl-sub { display: block; font-size: 0.95rem; font-style: italic; color: var(--ink-soft); padding-left: 7.5rem; }

@media (max-width: 600px) {
  .wl-date { display: block; width: auto; }
  .wl-sub { padding-left: 0; }
}

/* ==========================================================================
   Plain pages (/now /reads /uses /bookmarks) + footer
   ========================================================================== */

.plain-page .art-title { font-size: 1.8rem; margin: 2.2rem 0 1.4rem; }

.page > .thread { margin: 4.5rem 0 14px; clear: both; }

.site-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 0 0 40px;
}
.site-foot a { color: inherit; text-decoration: none; margin-right: 10px; }
.site-foot a:hover { color: var(--accent); }
