/* regmicode.com design system: editorial, monochrome + one accent. */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --ink: #121316;
  --ink-2: #3a3c43;
  --muted: #6a6c74;
  --line: #e2dfd7;
  --accent: #2b4eff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(43, 78, 255, 0.08);
  --ok: #138a5b;
  --danger: #c2372f;
  --shadow: 0 1px 2px rgba(18, 19, 22, 0.04), 0 8px 24px rgba(18, 19, 22, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --wrap: 1140px;
  --gutter: clamp(16px, 4vw, 32px);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.88rem);
  --step-0: clamp(0.98rem, 0.95rem + 0.15vw, 1.06rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.35rem);
  --step-2: clamp(1.4rem, 1.25rem + 0.75vw, 1.9rem);
  --step-3: clamp(1.9rem, 1.55rem + 1.6vw, 2.9rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.4vw, 4.8rem);
  color-scheme: light;
}
html.dark-mode {
  --bg: #0c0d10;
  --surface: #14161b;
  --surface-2: #1b1e24;
  --ink: #ededf0;
  --ink-2: #c9cad1;
  --muted: #8f919b;
  --line: #262931;
  --accent: #8098ff;
  --accent-ink: #0c0d10;
  --accent-soft: rgba(128, 152, 255, 0.12);
  --ok: #45c48d;
  --danger: #ff7a70;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--step-0);
  line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
.icon { width: 1.1em; height: 1.1em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; stroke: none; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.mono { font-family: var(--mono); font-size: var(--step--1); letter-spacing: 0; }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; line-height: 1.2;
  cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 14px; font-size: 0.88rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; text-decoration: none; }
.link-arrow .icon { transition: transform 0.15s; }
.link-arrow:hover .icon { transform: translate(2px, -2px); }

/* ── Header / nav ────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50; padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; gap: 20px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-size: 0.8rem; font-weight: 600;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; list-style: none; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 0.94rem;
}
.nav-links a:hover, .nav-links a[aria-current="page"], .nav-links a.active { color: var(--ink); background: var(--surface-2); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.theme-toggle .moon { display: none; }
html.dark-mode .theme-toggle .sun { display: none; }
html.dark-mode .theme-toggle .moon { display: block; }
.menu-toggle { display: none; }
.mobile-only { display: none; }
.menu-toggle .i-shut, .site-header.open .menu-toggle .i-open { display: none; }
.site-header.open .menu-toggle .i-shut { display: block; }
@media (max-width: 900px) {
  .menu-toggle { display: inline-grid; }
  .mobile-only { display: list-item; }
  .nav-cta { display: none; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 2px; padding: 10px var(--gutter) 18px;
    background: var(--bg); border-bottom: 1px solid var(--line); display: none;
  }
  .nav-links a { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 1rem; }
  .site-header.open .nav-links { display: flex; }
  .nav-actions { margin-left: auto; }
}

/* ── Sections ────────────────────────────── */
.section { padding-block: clamp(64px, 9vw, 120px); border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head h2 { font-size: var(--step-3); max-width: 22ch; }
.section-head p { color: var(--muted); max-width: 60ch; }
.section-index { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); display: flex; gap: 10px; align-items: center; }
.section-index::after { content: ""; height: 1px; width: 40px; background: var(--line); }
.split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 72px); }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }
.sticky-col { position: sticky; top: 100px; align-self: start; }
@media (max-width: 860px) { .sticky-col { position: static; } }

/* ── Hero ────────────────────────────────── */
.hero { padding-block: clamp(48px, 9vw, 112px) clamp(56px, 8vw, 104px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 64px); align-items: end; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1fr); align-items: start; } }
.hero h1 { font-size: clamp(2.4rem, 1.7rem + 2.9vw, 4.25rem); letter-spacing: -0.04em; line-height: 1.02; margin: 18px 0 22px; max-width: 17ch; }
.hero h1 .accent { color: var(--accent); }
.hero-lead { font-size: var(--step-1); color: var(--ink-2); max-width: 40ch; line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.now-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.now-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.now-head img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.now-head strong { display: block; font-weight: 600; }
.now-list { display: grid; margin: 0; }
.now-list div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 20px; border-bottom: 1px dashed var(--line); }
.now-list div:last-child { border-bottom: 0; }
.now-list dt { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); padding-top: 2px; }
.now-list dd { margin: 0; font-size: 0.95rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.hero-meta a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-2); font-size: 0.94rem; }

