@font-face {
    font-family: 'MellSans';
    src: url('/fonts/mel/MellSans-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
  }
  @font-face {
    font-family: 'MellSans';
    src: url('/fonts/mel/MellSans-RegularItalic.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
  }
  @font-face {
    font-family: 'MellSans';
    src: url('/fonts/mel/MellSans-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
  }
  @font-face {
    font-family: 'MellMono';
    src: url('/fonts/mel/MellMono-Italic.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
  }
  @font-face {
    font-family: 'MellMono';
    src: url('/fonts/mel/MellMono-BoldItalic.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
  }

  :root {
    /* palette — sage pastel */
    --bg:        #F4F7F4;
    --bg-soft:   #EAF0E8;
    --paper:    #FBFCFA;
    --ink:       #2A3028;
    --ink-soft:  #5A6355;
    --ink-faint: #646D60;
    --rule:      #D8DFD4;

    --sage:      #C9DCC8;
    --moss:      #A8C4B0;
    --straw:     #D4DDC1;
    --peach:     #E8D4C0;  /* tag accent */
    --lilac:     #D4CEE0;  /* tag accent */

    --accent:    #6E8B70;  /* deep sage for links */

    --font-sans: 'MellSans', 'Nunito', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'MellMono', ui-monospace, monospace;

    --size-base: 19px;
    --measure: 62ch;
    --radius: 14px;
  }

  [data-theme="dark"] {
    --bg:        #1C201B;
    --bg-soft:   #242924;
    --paper:    #222722;
    --ink:       #E8ECE4;
    --ink-soft:  #AEB4A8;
    --ink-faint: #8C9486;
    --rule:      #323830;
    --sage:      #3B4E3C;
    --moss:      #4E6A54;
    --straw:     #484E36;
    --peach:     #5A4A3C;
    --lilac:     #443E52;
    --accent:    #B4CFB6;
  }

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

  body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    font-size: var(--size-base);
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    transition: background 0.35s ease, color 0.35s ease;
  }

  a { color: var(--accent); text-decoration: none; }
  a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

  button { font-family: inherit; cursor: pointer; }

  /* ---------- layout ---------- */
  .wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 28px;
  }

  /* ---------- reading progress bar ---------- */
  .progress {
    position: fixed;
    top: 0; left: 0;
    height: 4px;
    width: 0;
    background: var(--accent);
    z-index: 80;
    transition: width 0.08s linear;
    opacity: 0;
  }
  .progress.visible { opacity: 1; }

  /* ---------- header ---------- */
  header.site {
    padding: 40px 0 20px;
  }
  header.site .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 400;
    letter-spacing: -0.01em;
  }
  .brand .mark {
    width: 22px; height: 22px;
    border-radius: 6px;
    background: var(--sage);
    display: inline-block;
    position: relative;
  }
  .brand .mark::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 3px;
    background: var(--moss);
  }
  nav.main {
    display: flex;
    gap: 22px;
    align-items: center;
    font-size: 17px;
  }
  nav.main a {
    color: var(--ink-soft);
    position: relative;
    padding: 4px 0;
  }
  nav.main a.active {
    color: var(--ink);
  }
  nav.main a.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 6px;
    background: var(--sage);
    z-index: -1;
    border-radius: 2px;
  }

  .icon-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid var(--rule);
    background: var(--paper);
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
  }
  .icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
  .icon-btn svg { width: 16px; height: 16px; }

  /* ---------- hero (intro) ---------- */
  .intro {
    padding: 32px 0 48px;
  }
  .intro h1 {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: clamp(36px, 5vw, 52px);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
    color: var(--ink);
    text-wrap: pretty;
  }
  .intro h1 em {
    font-style: normal;
    background: linear-gradient(transparent 62%, var(--sage) 62%);
    padding: 0 2px;
  }
  .intro .dek {
    color: var(--ink-soft);
    font-size: 19px;
    max-width: 52ch;
    margin: 0;
    text-wrap: pretty;
  }
  .tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .tag {
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 5px 11px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    cursor: pointer;
  }
  .tag:hover { background: var(--bg-soft); color: var(--ink); }
  .tag.active {
    background: var(--sage);
    border-color: var(--sage);
    color: var(--ink);
    font-weight: 400;
  }
  .tag .count {
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 11px;
    margin-left: 6px;
  }
  .tag.active .count { color: var(--ink); opacity: 0.55; }

  /* ---------- post index ---------- */
  .posts {
    padding: 8px 0 80px;
  }
  .year-sep {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 0 14px;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
  }
  .year-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rule);
  }

  .post-row {
    display: block;
    padding: 18px 4px 18px;
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
    position: relative;
    transition: padding-left 0.25s ease;
  }
  .post-row:hover {
    text-decoration: none;
    padding-left: 12px;
  }
  .post-row:hover .post-title {
    color: var(--accent);
  }
  .post-row .meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
  }
  .post-row .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-faint); }
  .post-title {
    font-weight: 400;
    font-size: 24px;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    line-height: 1.25;
    transition: color 0.2s;
    text-wrap: balance;
  }
  .post-excerpt {
    color: var(--ink-soft);
    font-size: 17px;
    line-height: 1.55;
    margin: 0;
    max-width: 58ch;
    text-wrap: pretty;
  }
  .post-row .tags-inline {
    display: inline-flex;
    gap: 6px;
    margin-top: 10px;
  }
  .post-row .tag-chip {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-soft);
    background: var(--bg-soft);
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    text-transform: lowercase;
  }

  .like {
    position: absolute;
    right: 4px; top: 20px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: transparent;
    border: 0;
    color: var(--ink-faint);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.25s;
  }
  .like:hover { color: var(--accent); }
  .like svg { width: 15px; height: 15px; }
  .like.on { color: #C48A8A; transform: scale(1.12); }
  [data-theme="dark"] .like.on { color: #E0A8A8; }

  /* ---------- post article view ---------- */
  .view { display: none; }
  .view.active { display: block; }

  article.post {
    padding: 10px 0 100px;
    max-width: var(--measure);
    margin: 0 auto;
  }
  .post-head {
    padding: 10px 0 40px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 36px;
  }
  .post-head .back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    margin-bottom: 22px;
  }
  .post-head .back:hover { color: var(--ink); text-decoration: none; }
  .post-head .kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    text-transform: uppercase;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
  }
  .post-head h1 {
    font-size: clamp(36px, 5vw, 54px);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
    font-weight: 400;
    text-wrap: balance;
  }
  .post-head .dek {
    font-size: 21px;
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 0;
    font-weight: 400;
    text-wrap: pretty;
  }

  /* cover placeholder */
  .cover {
    height: 220px;
    border-radius: var(--radius);
    margin: 28px 0 0;
    position: relative;
    overflow: hidden;
    background: var(--sage);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .cover.cover-image {
    height: auto;
    background: transparent;
    display: block;
  }
  .cover.cover-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: cover;
    border-radius: var(--radius);
  }
  .cover .stripes {
    position: absolute; inset: 0;
    background-image: repeating-linear-gradient(
      -45deg,
      transparent 0 14px,
      rgba(255,255,255,0.25) 14px 28px
    );
  }
  .cover .label {
    position: relative;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    text-transform: uppercase;
    background: var(--paper);
    padding: 6px 12px;
    border-radius: 4px;
  }

  /* prose */
  .prose p {
    margin: 0 0 22px;
    font-size: 19px;
    line-height: 1.75;
    color: var(--ink);
    text-wrap: pretty;
  }
  .prose h2 {
    font-size: 26px;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin: 44px 0 14px;
    color: var(--ink);
  }
  .prose h3 {
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--accent);
    margin: 32px 0 10px;
  }
  .prose blockquote {
    border-left: 3px solid var(--moss);
    padding: 4px 0 4px 20px;
    margin: 28px 0;
    color: var(--ink-soft);
    font-style: italic;
  }
  .prose code {
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--bg-soft);
    padding: 2px 6px;
    border-radius: 4px;
  }
  .prose pre {
    background: var(--bg-soft);
    padding: 18px 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 22px 0;
    border: 1px solid var(--rule);
  }
  .prose pre code {
    background: transparent;
    padding: 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--ink);
  }
  .prose pre .c-key { color: var(--accent); }
  .prose pre .c-str { color: #A8826A; }
  .prose pre .c-com { color: var(--ink-faint); font-style: italic; }
  [data-theme="dark"] .prose pre .c-str { color: #D0B89A; }

  .prose ul { padding-left: 22px; margin: 0 0 22px; }
  .prose li { margin-bottom: 6px; line-height: 1.7; }

  .prose hr {
    border: 0;
    height: 1px;
    background: var(--rule);
    margin: 44px auto;
    width: 60%;
  }

  .post-footer {
    border-top: 1px solid var(--rule);
    margin-top: 48px;
    padding-top: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: var(--ink-soft);
  }
  .post-footer .reactions {
    display: flex;
    gap: 8px;
  }
  .react-btn {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--ink-soft);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
  }
  .react-btn:hover { background: var(--bg-soft); color: var(--ink); }
  .react-btn svg { width: 13px; height: 13px; }
  .react-btn.on { background: var(--sage); border-color: var(--sage); color: var(--ink); }

  /* ---------- About view ---------- */
  .about {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 20px 0 100px;
  }
  .about h1 {
    font-size: clamp(36px, 5vw, 48px);
    font-weight: 400;
    letter-spacing: -0.03em;
    margin: 0 0 28px;
  }
  .about .portrait {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: var(--sage);
    position: relative;
    overflow: hidden;
    margin: 0 0 28px;
    border: 1px solid var(--rule);
  }
  .about .portrait::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(255,255,255,0.3) 8px 16px);
  }
  .about .portrait::after {
    content: "portrait";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-soft);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .about-facts {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 140px 1fr;
    row-gap: 14px;
    column-gap: 20px;
    font-size: 15px;
  }
  .about-facts dt {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    text-transform: uppercase;
    padding-top: 4px;
  }
  .about-facts dd {
    margin: 0;
    color: var(--ink);
  }

  /* ---------- Archive view ---------- */
  .archive {
    padding: 20px 0 100px;
  }
  .archive h1 {
    font-size: clamp(36px, 5vw, 48px);
    font-weight: 400;
    letter-spacing: -0.03em;
    margin: 0 0 8px;
  }
  .archive .sub {
    color: var(--ink-soft);
    margin-bottom: 40px;
  }
  .archive-year {
    margin-bottom: 36px;
  }
  .archive-year h2 {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--ink-faint);
    text-transform: uppercase;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
  }
  .archive-year h2 .n { color: var(--ink-faint); }
  .archive-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    padding: 10px 4px;
    border-radius: 6px;
    align-items: baseline;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.2s;
  }
  .archive-row:hover { background: var(--bg-soft); text-decoration: none; padding-left: 10px; }
  .archive-row .date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-faint);
  }
  .archive-row .t {
    font-weight: 400;
    font-size: 17px;
  }
  .archive-row .tag-mini {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-soft);
    background: var(--bg-soft);
    padding: 2px 8px;
    border-radius: 3px;
  }
  .archive-row:hover .tag-mini { background: var(--paper); }

  /* ---------- footer ---------- */
  footer.site {
    border-top: 1px solid var(--rule);
    padding: 32px 0 48px;
    margin-top: 60px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
  }

  /* ---------- tweaks panel ---------- */
  .tweaks-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 14px;
    padding: 14px 16px;
    display: none;
    z-index: 90;
    box-shadow: 0 10px 30px rgba(42, 48, 40, 0.08);
    min-width: 240px;
  }
  .tweaks-panel.visible { display: block; }
  .tweaks-panel .t-title {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    text-transform: uppercase;
    margin-bottom: 10px;
  }
  .tweaks-panel .row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
  }
  .tweaks-panel label {
    font-size: 13px;
    color: var(--ink);
  }
  .tweaks-panel .size-controls {
    display: flex;
    gap: 6px;
  }
  .tweaks-panel .size-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 1px solid var(--rule);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .tweaks-panel .size-btn:hover { background: var(--bg-soft); }
  .tweaks-panel .size-btn.active { background: var(--sage); border-color: var(--sage); }

  @media (max-width: 560px) {
    .wrap { padding: 0 20px; }
    header.site { padding: 24px 0 12px; }
    nav.main { gap: 14px; font-size: 14px; }
    .intro h1 { font-size: 30px; }
    .archive-row { grid-template-columns: 70px 1fr; }
    .archive-row .tag-mini { display: none; }
  }
