/* randomshelly.com
   One shell, three notebooks. Each notebook sets --accent on <html>; every
   accented element reads --a (per-card) or --accent (per-page). */

:root {
  --paper:      #fbfaf7;
  --paper-2:    #f2efe9;
  --card:       #ffffff;
  --ink:        #17161a;
  --ink-soft:   #4a4750;
  --muted:      #8b8792;
  --line:       #e2ded6;
  --line-soft:  #eeeae3;
  --accent:     #0d6e6b;
  --accent-dark:#4fb3ae;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;

  --shadow: 0 1px 2px rgba(20,18,25,.04), 0 8px 24px -12px rgba(20,18,25,.12);
  --radius: 4px;
  --a: var(--accent);
  --ad: var(--accent-dark);
}

html[data-theme="dark"] {
  --paper:      #131316;
  --paper-2:    #191a1e;
  --card:       #1d1e23;
  --ink:        #eceaf0;
  --ink-soft:   #b3afba;
  --muted:      #807c88;
  --line:       #2e2f36;
  --line-soft:  #26272d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --paper:      #131316;
    --paper-2:    #191a1e;
    --card:       #1d1e23;
    --ink:        #eceaf0;
    --ink-soft:   #b3afba;
    --muted:      #807c88;
    --line:       #2e2f36;
    --line-soft:  #26272d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  }
}

/* In dark mode the accent has to lighten or it disappears into the page.
   Track accents arrive as an inline style attribute (on <html> for the page
   accent, on each card for its own accent). Inline declarations outrank normal
   stylesheet rules, so this flip needs !important to reach them at all. */
html[data-theme="dark"] { --accent: var(--accent-dark) !important; }
html[data-theme="dark"] .card,
html[data-theme="dark"] .track-card,
html[data-theme="dark"] .book,
html[data-theme="dark"] .badge { --a: var(--ad) !important; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { --accent: var(--accent-dark) !important; }
  html:not([data-theme="light"]) .card,
  html:not([data-theme="light"]) .track-card,
  html:not([data-theme="light"]) .book,
  html:not([data-theme="light"]) .badge { --a: var(--ad) !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.09rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 26px; }
.wrap.narrow { max-width: 680px; }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink);
  color: var(--paper); padding: 10px 16px; z-index: 200; font-family: var(--sans);
}
.skip:focus { left: 8px; top: 8px; }

.kicker {
  display: block; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
  font-weight: 500;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 100;
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 15px 26px; flex-wrap: wrap;
}
.brand { text-decoration: none; display: flex; align-items: baseline; gap: 11px; }
.brand-mark {
  font-family: var(--mono); font-weight: 500; font-size: 1.04rem;
  letter-spacing: -0.02em; color: var(--ink);
}
.brand-mark::before { content: "/"; color: var(--accent); margin-right: 1px; }
.brand-name {
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.nav { display: flex; gap: 22px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; font-family: var(--sans); font-size: 0.78rem;
  letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 500;
  padding: 4px 0; border-bottom: 1.5px solid transparent; transition: .18s;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav a.here { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 620px) {
  .topbar .wrap { padding: 13px 20px; }
  .brand-name { display: none; }
  .nav { gap: 16px; }
  .nav a { font-size: 0.73rem; }
}

/* ------------------------------------------------------------ home hero */

.hero-home { padding: 96px 0 78px; border-bottom: 1px solid var(--line); }
.hero-mark {
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.02em;
  color: var(--muted); margin-bottom: 26px;
}
.hero-mark::before { content: "~/ "; color: var(--accent); }
.hero-home h1 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(2.3rem, 6.2vw, 4.1rem); line-height: 1.06;
  letter-spacing: -0.035em; max-width: 22ch;
}
.hero-intro { margin-top: 30px; max-width: 56ch; }
.hero-intro p { font-size: 1.24rem; color: var(--ink-soft); margin-bottom: 15px; }
.hero-intro p:last-child { margin-bottom: 0; }
.hero-by {
  margin-top: 34px; font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}

/* ------------------------------------------------------- page/track hero */

.hero-page { padding: 74px 0 42px; }
.hero-page.accented { border-bottom: 1px solid var(--line); }
.hero-page h1 {
  font-family: var(--sans); font-weight: 700; margin-top: 16px;
  font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.1;
  letter-spacing: -0.03em; max-width: 26ch;
}
.hero-page .lede {
  margin-top: 20px; font-size: 1.26rem; color: var(--ink-soft);
  font-style: italic; max-width: 52ch;
}
.track-about { margin-top: 26px; max-width: 60ch; }
.track-about p { color: var(--ink-soft); margin-bottom: 14px; }
.feedlink {
  display: inline-block; margin-top: 26px; font-family: var(--mono);
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding-bottom: 2px;
}
.feedlink:hover { border-bottom-color: var(--accent); }

/* ------------------------------------------------------------- sections */

section { padding: 74px 0; }
.sechead {
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap;
  padding-bottom: 22px; margin-bottom: 34px; border-bottom: 1px solid var(--line);
}
.sechead h2 {
  font-family: var(--sans); font-weight: 700; font-size: clamp(1.5rem, 3.4vw, 2rem);
  letter-spacing: -0.025em; flex: 1;
}
.sechead .kicker { flex-basis: 100%; margin-bottom: 6px; }
.seclink {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); text-decoration: none;
}
.seclink:hover { color: var(--accent); }