/* ── About ───────────────────────────────── */
.prose { font-size: var(--step-1); line-height: 1.6; color: var(--ink-2); display: grid; gap: 1em; max-width: 62ch; }
.prose strong { color: var(--ink); font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 36px; }
.facts div { background: var(--surface); padding: 16px 18px; min-width: 0; }
.facts dt { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); margin-bottom: 4px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .facts { grid-template-columns: minmax(0, 1fr); } }
.portrait { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 5; background: var(--surface-2); max-width: 340px; }
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(0.15) contrast(1.03); }

/* ── Experience ──────────────────────────── */
.timeline { list-style: none; border-top: 1px solid var(--line); }
.role { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: clamp(16px, 4vw, 48px); padding-block: 28px; border-bottom: 1px solid var(--line); }
.role-period { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); padding-top: 4px; }
.role h3 { font-size: var(--step-1); }
.role-company { color: var(--accent); font-weight: 500; }
.role ul { list-style: none; display: grid; gap: 10px; margin-top: 14px; color: var(--ink-2); }
.role li { position: relative; padding-left: 20px; }
.role li::before { content: ""; position: absolute; left: 2px; top: 0.72em; width: 8px; height: 1px; background: var(--muted); }
@media (max-width: 640px) { .role { grid-template-columns: minmax(0, 1fr); gap: 6px; } }
.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin-top: 48px; }
.edu { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--surface); }
.edu h3 { font-size: 1.08rem; margin: 8px 0 4px; }

/* ── Work ────────────────────────────────── */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2.5vw, 28px); }
@media (max-width: 760px) { .work-grid { grid-template-columns: minmax(0, 1fr); } }
.work { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; transition: border-color 0.2s, transform 0.2s; }
.work:hover { border-color: color-mix(in srgb, var(--ink) 40%, var(--line)); }
.work-media { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--line); }
.work-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.work:hover .work-media img { transform: scale(1.03); }
.work-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; flex: 1; }
.work-top { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: var(--step--1); color: var(--muted); }
.work h3 { font-size: var(--step-1); }
.work p { color: var(--ink-2); }
.stack { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 0; }
.stack span:not(:last-child)::after { content: "·"; margin: 0 8px; opacity: 0.6; }
.work-links { display: flex; gap: 18px; margin-top: auto; padding-top: 6px; }
.work.featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.work.featured .work-media { aspect-ratio: auto; min-height: 320px; border-bottom: 0; border-right: 1px solid var(--line); }
.work.featured .work-body { padding: clamp(22px, 3vw, 36px); justify-content: center; }
.work.featured h3 { font-size: var(--step-2); }
@media (max-width: 760px) {
  .work.featured { grid-template-columns: minmax(0, 1fr); }
  .work.featured .work-media { min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--line); }
}
.section-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 32px; }

