/* ============================================================
   Theme model
   data-mode lives on <html> (set synchronously by an inline IIFE
   in each page's <head>, then maintained by /theme.js).
   data-view lives on <body>, fixed per page (home or post).
   The post view INVERTS whichever mode the home is in: picking "dark"
   gives white-on-black home + black-on-white posts, and vice versa.
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --fg: #f2efe6;
  --muted: rgba(242, 239, 230, 0.5);
  --rule: rgba(242, 239, 230, 0.14);
}

:root[data-mode="light"] {
  --bg: #f2efe6;
  --fg: #0a0a0a;
  --muted: rgba(10, 10, 10, 0.55);
  --rule: rgba(10, 10, 10, 0.14);
}

/* Post view = always inverted from current mode */
:root[data-mode="dark"] body[data-view="post"] {
  --bg: #f2efe6;
  --fg: #0a0a0a;
  --muted: rgba(10, 10, 10, 0.55);
  --rule: rgba(10, 10, 10, 0.14);
}
:root[data-mode="light"] body[data-view="post"] {
  --bg: #0a0a0a;
  --fg: #f2efe6;
  --muted: rgba(242, 239, 230, 0.5);
  --rule: rgba(242, 239, 230, 0.14);
}

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

html,
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-weight: 300;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.5s ease, color 0.5s ease;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* The @view-transition opt-in lives inline in each page's <head>
   so the destination document doesn't have to wait on this stylesheet
   to load before the browser knows to animate the navigation. The
   view-transition-name declarations below stay here — they only
   affect visual continuity once both stylesheets are loaded. */

/* ============================================================
   Theme toggle (top-right)
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 100;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.2s ease, box-shadow 0.2s ease;
  view-transition-name: theme-toggle;
}

.theme-toggle:hover {
  color: var(--fg);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: none;
}

/* Icon reflects the *current page's* resolved appearance.
   - data-mode="dark" (defaults):  home is dark (moon), post is light (sun)
   - data-mode="light" (flipped):  home is light (sun), post is dark (moon)
   data-mode lives on <html>, data-view on <body>; both are present
   before paint, so the icon never flashes the wrong glyph. */
:root[data-mode="dark"]  body[data-view="home"] .theme-toggle .theme-icon-moon { display: block; }
:root[data-mode="dark"]  body[data-view="post"] .theme-toggle .theme-icon-sun  { display: block; }
:root[data-mode="light"] body[data-view="home"] .theme-toggle .theme-icon-sun  { display: block; }
:root[data-mode="light"] body[data-view="post"] .theme-toggle .theme-icon-moon { display: block; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  padding: 140px 8vw 100px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 100px;
  align-items: center;
  position: relative;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 100px 6vw 60px;
    gap: 60px;
  }
  .hero-canvas-wrap {
    order: -1;
  }
}

.hero-text {
  max-width: 540px;
}

.hero-name {
  font-size: clamp(56px, 8vw, 108px);
  font-weight: 200;
  line-height: 0.92;
  letter-spacing: -0.025em;
  margin-bottom: 40px;
}

.hero-name em {
  font-style: italic;
  font-weight: 300;
}

.hero-blurb {
  font-size: clamp(18px, 1.35vw, 21px);
  line-height: 1.55;
  font-weight: 300;
  max-width: 480px;
}

.hero-blurb p + p {
  margin-top: 1.1em;
}

.hero-blurb em {
  font-style: italic;
}

.hero-socials {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 400;
}

.hero-socials a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.hero-socials a:hover {
  color: var(--fg);
}

.hero-socials span {
  color: var(--muted);
  opacity: 0.4;
}

.hero-canvas-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 480px;
  justify-self: center;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================
   POSTS LIST
   ============================================================ */
.posts {
  max-width: 760px;
  margin: 60px auto 140px;
  padding: 0 6vw;
}

.posts-label {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 56px;
  font-weight: 400;
}

.post-link {
  display: block;
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.post-link:last-of-type {
  border-bottom: 1px solid var(--rule);
}

.post-link:hover {
  opacity: 0.55;
}

.post-meta {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 400;
}

.post-title {
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.012em;
  margin-bottom: 14px;
}

.post-title em {
  font-style: italic;
}

.post-blurb {
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 580px;
  font-weight: 300;
}

.post-blurb em {
  font-style: italic;
}

/* ============================================================
   POST VIEW
   ============================================================ */
.post-view {
  max-width: 660px;
  margin: 0 auto;
  padding: 140px 6vw 140px;
}

.back {
  position: fixed;
  top: 28px;
  left: 32px;
  font-family: "Newsreader", serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 6px 0;
  z-index: 100;
  view-transition-name: back-button;
}

.back:hover {
  color: var(--fg);
}

.post-view-meta {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 28px;
  font-weight: 400;
}

.post-view h1 {
  font-size: clamp(40px, 5.4vw, 60px);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin-bottom: 56px;
  max-width: 14ch;
}

.post-view h1:has(+ .post-view-subtitle) {
  margin-bottom: 18px;
}

.post-view h1 em {
  font-style: italic;
}

.post-view-subtitle {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  color: var(--muted);
  margin-bottom: 56px;
}

.post-view-content {
  font-size: 19px;
  line-height: 1.62;
  font-weight: 400;
}

.post-view-content p {
  margin-bottom: 1.4em;
}

.post-view-content p.lead {
  font-size: 23px;
  line-height: 1.45;
  font-weight: 400;
  margin-bottom: 1.4em;
}

.post-view-content p.lead::first-letter {
  font-family: "Newsreader", serif;
  font-size: 4.6em;
  float: left;
  line-height: 0.82;
  padding: 6px 14px 0 0;
  font-weight: 200;
  font-style: normal;
}

.post-view-content em {
  font-style: italic;
}

.post-view-content strong {
  font-weight: 500;
}

.post-view-content a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.post-view-content a:hover {
  opacity: 0.6;
  border-bottom-color: currentColor;
}

.post-view-content blockquote {
  border-left: 1px solid var(--rule);
  padding: 4px 0 4px 28px;
  margin: 1.8em 0;
  font-style: italic;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.45;
}

.post-view-end {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   POST DISCUSSION FOOTER
   Per-post invitation to engage on Bluesky or LinkedIn. Either,
   both, or neither. Markup is commented out in each post file
   until the cross-post URLs exist; uncomment and paste in.
   ============================================================ */
.post-discuss {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.post-discuss-label {
  color: var(--muted);
  font-weight: 400;
}

.post-discuss-link {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.post-discuss-link:hover {
  opacity: 0.6;
  border-bottom-color: currentColor;
}

/* ============================================================
   Subtle entrance animation on first load (home only)
   ============================================================ */
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-name {
  animation: reveal 0.9s 0.1s ease both;
}
.hero-blurb {
  animation: reveal 0.9s 0.35s ease both;
}
.hero-canvas-wrap {
  animation: reveal 1.2s 0.2s ease both;
}
