/* =====================================================================
   Bocchi Hub — site styles
   ---------------------------------------------------------------------
   Identity: "pressed fern" — pearl-white paper, deep garden green, a
   Dancing Script signature for the site title. Pearl (light) is the
   default theme; [data-theme="dark"] overrides the tokens with the
   green-tinted ink look. Every color/size decision lives in :root so
   the whole site can be re-skinned from one block. All text tokens hold
   >= 4.5:1 contrast in both themes.
   ===================================================================== */

/* ------------------------------ tokens ------------------------------ */

:root {
  --bg: #f8f6ee;
  --bg-translucent: rgba(248, 246, 238, 0.85);
  --surface: #ffffff;
  --surface-2: #f1eee1;
  --border: #e3dfd0;
  --border-strong: #cfc9b6;
  --text: #222222;
  --text-dim: #5d5a4f;
  --accent: #2e7d4f;
  --accent-strong: #205937;
  --accent-text: #205937; /* accent for TEXT — must hit 4.5:1 on --bg */
  --accent-ink: #f8f6ee;
  --accent-glow: rgba(46, 125, 79, 0.3);
  --accent-tint: rgba(46, 125, 79, 0.07);
  --accent-tint-strong: rgba(46, 125, 79, 0.14);
  --link: #205937;
  --danger: #b23b2a;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 10px 26px rgba(32, 57, 44, 0.12);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-script: "Dancing Script", "Segoe Script", "Brush Script MT", cursive;
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1a13;
  --bg-translucent: rgba(14, 26, 19, 0.82);
  --surface: #1c2a22;
  --surface-2: #263a30;
  --border: #2e4237;
  --border-strong: #3e5747;
  --text: #f0e9d6;
  --text-dim: #a9b5a6;
  --accent: #5ab07c;
  --accent-strong: #7dca96;
  --accent-text: #5ab07c;
  --accent-ink: #0e1a13;
  --accent-glow: rgba(90, 176, 124, 0.35);
  --accent-tint: rgba(90, 176, 124, 0.1);
  --accent-tint-strong: rgba(90, 176, 124, 0.18);
  --link: #7dca96;
  --danger: #e06c5b;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ------------------------------- base ------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

main {
  flex: 1;
  width: 100%;
}

[hidden] {
  display: none !important;
}

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

a {
  color: var(--link);
}

code,
.mono {
  font-family: var(--font-mono);
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 10px;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
}

/* ------------------------------ header ------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-translucent);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.wordmark {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--accent-text);
}

.site-nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
}

/* aria-current="page" on the section's own index, "true" on its subpages */
.site-nav a[aria-current] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

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

.icon-moon {
  display: none;
}

[data-theme="light"] .icon-moon {
  display: block;
}

[data-theme="light"] .icon-sun {
  display: none;
}

/* --------------------------- page headers --------------------------- */

.hero {
  padding-top: clamp(56px, 9vw, 104px);
  padding-bottom: clamp(20px, 4vw, 40px);
}

.page-head {
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(12px, 2.5vw, 24px);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 14px;
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.eyebrow a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5.5vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

/* The site signature: huge Dancing Script title, used once on the
   homepage hero (echoed small in the header wordmark). */
.display-script {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: clamp(3.4rem, 11vw, 5.8rem);
  line-height: 1.02;
  letter-spacing: 0.01em;
  margin: 0 0 14px;
  color: var(--accent-strong);
  text-shadow: 2px 2px 6px var(--accent-glow);
}

.page-head .display {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
}

.lede {
  color: var(--text-dim);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  max-width: 58ch;
  margin: 0;
}

.feed-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 12px 0 0;
}

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

.card-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  margin: 26px 0 64px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.18s ease, transform 0.18s ease,
    box-shadow 0.18s ease, background-color 0.18s ease;
}

a.card {
  color: inherit;
  text-decoration: none;
}

a.card:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card.is-planned {
  opacity: 0.75;
  border-style: dashed;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.channel-code {
  color: var(--text);
  letter-spacing: 0.14em;
}

.card-top .count {
  margin-left: auto;
  letter-spacing: 0.04em;
  text-transform: none;
  text-align: right;
}

.led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: auto;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}

