/* ============================================================
   the lo-fi zone — cozy pixel journal
   Fraunces        = warm serif (headings / titles)
   JetBrains Mono  = UI / labels / meta / buttons / player
   Newsreader      = long-form reading prose
   Muted olive · cream parchment · wood · charcoal
   ============================================================ */

:root {
  --paper: #e9e2cf;        /* page background */
  --paper-2: #e1d8bf;      /* deeper cream */
  --panel: #f2ecdb;        /* cards / panels */
  --panel-inset: #e6dcc2;  /* screens / insets */

  --ink: #3b362a;          /* primary text */
  --ink-soft: #6d6650;     /* muted */
  --ink-faint: #9a9075;    /* faint labels */

  --line: #cec4a2;         /* tan divider/border */
  --wood: #8a6a46;
  --wood-dark: #5e4630;

  --olive: #4f5d38;        /* primary green */
  --olive-dark: #3d4a2b;
  --sage: #8b9a6b;         /* secondary green */
  --sage-soft: #aab68c;

  --charcoal: #2a2823;     /* dark panels (profile card) */
  --charcoal-2: #211f1b;
  --cream-on-dark: #ece5d3;

  --ember: #c47f3d;        /* rare sunset accent */

  --display: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --read: "Newsreader", Georgia, serif;

  --shadow: 3px 4px 0 rgba(94, 70, 48, 0.16);
  --shadow-lift: 5px 7px 0 rgba(94, 70, 48, 0.2);
  --radius: 10px;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--read);
  font-size: 19px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(94, 70, 48, 0.045) 1px, transparent 1px),
    radial-gradient(rgba(94, 70, 48, 0.035) 1px, transparent 1px);
  background-size: 15px 15px, 15px 15px;
  background-position: 0 0, 7px 7px;
  transition: background-color 0.6s ease;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 22px 160px; position: relative; z-index: 2; }

a { color: var(--olive-dark); text-decoration: none; transition: color 0.12s ease; }
a:hover { color: var(--wood); }
::selection { background: rgba(139, 154, 107, 0.35); }

/* small caps UI labels like the reference (ICONS / BUTTONS / TAGS) */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
}

code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--panel-inset);
  border: 1px solid var(--line);
  color: var(--wood-dark);
  padding: 0.06em 0.4em;
  border-radius: 4px;
}

kbd {
  font-family: var(--mono);
  font-size: 0.76em;
  background: var(--panel);
  border: 1px solid var(--wood);
  border-radius: 5px;
  padding: 0.1em 0.45em;
  box-shadow: 0 2px 0 var(--wood);
  color: var(--wood-dark);
}

/* ---------- panel + buttons (shared) ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 18px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease, color 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--olive); color: #fff; border-color: var(--olive-dark); box-shadow: 0 3px 0 var(--olive-dark); }
.btn-primary:hover { background: var(--olive-dark); color: #fff; }
.btn-primary:active { box-shadow: 0 1px 0 var(--olive-dark); }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn-secondary:hover { border-color: var(--wood); color: var(--wood-dark); }
.btn-text { color: var(--olive-dark); background: none; padding: 4px 0; text-transform: uppercase; font-family: var(--mono); font-size: 14px; letter-spacing: 0.06em; }
.btn-text:hover { color: var(--wood); }

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  margin: 26px 0 30px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 21px; color: var(--ink); }
.brand:hover { color: var(--olive-dark); }
.brand-icon { width: 24px; height: 24px; display: inline-block; }

.site-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.site-nav a {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 7px 11px;
  border-radius: 7px;
}
.site-nav a:hover { color: var(--ink); background: var(--panel-inset); }
.site-nav a.active { color: var(--olive-dark); }
.nav-cta { margin-left: 4px; }
/* keep the Subscribe button's text white — beat the generic .site-nav a color */
.site-nav a.btn-primary { color: #fff; }
.site-nav a.btn-primary:hover { color: #fff; background: var(--olive-dark); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 40px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-text { padding: 38px 34px; align-self: center; }
.hero-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 4.6vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
}
.hero-rule { width: 40px; height: 3px; background: var(--sage); border-radius: 3px; margin: 0 0 18px; }
.hero-tagline { font-family: var(--mono); font-size: 15px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 26px; }
.hero-hint { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); margin: 16px 0 0; }
.pixel-key { color: var(--olive-dark); }

