/* ==========================================================================
   Second Button · secondbutton.org
   All of the site's styling lives in this one file.

   Layout: a cotton candy sky header with a blossom branch, then a reading
   column for posts with a narrow sidebar on wide screens. Cards are "stitched"
   with a dashed thread line, like a button sewn onto a uniform.

   MOBILE FIRST: the plain rules are the phone layout. Wider screens add to
   them with @media (min-width: ...) blocks placed next to each component:
     33em (about 528px)  roomier header, cards and replies
     54em (about 864px)  posts + sidebar side by side

   QUICK EDITS
   - Colors: change the values in the :root block right below.
   - Dark mode colors: the @media (prefers-color-scheme: dark) block after it.
   - Fonts: the --font-* lines (the fonts themselves load in each page's <head>).
   ========================================================================== */

/* ---------- 1. Colors, fonts, sizes ---------- */
:root {
  /* cotton candy palette (light mode) */
  --sky:        #E6FAF8;   /* page background, aqua mist */
  --cream:      #FFF8EA;   /* cards and footer */
  --bubblegum:  #FF8FC0;   /* decoration, active nav pill */
  --bubble-ink: #AD2D67;   /* bubblegum dark enough to read: links, accents */
  --aqua:       #6FD3CF;   /* decoration, focus ring */
  --aqua-ink:   #16706D;   /* aqua dark enough to read: labels, status chips */
  --lavender:   #C7B3F0;
  --butter:     #FFE07A;
  --sakura:     #FFD3E2;   /* soft pink chips */
  --ink:        #4A3868;   /* main text, plum */
  --ink-soft:   #6A5A8E;   /* secondary text */
  --stitch:     #9ADFDB;   /* dashed "thread" lines */
  --on-accent:  #4A3868;   /* text on top of bubblegum */
  --shadow:     0 6px 0 rgba(200, 64, 127, .10);
  --hero-grad:  linear-gradient(135deg, #CFF5F2 0%, #FFE3EE 55%, #EADFFF 100%);

  /* fonts */
  --font-display: "Mochiy Pop One", "Zen Maru Gothic", system-ui, sans-serif;
  --font-body:    "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --font-hand:    "Klee One", "Zen Maru Gothic", cursive;

  /* type scale */
  --step--1: .875rem;
  --step-0:  1.0625rem;
  --step-1:  1.3rem;
  --step-2:  1.75rem;
  --step-3:  clamp(2rem, 5vw, 3rem);

  --radius: 22px;
  --measure: 66ch;
}

/* night sakura (visitors whose device is set to dark mode) */
@media (prefers-color-scheme: dark) {
  :root {
    --sky: #1E1830; --cream: #2A2242; --bubblegum: #FF9CC8; --bubble-ink: #FFA6CE;
    --aqua: #7FE0DA; --aqua-ink: #8BE6E1; --lavender: #B9A6EE; --butter: #FFE58F;
    --sakura: #5A3A5E; --ink: #F5EDF8; --ink-soft: #C6B8DC; --stitch: #4E8F8C;
    --on-accent: #2A1F3D;
    --shadow: 0 6px 0 rgba(0, 0, 0, .28);
    --hero-grad: linear-gradient(135deg, #1F3B44 0%, #3E2546 55%, #2E2652 100%);
    color-scheme: dark;
  }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.75;
}
img, svg { max-width: 100%; height: auto; }
a {
  color: var(--bubble-ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: var(--bubblegum);
}
a:hover { text-decoration-color: var(--bubble-ink); }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.25; text-wrap: balance; margin: 0; }

.wrap { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 20px; }

/* text only screen readers hear */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* "Skip to content" link: hidden until someone tabs to it with a keyboard */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--cream); color: var(--ink); padding: 10px 16px; border-radius: 999px;
  font-family: var(--font-display); text-decoration: none; box-shadow: var(--shadow);
}
.skip-link:focus { top: 12px; }