.card-desc {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.card-foot {
  margin: auto 0 0;
  padding-top: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* news article cards — elevated card with a solid source badge and a
   green hover wash (ported from this site's previous iteration) */

.news-card:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.source-badge {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.news-card .card-title {
  font-size: 1.12rem;
}

.news-card .card-title a {
  color: var(--text);
  text-decoration: none;
}

.news-card .card-title a:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.news-card .card-title a::after {
  content: " \2197";
  font-family: var(--font-mono);
  font-size: 0.75em;
  color: var(--text-dim);
}

/* --------------------------- blog lists ----------------------------- */

.section-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 0;
}

.section-link {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: none;
}

.section-link:hover {
  color: var(--accent-text);
}

.post-list {
  list-style: none;
  margin: 10px 0 56px;
  padding: 0;
}

.post-item {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 4px 26px;
  padding: 20px 0;
}

.post-item + .post-item {
  border-top: 1px solid var(--border);
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding-top: 7px;
}

.post-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
}

.post-title a {
  color: var(--text);
  text-decoration: none;
}

.post-title a:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-summary {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 62ch;
}

.post-tags {
  margin: 8px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ------------------------------ prose ------------------------------- */

.prose {
  max-width: 66ch;
  font-size: 1.02rem;
  margin: 8px 0 40px;
}

.prose p {
  margin: 0 0 1.15em;
}

.prose h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 1.9em 0 0.6em;
}

.prose h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 1.6em 0 0.5em;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.4em;
}

.prose li {
  margin-bottom: 0.35em;
}

.prose li::marker {
  color: var(--text-dim);
}

.prose a {
  color: var(--link);
  text-underline-offset: 3px;
}

.prose code {
  font-size: 0.86em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1.15em;
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.55;
}

.prose blockquote {
  margin: 0 0 1.15em;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.post-nav {
  margin: 0 0 64px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.post-nav a {
  color: var(--text-dim);
  text-decoration: none;
}

.post-nav a:hover {
  color: var(--accent-text);
}

/* ------------------------------- tags ------------------------------- */

.tag-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 4px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  transition: border-color 0.15s ease, color 0.15s ease,
    background-color 0.15s ease;
}

button.tag {
  cursor: pointer;
}

button.tag:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--text);
}

.tag[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
}

/* --------------------------- empty / error -------------------------- */

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  color: var(--text-dim);
  margin: 26px 0 64px;
}

.empty p {
  margin: 0 0 6px;
}

.empty code {
  display: inline-block;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text);
}

/* --------------------------- tool panels ---------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 26px 0 64px;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Mouse focus loses the ring; keyboard focus keeps a visible outline
   (accessibility floor: :focus-visible must stay visible everywhere). */
textarea:focus:not(:focus-visible) {
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  font-weight: 500;
  font-size: 0.9rem;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  min-height: 1.2em;
  margin: 0;
}

.status.is-error {
  color: var(--danger);
}

/* ------------------------------ motion ------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(10px);
    animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  }

  .reveal:nth-child(2) {
    animation-delay: 60ms;
  }

  .reveal:nth-child(3) {
    animation-delay: 120ms;
  }

  @keyframes rise {
    to {
      opacity: 1;
      transform: none;
    }
  }

  .led {
    animation: pulse 2.6s ease-in-out infinite;
  }

  @keyframes pulse {
    0%,
    100% {
      box-shadow: 0 0 0 0 var(--accent-glow);
    }
    50% {
      box-shadow: 0 0 0 6px rgba(0, 0, 0, 0);
    }
  }
}

/* ----------------------------- responsive --------------------------- */

@media (max-width: 640px) {
  .header-row {
    gap: 14px;
  }

  .site-nav {
    gap: 14px;
  }

  .site-nav a {
    font-size: 0.9rem;
  }

  .card {
    padding: 18px;
  }

  .check {
    margin-left: 0;
    width: 100%;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 18px 0;
  }

  .post-date {
    padding-top: 0;
  }
}

/* four nav links + wordmark + toggle need every pixel on small phones */
@media (max-width: 430px) {
  .header-row {
    gap: 10px;
  }

  .wordmark {
    font-size: 1.15rem;
  }

  .site-nav {
    gap: 10px;
  }

  .site-nav a {
    font-size: 0.84rem;
    padding: 6px 0;
  }
}