/* --------------------------------------------------------- track cards */

.tracks { background: var(--paper-2); border-bottom: 1px solid var(--line); }
.track-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.track-card {
  display: flex; flex-direction: column; gap: 11px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  border-top: 3px solid var(--a); border-radius: var(--radius);
  padding: 28px 26px 24px; transition: transform .18s, box-shadow .18s;
}
.track-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.track-card .kicker { color: var(--a); }
.track-card h3 {
  font-family: var(--sans); font-weight: 600; font-size: 1.16rem;
  line-height: 1.3; letter-spacing: -0.015em;
}
.track-card p { color: var(--ink-soft); font-size: 1rem; flex: 1; }
.track-card .count {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-top: 6px;
}

/* ---------------------------------------------------------- post cards */

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 25px 22px;
  display: flex; flex-direction: column; gap: 11px;
  transition: border-color .18s, box-shadow .18s;
}
.card:hover { border-color: color-mix(in srgb, var(--a) 45%, var(--line)); box-shadow: var(--shadow); }
.card-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted);
}
.card h3 { font-family: var(--sans); font-weight: 600; font-size: 1.2rem; line-height: 1.28; letter-spacing: -0.02em; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { color: var(--a); }
.card p { color: var(--ink-soft); font-size: 1rem; flex: 1; }
.card .more {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  color: var(--a); text-decoration: none; margin-top: 4px;
}
.card .more:hover { text-decoration: underline; text-underline-offset: 3px; }

.badge {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.09em;
  text-transform: uppercase; text-decoration: none;
  color: var(--a); border: 1px solid color-mix(in srgb, var(--a) 32%, transparent);
  padding: 3px 8px; border-radius: 100px; white-space: nowrap;
}
.badge:hover { background: color-mix(in srgb, var(--a) 10%, transparent); }

.empty { color: var(--muted); font-style: italic; }

/* --------------------------------------------------------------- books */

.books { background: var(--paper-2); border-top: 1px solid var(--line); }
.book-list { display: flex; flex-direction: column; gap: 20px; }
.book {
  display: flex; gap: 26px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--a); border-radius: var(--radius); padding: 26px;
}
.book-cover { width: 116px; flex: 0 0 116px; border-radius: 2px; box-shadow: var(--shadow); }
.book-cover.placeholder {
  height: 174px; background:
    repeating-linear-gradient(135deg, var(--line-soft) 0 8px, var(--paper-2) 8px 16px);
  border: 1px solid var(--line);
}
.book-text { flex: 1; }
.book h3 { font-family: var(--sans); font-weight: 700; font-size: 1.28rem; letter-spacing: -0.02em; }
.book-sub { color: var(--ink-soft); font-style: italic; margin-top: 6px; }
.book-blurb { margin-top: 12px; color: var(--ink-soft); }
.book-status {
  margin-top: 14px; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--a);
}
@media (max-width: 560px) {
  .book { flex-direction: column; gap: 18px; }
  .book-cover, .book-cover.placeholder { width: 96px; flex-basis: auto; height: 144px; }
}

/* ---------------------------------------------------------- post pages */