/* falling petals canvas sits behind everything */
.petals { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.site { position: relative; z-index: 1; }

/* ---------- 3. Header ---------- */
.masthead { background: var(--hero-grad); position: relative; overflow: hidden; }
.masthead .branch {
  position: absolute; bottom: 10px; right: -30px; width: 52vw;
  opacity: .45; pointer-events: none;
}
@media (min-width: 33em) {
  .masthead .branch { top: -10px; bottom: auto; width: min(420px, 60vw); opacity: .95; }
}
.masthead .wrap { position: relative; z-index: 1; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-block: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 56px; height: 56px; }
@media (min-width: 33em) { .brand img { width: 68px; height: 68px; } }
.brand-name { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.1; display: block; }
.brand-jp { font-family: var(--font-hand); font-size: .95rem; color: var(--bubble-ink); letter-spacing: .12em; display: block; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-display); font-size: .95rem; text-decoration: none; color: var(--ink);
  padding: 4px 18px; border-radius: 999px;
  background: color-mix(in srgb, var(--cream) 70%, transparent);
}
.nav a:hover, .nav a[aria-current="page"] { background: var(--bubblegum); color: var(--on-accent); }

.hero { padding-block: 24px 44px; position: relative; max-width: 640px; }
@media (min-width: 33em) { .hero { padding-block: 40px 64px; } }
.hero h1 { font-size: var(--step-3); }
.hero h1 .pop { color: var(--bubble-ink); }
.hero p { font-size: var(--step-1); line-height: 1.6; color: var(--ink-soft); margin: 16px 0 0; max-width: 34ch; }

/* wavy bottom edge of the header */
.scallop { display: block; width: 100%; height: 26px; color: var(--sky); margin-top: -1px; }
.scallop path { fill: currentColor; }

/* ---------- 4. Page layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px;
  padding-block: 32px 64px; align-items: start;
}
@media (min-width: 54em) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } }

/* little handwritten label with a dashed thread running after it */
.section-label {
  font-family: var(--font-hand); font-size: 1rem; font-weight: 600; color: var(--aqua-ink); letter-spacing: .08em;
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px;
}
.section-label::after { content: ""; flex: 1; border-top: 2px dashed var(--stitch); }

.page-title { font-size: var(--step-3); margin: 0 0 18px; }
.page-note { margin: 24px 0 0; color: var(--ink-soft); }

/* stitched card */
.stitched {
  background: var(--cream); border-radius: var(--radius); box-shadow: var(--shadow);
  position: relative; padding: 22px 20px;
}
@media (min-width: 33em) { .stitched { padding: 24px 26px; } }
.stitched::before {
  content: ""; position: absolute; inset: 8px; border: 2px dashed var(--stitch);
  border-radius: calc(var(--radius) - 8px); pointer-events: none;
}

/* ---------- 5. Blog post list ---------- */
.posts { display: grid; gap: 22px; }
.post-card h2 { font-size: var(--step-2); margin: 6px 0 8px; }
.post-card h2 a { color: var(--ink); text-decoration: none; }
.post-card h2 a:hover { color: var(--bubble-ink); }
.post-card p { margin: 0; color: var(--ink-soft); }
.meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--step--1); color: var(--ink-soft); }

/* tag chips: <span class="tag">, add pink / aqua / lav / butter for the color */
.tag {
  font-size: .78rem; letter-spacing: .04em; padding: 2px 10px; border-radius: 999px;
  background: var(--sakura); color: var(--ink);
}
.tag.aqua   { background: color-mix(in srgb, var(--aqua) 35%, var(--cream)); }
.tag.lav    { background: color-mix(in srgb, var(--lavender) 45%, var(--cream)); }
.tag.butter { background: color-mix(in srgb, var(--butter) 55%, var(--cream)); }
.read-more { display: inline-block; margin-top: 12px; padding-block: 6px; font-family: var(--font-display); font-size: .9rem; }

/* ---------- 6. Sidebar ---------- */
.rail { display: grid; gap: 22px; }
.rail h2 { font-size: 1.1rem; margin-bottom: 10px; }
.about-mini p { margin: 0; font-size: .97rem; }