/* framed art placeholder (drop a PNG in /img to replace) */
.art {
  position: relative;
  min-height: 260px;
  background:
    linear-gradient(180deg, #cdd3c0 0%, #b9c2a6 45%, #7f8c63 46%, #6f7d54 100%);
  display: block;
  overflow: hidden;
  image-rendering: pixelated;
}
.art img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.art-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: #35402a;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  padding: 16px;
}
.art-ph svg { width: 56px; height: 56px; opacity: 0.85; }
.art-ph span { opacity: 0.75; }

/* ---------- section heading ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 46px 0 18px; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--ink); margin: 0; }

/* ---------- post cards (horizontal) ---------- */
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.post-card:hover { transform: translate(-2px, -3px); box-shadow: var(--shadow-lift); }
.post-card--text { grid-template-columns: 1fr; }
.post-card-thumb { position: relative; min-height: 150px; background: linear-gradient(160deg, #b7c1a2, #7c8a5c); image-rendering: pixelated; }
.post-card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.post-card-thumb .thumb-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #37402b; opacity: 0.7; }
.post-card-thumb .thumb-ph svg { width: 40px; height: 40px; }

.post-card-body { padding: 20px 22px; }
.post-card-link { color: var(--ink); display: block; }
.post-card-link:hover { color: var(--ink); }
.post-card-link:hover .post-card-title { color: var(--olive-dark); }

.post-card-meta, .post-meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 10px;
}
.dot { color: var(--sage); }

.tag-line { margin-bottom: 8px; }
.post-card-title { font-family: var(--display); font-weight: 600; font-size: 23px; line-height: 1.18; margin: 0 0 8px; color: var(--ink); transition: color 0.12s ease; }
.post-card-excerpt { font-family: var(--mono); font-size: 13.5px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 12px; }
.read-more { font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--olive-dark); }

/* ---------- tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--panel-inset);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 9px;
}
.tag:first-child { background: var(--sage); color: #f3f0e2; border-color: var(--sage); }

.empty-note { text-align: center; padding: 60px 0; color: var(--ink-soft); font-family: var(--mono); font-size: 14px; }
.dim { color: var(--ink-faint); }

/* ---------- divider with mountain motif ---------- */
.divider { display: flex; align-items: center; gap: 14px; margin: 44px 0; color: var(--line); }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.divider svg { width: 30px; height: 20px; color: var(--sage); flex: none; }

/* ---------- quote block ---------- */
.quote {
  position: relative;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 26px 28px 22px 54px;
  margin: 32px 0;
}
.quote::before { content: "\201C"; position: absolute; left: 18px; top: 8px; font-family: var(--display); font-size: 54px; color: var(--sage); line-height: 1; }
.quote p { font-family: var(--display); font-style: italic; font-size: 21px; line-height: 1.4; color: var(--ink); margin: 0 0 10px; }
.quote cite { font-family: var(--mono); font-style: normal; font-size: 13px; color: var(--ink-faint); }

/* ---------- newsletter signup ---------- */
.newsletter {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px 26px;
  margin: 32px 0;
}
.newsletter-icon { width: 46px; height: 46px; color: var(--wood); flex: none; }
.newsletter-copy { flex: 1 1 220px; }
.newsletter-copy h3 { font-family: var(--display); font-weight: 600; font-size: 21px; margin: 0 0 4px; color: var(--ink); }
.newsletter-copy p { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); margin: 0; }
.newsletter-form { display: flex; gap: 8px; flex: 1 1 260px; }
.newsletter-form input {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 14px;
  padding: 10px 12px;
  background: var(--panel-inset);
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}
.newsletter-form input:focus { outline: none; border-color: var(--sage); }
.newsletter-msg { flex-basis: 100%; font-family: var(--mono); font-size: 13px; color: var(--olive-dark); margin: 2px 0 0; min-height: 1px; }