.post-head { padding: 66px 0 30px; }
.post-head h1 {
  font-family: var(--sans); font-weight: 700; margin-top: 18px;
  font-size: clamp(1.95rem, 4.6vw, 2.9rem); line-height: 1.12; letter-spacing: -0.03em;
}
.post-meta {
  margin-top: 20px; font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.post .wrap.narrow { padding-bottom: 20px; }

.prose { font-size: 1.14rem; line-height: 1.78; }
.prose > * + * { margin-top: 1.2em; }
.prose p { color: var(--ink); }
.prose h2 {
  font-family: var(--sans); font-weight: 700; font-size: 1.5rem;
  letter-spacing: -0.02em; margin-top: 2.1em; line-height: 1.25;
}
.prose h3 {
  font-family: var(--sans); font-weight: 600; font-size: 1.2rem;
  letter-spacing: -0.015em; margin-top: 1.8em;
}
.prose a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
}
.prose a:hover { border-bottom-color: var(--accent); }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.45em; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: 2px 0 2px 22px;
  color: var(--ink-soft); font-style: italic;
}
.prose blockquote p { color: inherit; }
.prose code {
  font-family: var(--mono); font-size: 0.88em; background: var(--paper-2);
  border: 1px solid var(--line-soft); border-radius: 3px; padding: 1px 5px;
}
.prose pre {
  background: var(--paper-2); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 18px 20px; overflow-x: auto;
}
.prose pre code {
  background: none; border: 0; padding: 0; font-size: 0.92rem; line-height: 1.6;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); }

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 62px; padding-top: 26px; border-top: 1px solid var(--line);
}
.pg {
  text-decoration: none; font-family: var(--sans); font-size: 0.98rem;
  font-weight: 500; color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; transition: .18s;
}
.pg:hover { border-color: var(--accent); color: var(--ink); }
.pg span {
  display: block; font-family: var(--mono); font-size: 0.66rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 5px;
}
.pg.older { text-align: right; grid-column: 2; }
@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pg.older { text-align: left; grid-column: 1; }
}

/* ---------------------------------------------------------- newsletter */

.list { background: var(--paper-2); border-top: 1px solid var(--line); }
.list-box { max-width: 560px; }
.list h2 {
  font-family: var(--sans); font-weight: 700; font-size: clamp(1.5rem, 3.4vw, 2rem);
  letter-spacing: -0.025em; margin: 10px 0 12px;
}
.list p { color: var(--ink-soft); margin-bottom: 24px; }
/* .form-msg is flex-basis:100% and must be free to wrap onto its own row.
   With nowrap it stays in the row and crushes the input. Hence wrap + :empty. */
.signup { display: flex; flex-wrap: wrap; max-width: 460px; }
.signup input {
  flex: 1 1 190px; min-width: 0; padding: 15px 17px; background: var(--card);
  color: var(--ink); font-family: var(--serif); font-size: 1rem;
  border: 1px solid var(--ink); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}
.signup input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.signup button {
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: 0 24px; border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--sans); font-weight: 600; font-size: 0.82rem; cursor: pointer;
  transition: background .18s;
}
.signup button:hover { background: var(--accent); border-color: var(--accent); }
.form-msg {
  flex-basis: 100%; margin-top: 11px; font-size: 0.94rem; color: var(--accent);
}
.form-msg:empty { display: none; }

.list.is-dark .signup input, .list.is-dark .signup button {
  cursor: not-allowed; opacity: 0.45; border-color: var(--line);
}
.list.is-dark .signup button { background: var(--muted); }
.dark-note { margin-top: 18px; font-size: 0.98rem; color: var(--muted); }
.dark-note a { color: var(--accent); }

@media (max-width: 480px) {
  .signup input { border-right: 1px solid var(--ink); border-radius: var(--radius); }
  .signup button { border-radius: var(--radius); margin-top: 10px; padding: 14px 24px; }
}

/* -------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--line); padding: 46px 0 60px; }
.footer .wrap {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 26px; flex-wrap: wrap;
}
.foot-brand p { color: var(--muted); font-size: 0.96rem; margin-top: 7px; max-width: 34ch; }
.foot-links { display: flex; gap: 22px; }
.foot-links a {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-soft); text-decoration: none;
}
.foot-links a:hover { color: var(--accent); }
.copyright {
  font-family: var(--sans); font-size: 0.78rem; color: var(--muted);
  flex-basis: 100%; padding-top: 22px; border-top: 1px solid var(--line-soft);
}

/* ------------------------------------------------------- theme toggle */

.theme-toggle {
  position: fixed; bottom: 20px; right: 20px; z-index: 120;
  width: 40px; height: 40px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  font-size: 1.05rem; line-height: 1; box-shadow: var(--shadow);
  transition: color .18s, border-color .18s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