/* Work index page */
.page-head { padding-block: clamp(48px, 8vw, 96px) clamp(28px, 4vw, 44px); }
.page-head h1 { font-size: var(--step-4); letter-spacing: -0.04em; margin: 14px 0 16px; }
.page-head p { color: var(--ink-2); font-size: var(--step-1); max-width: 58ch; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-family: var(--mono); font-size: var(--step--1); color: var(--ink-2);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.index-list { list-style: none; border-top: 1px solid var(--line); }
.index-row { display: grid; grid-template-columns: 48px 200px minmax(0, 1fr) auto; gap: clamp(14px, 3vw, 32px); align-items: center; padding-block: 22px; border-bottom: 1px solid var(--line); }
.index-num { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); }
.index-thumb { aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.index-thumb img { width: 100%; height: 100%; object-fit: cover; }
.index-row h2 { font-size: var(--step-1); margin-bottom: 4px; }
.index-row p { color: var(--ink-2); margin-bottom: 8px; }
.index-links { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
@media (max-width: 860px) {
  .index-row { grid-template-columns: 120px minmax(0, 1fr); align-items: start; }
  .index-num { display: none; }
  .index-links { grid-column: 2; flex-direction: row; align-items: center; gap: 18px; }
}
@media (max-width: 520px) {
  .index-row { grid-template-columns: minmax(0, 1fr); }
  .index-links { grid-column: 1; }
}

/* ── Stack ───────────────────────────────── */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stack-col { background: var(--surface); padding: 22px; }
.stack-col h3 { font-family: var(--mono); font-size: var(--step--1); font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.stack-col ul { list-style: none; display: grid; gap: 10px; }
.stack-col li { display: flex; align-items: center; gap: 10px; }
.stack-col img { width: 20px; height: 20px; object-fit: contain; }
.stack-extra { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px 40px; margin-top: 28px; }
.stack-extra dt { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); margin-bottom: 6px; }
.stack-extra dd { margin: 0; color: var(--ink-2); }

/* ── Interests ───────────────────────────── */
.disclosure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.disclosure summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; cursor: pointer; list-style: none; font-weight: 500; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .icon { transition: transform 0.2s; }
.disclosure[open] summary .icon { transform: rotate(45deg); }
.disclosure-body { padding: 4px 22px 22px; display: grid; gap: 18px; }
.tag-group h3 { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.tags li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; color: var(--ink-2); }

/* ── Contact ─────────────────────────────── */
.contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.contact-grid h2 { font-size: var(--step-3); margin: 14px 0 16px; }
.contact-email { display: inline-block; font-size: var(--step-2); font-weight: 600; letter-spacing: -0.02em; margin: 18px 0 26px; overflow-wrap: anywhere; }
.contact-list { list-style: none; display: grid; gap: 12px; color: var(--ink-2); }
.contact-list li { display: flex; gap: 12px; align-items: center; }
.contact-list a { text-decoration: none; }
.form { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 32px); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.88rem; font-weight: 500; color: var(--ink-2); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg);
  font-size: 1rem; transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-note { font-size: 0.86rem; color: var(--muted); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); margin-bottom: 16px; }
.alert-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); }

/* ── Footer ──────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding-block: 40px calc(40px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 0.92rem; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; }
.footer-links a { text-decoration: none; }

/* ── Updates (journal) ───────────────────── */
.feed { list-style: none; border-top: 1px solid var(--line); max-width: 860px; }
.feed-item { border-bottom: 1px solid var(--line); }
.feed-link { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 20px; padding-block: 20px; text-decoration: none; color: inherit; }
.feed-link:hover h2 { color: var(--accent); }
.feed-thumb { aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.feed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.feed-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--mono); font-size: var(--step--1); color: var(--muted); margin-bottom: 6px; }
.feed-meta span { display: inline-flex; align-items: center; gap: 5px; }
.feed-link h2 { font-size: 1.12rem; margin-bottom: 4px; transition: color 0.15s; }
.feed-link p { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 520px) { .feed-link { grid-template-columns: 88px minmax(0, 1fr); gap: 14px; padding-block: 16px; } .feed-link p { -webkit-line-clamp: 2; font-size: 0.94rem; } }
.empty-state { padding: 48px 0; color: var(--muted); }