/* project rows (sidebar and Projects page) */
.project { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: start; padding-block: 10px; }
.project + .project { border-top: 2px dashed var(--stitch); }
.disc {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-size: .8rem; color: var(--ink); background: var(--sakura);
}
.disc.aqua { background: color-mix(in srgb, var(--aqua) 40%, var(--cream)); }
.disc.lav  { background: color-mix(in srgb, var(--lavender) 50%, var(--cream)); }
.project-name { display: block; font-weight: 700; line-height: 1.35; }
.project-jp { display: block; font-family: var(--font-hand); font-size: .85rem; color: var(--ink-soft); }
.status {
  display: inline-block; margin-top: 4px; font-size: .75rem; padding: 1px 9px; border-radius: 999px;
  background: var(--sky); color: var(--aqua-ink); border: 1.5px solid var(--stitch);
}

/* bigger version on the Projects page */
.project-card .project { padding: 0; }
.project-card .project-name { font-family: var(--font-display); font-weight: 400; font-size: var(--step-1); }
.project-card p { margin: 10px 0 0; color: var(--ink-soft); }

/* ---------- 7. Single post / article pages ---------- */
.article { max-width: calc(var(--measure) + 52px); }
.article h1 { font-size: var(--step-3); margin: 8px 0 12px; }
.article .meta { margin-top: 14px; }
.article .body { padding-top: 8px; }
.article .body > * { max-width: var(--measure); }
.article .body h2 { font-size: var(--step-1); margin: 1.8em 0 .4em; color: var(--bubble-ink); }
.article .body p { margin: 0 0 1.1em; }
.article .body ul { padding-left: 1.2em; margin: 0 0 1.1em; }
.article .body li::marker { color: var(--bubblegum); }
.article .body img { border-radius: 14px; }

/* Japanese line + English line, for translation examples */
.article blockquote {
  margin: 1.4em 0; padding: 14px 20px; border-radius: 16px; background: var(--sky);
  border: 2px dashed var(--stitch); font-family: var(--font-hand); font-weight: 600;
}
.article blockquote .ja { display: block; font-size: 1.15rem; }
.article blockquote .en { display: block; color: var(--ink-soft); font-family: var(--font-body); font-weight: 400; font-size: .95rem; }
.back { font-family: var(--font-display); font-size: .9rem; text-decoration: none; display: inline-block; padding-block: 6px; }

/* ---------- 8. 404 page ---------- */
.not-found { text-align: center; max-width: 520px; margin-inline: auto; }
.not-found img { width: 120px; height: 120px; }
.not-found h1 { font-size: var(--step-3); margin: 12px 0 8px; }

/* ---------- 9. Footer ---------- */
.footer {
  background: var(--cream); border-top: 2px dashed var(--stitch); padding-block: 28px 36px;
  font-size: var(--step--1); color: var(--ink-soft); position: relative; z-index: 1;
}
.footer .wrap { display: grid; gap: 8px; }
.footer-name { color: var(--ink); font-family: var(--font-display); }

/* ---------- 10. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) { .petals { display: none; } }
.footer p { margin: 0; }

/* ==========================================================================
   Blog engine additions: tag links, pager, reactions, comments, forms
   ========================================================================== */

.is-hidden { display: none !important; }
a.tag { text-decoration: none; }
a.tag:hover { text-decoration: underline; text-decoration-color: var(--ink-soft); }
.comment-count { font-size: var(--step--1); }
.page-note-top { margin: -8px 0 18px; }

/* older / newer posts */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; }
.pager a { font-family: var(--font-display); font-size: .95rem; padding-block: 8px; }
.pager-count { color: var(--ink-soft); font-size: var(--step--1); }