/* ---------- profile card (About) ---------- */
.profile {
  max-width: 320px;
  margin: 0 auto 28px;
  background: var(--charcoal);
  border: 2px solid var(--charcoal-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 26px 24px;
  text-align: center;
  color: var(--cream-on-dark);
}
.profile-avatar {
  width: 130px; height: 130px; margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid var(--sage);
  background: linear-gradient(160deg, #6f7d54, #4a5539);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  image-rendering: pixelated;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.profile-avatar svg { width: 60px; height: 60px; color: #cfd6bd; opacity: 0.8; }
.profile h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0 0 4px; color: #fff; }
.profile-role { font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; color: var(--sage-soft); margin: 0 0 14px; }
.profile-sep { width: 46px; height: 2px; background: rgba(170,182,140,0.5); margin: 0 auto 14px; }
.profile-bio { font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: #c9c2b0; margin: 0 0 18px; }
.profile-social { display: flex; justify-content: center; gap: 12px; }
.profile-social a { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: rgba(255,255,255,0.06); color: var(--sage-soft); }
.profile-social a:hover { background: var(--sage); color: var(--charcoal); }
.profile-social svg { width: 17px; height: 17px; }

/* ---------- single post ---------- */
.post { padding-top: 8px; }
.back-link { font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.back-link:hover { color: var(--olive-dark); }

.post-head { padding: 20px 0 18px; margin-bottom: 26px; border-bottom: 2px solid var(--line); }
.post-title { font-family: var(--display); font-weight: 600; font-size: clamp(28px, 5vw, 40px); line-height: 1.12; margin: 14px 0 14px; color: var(--ink); }

.prose { font-size: 19px; line-height: 1.78; color: var(--ink); }
.prose p { margin: 0 0 22px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.2; margin: 40px 0 15px; color: var(--ink); }
.prose h3 { font-family: var(--display); font-weight: 600; font-size: 21px; margin: 30px 0 12px; color: var(--olive-dark); }
.prose a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--wood); }
.prose ul, .prose ol { margin: 0 0 22px; padding-left: 24px; }
.prose li { margin: 0 0 8px; }
.prose li::marker { color: var(--sage); }
.prose blockquote { margin: 0 0 22px; padding: 10px 20px; border-left: 4px solid var(--sage); background: var(--panel); border-radius: 0 8px 8px 0; color: var(--ink-soft); font-style: italic; }
.prose pre { background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.6; }
.prose pre code { background: none; border: none; padding: 0; color: var(--wood-dark); }
.prose img { max-width: 100%; border: 2px solid var(--line); border-radius: 10px; image-rendering: pixelated; }
.prose hr { border: none; border-top: 2px dashed var(--line); margin: 36px 0; }

.post-nav { display: flex; justify-content: space-between; gap: 18px; margin-top: 50px; padding-top: 24px; border-top: 2px solid var(--line); }
.post-nav-link { display: flex; flex-direction: column; gap: 4px; max-width: 48%; color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 18px; }
.post-nav-link:hover { color: var(--olive-dark); }
.post-nav-link.next { text-align: right; margin-left: auto; }
.post-nav-link .dim { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 90px 0; }
.notfound h1 { font-family: var(--display); font-weight: 700; font-size: 80px; margin: 0 0 12px; color: var(--ink); }
.notfound p { font-family: var(--mono); color: var(--ink-soft); margin: 0 0 24px; }

/* ---------- footer ---------- */
.site-footer { margin-top: 60px; padding-top: 24px; border-top: 2px dashed var(--line); text-align: center; font-family: var(--mono); color: var(--ink-faint); font-size: 13px; }
.footer-sub { font-size: 12px; margin-top: 4px; }

/* ============================================================
   MUSIC PLAYER — cozy panel (bottom-right)
   ============================================================ */
.player {
  position: fixed; right: 20px; bottom: 20px; z-index: 10000;
  width: 296px;
  background: var(--panel);
  border: 2px solid var(--wood);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  font-family: var(--mono);
  color: var(--ink);
  user-select: none;
  transition: width 0.2s ease;
}
.player-toggle {
  position: absolute; top: 9px; right: 9px; width: 25px; height: 25px;
  background: var(--panel-inset); color: var(--wood-dark);
  border: 1px solid var(--wood); border-radius: 6px;
  font-family: var(--mono); font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer;
}
.player-toggle:hover { background: var(--sage); color: #fff; }
.player[data-collapsed="true"] { width: 168px; }
.player[data-collapsed="true"] .player-body { display: none; }
.player[data-collapsed="true"]::before { content: "\266A now playing"; display: block; padding: 13px 15px; font-size: 13px; color: var(--olive-dark); }

.player-body { padding: 16px 15px 14px; display: grid; gap: 12px; }
.player-screen { display: flex; align-items: center; gap: 10px; padding: 8px 10px; padding-right: 26px; background: var(--panel-inset); border: 1px solid var(--line); border-radius: 8px; }
.equalizer { display: flex; align-items: flex-end; gap: 3px; height: 15px; width: 16px; flex: none; }
.equalizer span { width: 3px; background: var(--sage); border-radius: 1px; height: 30%; }
.player.is-playing .equalizer span { animation: eq 0.9s ease-in-out infinite; }
.player.is-playing .equalizer span:nth-child(2) { animation-delay: 0.2s; }
.player.is-playing .equalizer span:nth-child(3) { animation-delay: 0.4s; }
@keyframes eq { 0%,100% { height: 30%; } 50% { height: 100%; } }
.marquee { flex: 1; overflow: hidden; }
.marquee-text { display: block; font-size: 13.5px; color: var(--wood-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-progress { display: grid; gap: 6px; }
.time { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 7px; background: var(--panel-inset); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; background: var(--sage); border: 2px solid var(--olive-dark); border-radius: 4px; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; background: var(--sage); border: 2px solid var(--olive-dark); border-radius: 4px; }

.player-controls { display: flex; align-items: center; justify-content: center; gap: 7px; }
.ctl { background: var(--panel-inset); color: var(--wood-dark); border: 1px solid var(--wood); border-radius: 8px; width: 40px; height: 37px; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--wood); transition: transform 0.08s ease, background 0.12s ease; }
.ctl:hover { background: var(--sage); color: #fff; }
.ctl:active { transform: translateY(2px); box-shadow: none; }
.ctl-main { background: var(--olive); color: #fff; border-color: var(--olive-dark); box-shadow: 0 2px 0 var(--olive-dark); width: 47px; height: 41px; font-size: 15px; }
.ctl-main:hover { background: var(--olive-dark); }
.ctl-toggle[aria-pressed="true"] { background: var(--sage); color: #fff; }

.player-volume { display: flex; align-items: center; gap: 9px; }
.vol-icon { font-size: 13px; }

/* ============================================================
   SCENE SELECTOR (bottom-left) + ambient canvas
   ============================================================ */
#scene-canvas { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

.scene-picker {
  position: fixed; left: 20px; bottom: 20px; z-index: 10000;
  background: var(--panel);
  border: 2px solid var(--wood);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  font-family: var(--mono);
  padding: 10px 12px;
  user-select: none;
}
.scene-picker-label { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px; display: block; }
.scene-btns { display: flex; gap: 5px; }
.scene-btn {
  width: 34px; height: 34px;
  background: var(--panel-inset);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
}
.scene-btn:hover { transform: translateY(-2px); }
.scene-btn[aria-pressed="true"] { background: var(--sage); border-color: var(--olive-dark); box-shadow: 0 2px 0 var(--olive-dark); }

/* subtle scene tints — "lightly impacts" */
body.scene-rain  { background-color: #dfe0d4; }
body.scene-night { background-color: #cfc9b8; }
body.scene-snow  { background-color: #e7e6df; }
body.scene-leaves{ background-color: #e9ddc6; }
body.scene-night .site-header,
body.scene-night .hero,
body.scene-night .post-card,
body.scene-night .panel { filter: brightness(0.97) saturate(0.96); }
.scene-content { position: relative; z-index: 2; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .art { min-height: 200px; order: -1; }
}
@media (max-width: 560px) {
  body { font-size: 18px; }
  .wrap { padding: 0 16px 170px; }
  .site-header { padding: 16px 16px; }
  .post-card { grid-template-columns: 1fr; }
  .post-card-thumb { min-height: 130px; }
  .player { right: 10px; bottom: 10px; width: calc(100vw - 130px); max-width: 300px; }
  .scene-picker { left: 10px; bottom: 10px; padding: 8px 9px; }
  .scene-btn { width: 30px; height: 30px; font-size: 14px; }
  .post-nav { flex-direction: column; }
  .post-nav-link, .post-nav-link.next { max-width: 100%; text-align: left; margin-left: 0; }
  .newsletter-form { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, .player.is-playing .equalizer span { animation: none !important; scroll-behavior: auto !important; }
  .player.is-playing .equalizer span { height: 60%; }
}