/* Post page */
.article { max-width: 760px; }
.article-head { padding-block: clamp(40px, 7vw, 80px) 24px; }
.article-head h1 { font-size: var(--step-3); letter-spacing: -0.03em; margin: 14px 0 12px; }
.article-figure { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.article-figure button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.article-figure img { width: 100%; max-height: 560px; object-fit: cover; }
.article-body { font-size: var(--step-1); line-height: 1.7; color: var(--ink-2); display: grid; gap: 1em; }
.article-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-block: 24px; margin-top: 32px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.like-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.like-btn[aria-pressed="true"] .icon { fill: currentColor; }
.comments { padding-block: 32px 8px; display: grid; gap: 18px; }
.comments h2 { font-size: var(--step-1); }
.comment { border-left: 2px solid var(--line); padding: 2px 0 2px 16px; }
.comment-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 4px; }
.comment-head strong { font-weight: 600; }
.comment p { color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.more-posts { margin-top: 48px; }

/* ── Tools ───────────────────────────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; }
.tool {
  display: flex; flex-direction: column; gap: 10px; text-align: left; padding: 24px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; transition: border-color 0.15s, transform 0.15s; color: inherit; text-decoration: none;
}
.tool:hover { border-color: var(--ink); color: inherit; }
.tool-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.25rem; }
.tool h2 { font-size: 1.12rem; }
.tool p { color: var(--ink-2); font-size: 0.95rem; }
.tool .link-arrow { margin-top: auto; color: var(--accent); }

/* ── Dialogs ─────────────────────────────── */
dialog.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(8, 9, 12, 0.55); backdrop-filter: blur(2px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.1rem; }
.sheet-body { padding: 20px; display: grid; gap: 14px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--bg); }
.segmented label { text-align: center; padding: 8px; border-radius: 999px; cursor: pointer; font-size: 0.92rem; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { display: block; }
.segmented label:has(input:checked) { background: var(--ink); color: var(--bg); }
.result { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: var(--bg); display: grid; gap: 8px; }
.result-big { font-size: var(--step-2); font-weight: 600; letter-spacing: -0.02em; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.kv div { display: grid; }
.kv dt { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); }
.kv dd { margin: 0; }
dialog.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 92dvh; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
dialog.lightbox img { max-width: 96vw; max-height: 88dvh; object-fit: contain; border-radius: var(--radius-sm); }
dialog.lightbox .icon-btn { position: fixed; top: 16px; right: 16px; }

/* ── Chat widget ─────────────────────────── */
.chat-fab {
  position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--surface-2); color: var(--ink); box-shadow: var(--shadow); cursor: grab;
  opacity: .8; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .2s ease, opacity .2s ease;
}
.chat-fab:hover, .chat-fab:focus-visible, .chat-fab[aria-expanded="true"] { opacity: 1; }
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab.dragging { opacity: .55; transform: scale(1.08); cursor: grabbing; transition: none; }
.chat-fab img { pointer-events: none; -webkit-user-drag: none; }
.chat-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.chat-fab > .chat-fab-dot { position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border: 2px solid var(--surface); }
.chat-fab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22a55b; }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.chat-panel {
  position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); z-index: 61;
  width: min(390px, calc(100vw - 24px)); height: min(580px, calc(100dvh - 120px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head strong { display: block; font-size: 0.98rem; }
.chat-status { display: flex; align-items: center; gap: 6px; font-size: var(--step--1); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 0.95rem; overflow-wrap: anywhere; }
.bubble > * + * { margin-top: 8px; }
.bubble p { margin: 0; }
.bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble.bot { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--ink); color: var(--bg); align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.typing { display: flex; gap: 4px; padding: 14px 16px; }
.bubble.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chat-dot 1s infinite ease-in-out; }
.bubble.typing span:nth-child(2) { animation-delay: .15s; }
.bubble.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.reply-meta { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.reply-list { margin: 0; padding-left: 18px; list-style: disc; }
.reply-list li + li { margin-top: 4px; }
.reply-items { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.reply-items li { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.reply-items strong { display: block; font-size: 0.92rem; }
.reply-items p { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.reply-num { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); padding-top: 3px; }
.reply-contacts { display: grid; gap: 6px; }
.bubble:has(.reply-contacts), .bubble:has(.reply-items) { max-width: 100%; width: 100%; }
.reply-contact { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; transition: border-color .15s ease; }
a.reply-contact:hover { border-color: var(--accent); }
.reply-contact .icon { flex: none; width: 30px; height: 30px; padding: 7px; border-radius: 8px; background: var(--surface-2); color: var(--accent); }
.reply-contact > span { min-width: 0; flex: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.reply-contact small { white-space: nowrap; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.reply-contact > span > span { font-size: 0.86rem; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-suggest button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 0.84rem; cursor: pointer; }
.chat-suggest button:hover { border-color: var(--accent); color: var(--accent); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.chat-form input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 640px) {
  .chat-fab { width: 40px; height: 40px; }
  .chat-panel { inset: 0 !important; width: 100% !important; height: 100% !important; max-height: none !important; border: 0; border-radius: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
  html.chat-open, html.chat-open body { overflow: hidden; }
  html.chat-open .chat-fab { display: none; }
}
@media (max-width: 420px) { .reply-contact small { display: none; } .reply-contact > span { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { .bubble.typing span { animation: none; } .chat-fab { transition: none; } }

/* ── Thank-you ───────────────────────────── */
.center-card { max-width: 620px; margin: clamp(48px, 10vw, 120px) auto; text-align: left; }
.center-card h1 { font-size: var(--step-3); margin: 16px 0 12px; }

/* ── Motion ──────────────────────────────── */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