/* ---------- buttons and form fields ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 6px 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bubblegum); color: var(--on-accent);
  font: inherit; font-family: var(--font-display); font-size: .95rem; text-decoration: none;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--bubble-ink) 30%, transparent);
}
.button:hover { background: color-mix(in srgb, var(--bubblegum) 85%, var(--bubble-ink)); }
.button:active { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--bubble-ink) 30%, transparent); }
.button:disabled { opacity: .6; cursor: default; }

.field { display: grid; gap: 4px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: .95rem; }
.optional { font-weight: 400; color: var(--ink-soft); font-size: .85rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--sky);
  border: 2px solid var(--stitch); border-radius: 14px; padding: 10px 14px; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--aqua-ink); outline-offset: 1px; }
[aria-invalid="true"] { border-color: var(--bubble-ink); }
.field-error { color: var(--bubble-ink); font-size: .9rem; font-weight: 700; }
.field-check { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.field-check input { width: 22px; height: 22px; accent-color: var(--bubble-ink); margin: 0; }
.field-check label { font-weight: 400; }
.form-note { color: var(--ink-soft); font-size: var(--step--1); margin: 14px 0 0; }

/* hidden box that only spam bots fill in */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.notice { padding: 12px 18px; border-radius: 14px; margin: 0 0 18px; font-weight: 700; }
.notice-ok { background: color-mix(in srgb, var(--aqua) 30%, var(--cream)); color: var(--ink); }
.notice-error { background: color-mix(in srgb, var(--bubblegum) 28%, var(--cream)); color: var(--ink); }

/* ---------- reactions ---------- */
.reactions {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding-top: 20px;
  border-top: 2px dashed var(--stitch);
}
.reaction-form { margin: 0; }
.reaction {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px 6px 10px;
  border-radius: 999px; border: 2px solid var(--stitch); background: var(--sky); color: var(--ink);
  font: inherit; font-size: .92rem; cursor: pointer; transition: transform .15s ease;
}
.reaction svg { width: 26px; height: 26px; }
.reaction .ri-fill { fill: none; stroke: var(--bubble-ink); stroke-width: 6; }
.reaction .ri-center { fill: var(--butter); }
.reaction-count { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 1ch; }
.reaction:hover { transform: translateY(-2px); }
.reaction[aria-pressed="true"] { background: var(--sakura); border-color: var(--bubblegum); }
.reaction[aria-pressed="true"] .ri-fill { fill: var(--bubblegum); stroke: var(--bubble-ink); }
@media (prefers-reduced-motion: reduce) { .reaction { transition: none; } .reaction:hover { transform: none; } }

/* ---------- comments ---------- */
.post-column { display: grid; gap: 28px; min-width: 0; }
.post-column .article { max-width: none; }
.comments { display: grid; gap: 18px; }
.comments > h2 { font-size: var(--step-2); }
.comments-empty, .comments-closed { margin: 0; color: var(--ink-soft); }
.thread { display: grid; gap: 12px; }
.replies { display: grid; gap: 12px; margin-left: 8px; padding-left: 12px; border-left: 2px dashed var(--stitch); }
@media (min-width: 33em) { .replies { margin-left: 28px; padding-left: 18px; } }
.comment { background: var(--sky); border-radius: 18px; padding: 14px 18px; }
.comment-author { background: color-mix(in srgb, var(--sakura) 55%, var(--sky)); }
.comment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.comment-head .disc { width: 34px; height: 34px; font-size: .85rem; }
.disc.butter { background: color-mix(in srgb, var(--butter) 55%, var(--cream)); }
.disc.author { background: var(--bubblegum); color: var(--on-accent); }
.comment-name { font-family: var(--font-body); font-weight: 700; font-size: 1rem; line-height: 1.4; }
.author-badge {
  font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; padding: 1px 9px; border-radius: 999px;
  background: var(--bubblegum); color: var(--on-accent); font-weight: 700;
}
.comment-date { font-size: var(--step--1); color: var(--ink-soft); text-decoration: none; }
.comment-body { overflow-wrap: anywhere; }
.comment-body p { margin: 8px 0 0; }
.reply-link { display: inline-block; margin-top: 6px; padding-block: 6px; font-family: var(--font-display); font-size: .85rem; }
.respond { border-top: 2px dashed var(--stitch); padding-top: 20px; }
.respond h3 { font-size: var(--step-1); margin-bottom: 14px; }
.replying { margin: 0 0 14px; padding: 8px 14px; border-radius: 12px; background: var(--sky); }
