/* Journal skin. Same shape as the app landing pages: full-bleed hero band,
   card grid, closing band, footer. Colours and geometry all come from
   tokens.css — nothing is redefined here. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

html.transition, html.transition *, html.transition *::before, html.transition *::after {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease !important;
}

body {
  /* tokens.css is cross-origin: if it fails to load, an unresolved var() falls
     back to the browser default, which is a serif. Name the stack locally so
     the page is sans either way. */
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.page-content { display: flex; flex-direction: column; flex: 1; }

.container {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 max(1.5rem, env(safe-area-inset-left));
}

/* hero */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: clamp(3.5rem, 9vw, 5.5rem) 0 clamp(3rem, 7vw, 4.5rem);
  text-align: center;
  margin-bottom: 4rem;
}
.hero .container { position: relative; z-index: 2; }

/* Ruled paper drifting upward behind the title: two sets of lines at different
   speeds, so it reads as pages moving rather than a texture. No images. */
.hero::before {
  content: '';
  position: absolute;
  inset: -50% -10%;
  z-index: 0;
  pointer-events: none;
  /* Two sets of ruled lines at different spacings and speeds, so the band
     reads as pages moving past rather than a static texture. Amber, because
     cream-on-cream was invisible at any opacity that stayed tasteful. */
  background:
    repeating-linear-gradient(to bottom, var(--accent) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(to bottom, var(--accent) 0 1px, transparent 1px 91px);
  opacity: 0.3;
  animation: drift 9s linear infinite;
}

@keyframes drift {
  from { transform: translateY(0); }
  to   { transform: translateY(-26px); }
}
@media (prefers-reduced-motion: reduce) { .hero::before { animation: none; } }

/* scrim: keeps the title crisp over the lines, in either theme */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 40% 44% at 50% 52%, var(--bg2) 45%, transparent 100%),
    linear-gradient(var(--bg2), transparent 14%, transparent 86%, var(--bg2) 100%);
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  letter-spacing: -0.02em;
  margin: 1.25rem 0 0.75rem;
}
.hero p { font-size: 1.15rem; color: var(--text2); max-width: 34rem; margin: 0 auto; }

.nav {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav a { color: var(--text2); border-bottom: none; }
.nav a:hover { color: var(--text); }

a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--color-underline); }
a:hover { border-bottom-color: var(--color-underline-hover); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin: 2.5rem 0 0.75rem; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.25rem; }
li { margin: 0.25rem 0; }

/* post list — the landing pages' feature grid */
.posts { padding-bottom: 4rem; }
.posts > h2 { text-align: center; margin: 0 0 2.5rem; }
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}
.post-list-item { margin: 0; }
.post-list-item a {
  display: block;
  height: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-bottom-width: 1px;
  padding: 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.post-list-item a:hover { border-color: var(--link, var(--accent)); }
.home-date {
  display: block;
  font-family: var(--font-code, ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text2);
  margin-bottom: 0.4rem;
}

/* post page */
.post { max-width: var(--column-width); margin: 0 auto; padding: clamp(2.5rem, 6vw, 4rem) 1.5rem 4rem; }
.back-link {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text2);
  border-bottom: none;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--text); }
.post-title { font-size: clamp(2.1rem, 5vw, 3.1rem); letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.post-meta {
  color: var(--text2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 2.5rem;
}

article img, .page-content img {
  max-width: 100%; height: auto; display: block; margin: 2rem auto;
  border: 1px solid var(--border); border-radius: var(--radius);
}

code { font-family: var(--font-code, ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace); font-size: 0.9em; background: var(--color-code-bg); padding: 0.15em 0.4em; }
pre { background: var(--color-code-bg); border: 1px solid var(--border); padding: 1rem; overflow-x: auto; margin: 1rem 0; }
pre code { background: none; padding: 0; border: none; }

blockquote { border-left: var(--rule); margin: 1rem 0; padding: 0 0 0 1rem; color: var(--text2); }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

footer {
  margin-top: auto;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 max(3.5rem, env(safe-area-inset-bottom));
  font-size: 0.9rem;
}
footer .nav { justify-content: center; }

.theme-toggle {
  position: fixed;
  bottom: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease), transform 0.2s var(--spring);
}
.theme-toggle:hover { color: var(--text); border-color: var(--link, var(--accent)); transform: translateY(-2px); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Post header art. Inlined (not <img>) so it inherits `color` and follows the
   site theme toggle; every shape uses currentColor. */
.post-header-svg { display: block; width: 100%; height: auto; margin: 0 0 2rem; color: var(--text); }

.post-year { list-style: none; margin: 1.5rem 0 0.5rem; font-size: 0.85rem; color: var(--text-tertiary); }
.post-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--subtle); font-size: 0.95rem; }
.post-nav a { color: var(--text-secondary); text-decoration: none; }
.post-nav a:hover { color: var(--link, var(--accent)); }
.streak { font-size: 0.85rem; color: var(--text-tertiary); margin-top: 0.25rem; }

.home-desc { display: block; margin-top: 2px; font-size: 0.85rem; opacity: 0.65; line-height: 1.4; }
.post-year { grid-column: 1 / -1; }

/* white / off-white paper, light mode only (dark keeps the shared tokens) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --color-bg: #fcfcfb; --bg: #fcfcfb;
    --color-bg2: #f3f3f1; --bg2: #f3f3f1; --border2: #f3f3f1;
    --color-code-bg: #f3f3f1;
    --color-hairline: #e3e3df; --border: #e3e3df;
    --glass-bg: rgba(252,252,251,0.92);
  }
}
:root[data-theme="light"] {
  --color-bg: #fcfcfb; --bg: #fcfcfb;
  --color-bg2: #f3f3f1; --bg2: #f3f3f1; --border2: #f3f3f1;
  --color-code-bg: #f3f3f1;
  --color-hairline: #e3e3df; --border: #e3e3df;
  --glass-bg: rgba(252,252,251,0.92);
}

/* plain top: no drifting stripes */
.hero::before, .hero::after { display: none; }

/* phones: the commits chart is unreadable at this size, keep the summary card */
@media (max-width: 600px) { .graph-svg { display: none; } }
