/* ==========================================================================
   Design system
   Single stylesheet, no framework. System font stack: a web font here would
   be render-blocking for no benefit, and this is a paste-and-go tool.
   ========================================================================== */

:root {
  /* Brand — Instagram's gradient, used sparingly as an accent only */
  --grad: linear-gradient(135deg, #f9ce34 0%, #ee2a7b 45%, #6228d7 100%);
  --brand: #d6216f;
  --brand-ink: #b31c5d;
  --brand-soft: #fdeef5;

  /* Neutrals */
  --bg: #ffffff;
  --bg-alt: #f7f7f9;
  --bg-sunken: #f1f1f4;
  --surface: #ffffff;
  --line: #e5e5ea;
  --line-strong: #d2d2d9;

  --ink: #16161a;
  --ink-2: #45454f;
  --ink-3: #6e6e7a;
  --ink-muted: #8e8e9a;

  --ok: #0f7b52;
  --ok-bg: #e7f6ef;
  --warn: #9a5b00;
  --warn-bg: #fdf3e3;
  --err: #b3261e;
  --err-bg: #fdecea;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(0.83rem, 0.81rem + 0.1vw, 0.88rem);
  --step-0:  clamp(1rem, 0.97rem + 0.15vw, 1.06rem);
  --step-1:  clamp(1.19rem, 1.13rem + 0.3vw, 1.35rem);
  --step-2:  clamp(1.42rem, 1.32rem + 0.5vw, 1.72rem);
  --step-3:  clamp(1.69rem, 1.53rem + 0.8vw, 2.2rem);
  --step-4:  clamp(2.02rem, 1.77rem + 1.25vw, 2.8rem);

  /* Space */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;

  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;

  --shadow-sm: 0 1px 2px rgb(16 16 26 / 0.05), 0 1px 3px rgb(16 16 26 / 0.06);
  --shadow: 0 4px 12px rgb(16 16 26 / 0.07), 0 2px 4px rgb(16 16 26 / 0.04);
  --shadow-lg: 0 12px 32px rgb(16 16 26 / 0.10), 0 4px 8px rgb(16 16 26 / 0.05);

  --wrap: 68rem;
  --wrap-narrow: 44rem;
  --measure: 38rem;

  --ease: cubic-bezier(0.2, 0, 0.13, 1);
}

/* Dark theme — applied by media query, overridden by the explicit toggle */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0d0d10;
    --bg-alt: #141419;
    --bg-sunken: #1a1a21;
    --surface: #16161c;
    --line: #26262f;
    --line-strong: #34343f;
    --ink: #f2f2f5;
    --ink-2: #c4c4cf;
    --ink-3: #9b9baa;
    --ink-muted: #7a7a89;
    --brand: #ff5fa2;
    --brand-ink: #ff7cb3;
    --brand-soft: #2a1220;
    --ok: #4ade9f; --ok-bg: #10261d;
    --warn: #eab464; --warn-bg: #2a1f0d;
    --err: #ff8a80; --err-bg: #2d1512;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 4px 14px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 14px 40px rgb(0 0 0 / 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #0d0d10;
  --bg-alt: #141419;
  --bg-sunken: #1a1a21;
  --surface: #16161c;
  --line: #26262f;
  --line-strong: #34343f;
  --ink: #f2f2f5;
  --ink-2: #c4c4cf;
  --ink-3: #9b9baa;
  --ink-muted: #7a7a89;
  --brand: #ff5fa2;
  --brand-ink: #ff7cb3;
  --brand-soft: #2a1220;
  --ok: #4ade9f; --ok-bg: #10261d;
  --warn: #eab464; --warn-bg: #2a1f0d;
  --err: #ff8a80; --err-bg: #2d1512;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow: 0 4px 14px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 14px 40px rgb(0 0 0 / 0.55);
}

/* --------------------------------------------------------------- reset */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
input, button, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-3);
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p  { margin: 0 0 var(--sp-4); text-wrap: pretty; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--brand-ink); }

:focus-visible {
  outline: 2.5px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-sunken);
  padding: 0.12em 0.38em;
  border-radius: 5px;
  border: 1px solid var(--line);
}

/* --------------------------------------------------------------- utility */

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--sp-5); }
.wrap-narrow { max-width: var(--wrap-narrow); }
.muted { color: var(--ink-muted); font-size: var(--step--1); }

.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-link {
  position: absolute; left: var(--sp-4); top: -4rem; z-index: 100;
  background: var(--brand); color: #fff; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
  transition: top 0.15s var(--ease);
}
.skip-link:focus { top: var(--sp-4); color: #fff; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 0.72rem 1.35rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600; font-size: var(--step-0);
  cursor: pointer; text-decoration: none;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease),
              box-shadow 0.15s var(--ease), border-color 0.15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand); color: #fff; box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-ink); color: #fff; box-shadow: var(--shadow); }

.btn-ghost {
  background: var(--surface); color: var(--ink-2); border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--bg-alt); color: var(--ink); border-color: var(--ink-muted); }

.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: 0.42rem 0.85rem; font-size: var(--step--1); border-radius: 8px; }
.btn-block { width: 100%; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex; align-items: center; gap: var(--sp-5);
  height: 4rem;
}

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-weight: 750; font-size: 1.08rem; letter-spacing: -0.03em;
  color: var(--ink); text-decoration: none; flex-shrink: 0;
}
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.brand-sm { font-size: 1rem; }

.main-nav { display: flex; gap: var(--sp-5); margin-left: auto; }
.main-nav a {
  color: var(--ink-2); text-decoration: none; font-weight: 550;
  font-size: 0.94rem; padding: 0.35rem 0; position: relative;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--brand); }

.theme-toggle {
  display: grid; place-items: center;
  width: 2.3rem; height: 2.3rem; flex-shrink: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; color: var(--ink-2);
}
.theme-toggle:hover { background: var(--bg-alt); color: var(--ink); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .theme-toggle .icon-sun { display: none; }
  :root[data-theme="auto"] .theme-toggle .icon-moon { display: block; }
}

/* --------------------------------------------------------------- tool nav */

.tool-nav { border-bottom: 1px solid var(--line); background: var(--bg); }

.tool-nav-inner {
  display: flex; gap: var(--sp-2);
  overflow-x: auto; scrollbar-width: none;
  padding-block: 0.55rem;
  scroll-snap-type: x proximity;

  /* Centred when the chips fit. `safe` is what makes this usable on a phone:
     with plain `center`, an overflowing flex row is centred on both sides and
     the first chips end up in negative scroll space, permanently unreachable.
     `safe center` falls back to flex-start the moment it overflows. */
  justify-content: center;
  justify-content: safe center;
}
.tool-nav-inner::-webkit-scrollbar { display: none; }

.tool-chip {
  display: inline-flex; align-items: center; gap: 0.42rem;
  padding: 0.48rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.875rem; font-weight: 570;
  text-decoration: none; white-space: nowrap;
  scroll-snap-align: start;
  transition: all 0.14s var(--ease);
}
.tool-chip:hover { border-color: var(--ink-muted); color: var(--ink); }
.tool-chip.is-active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.chip-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------- hero */

.hero {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  padding-block: clamp(var(--sp-6), 5vw, var(--sp-8));
}
.hero-inner { max-width: 46rem; margin-inline: auto; text-align: center; }

.hero-title {
  font-size: var(--step-4);
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-bottom: 0.08em;
}
.hero-lede {
  font-size: var(--step-1); color: var(--ink-2);
  max-width: 34rem; margin: 0 auto var(--sp-6);
  line-height: 1.55;
}

/* --------------------------------------------------------------- tool form */

.tool-form {
  display: flex; gap: var(--sp-3);
  max-width: 40rem; margin-inline: auto;
}

.field {
  position: relative; flex: 1;
  display: flex; align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand) 16%, transparent);
}
.field input {
  flex: 1; min-width: 0;
  padding: 0.85rem 1rem;
  background: transparent; border: 0; border-radius: 12px;
  font-size: 1rem;
}
.field input:focus { outline: none; }
.field input::placeholder { color: var(--ink-muted); }

.btn-paste {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-right: 0.4rem; padding: 0.42rem 0.7rem;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink-3);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  flex-shrink: 0;
}
.btn-paste:hover { color: var(--ink); border-color: var(--ink-muted); }
.btn-paste svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn-submit { position: relative; min-width: 7rem; }
.spinner {
  position: absolute; width: 17px; height: 17px;
  border: 2.2px solid rgb(255 255 255 / 0.35);
  border-top-color: #fff; border-radius: 50%;
  opacity: 0; animation: spin 0.65s linear infinite;
}
.is-loading .btn-label { opacity: 0; }
.is-loading .spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.tool-hint {
  margin: var(--sp-4) 0 0;
  font-size: var(--step--1); color: var(--ink-muted);
}

/* --------------------------------------------------------------- result */

.result { margin-top: var(--sp-5); }
.result:empty { margin: 0; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: left;
  animation: rise 0.3s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.result-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
  background: var(--bg-alt);
}
.result-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--brand);
}
.result-who { min-width: 0; flex: 1; }
.result-user { font-weight: 650; display: flex; align-items: center; gap: 0.3rem; }
.result-user svg { width: 15px; height: 15px; color: #3b9bf5; flex-shrink: 0; }
.result-sub { font-size: var(--step--1); color: var(--ink-muted); }

.result-caption {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line);
  font-size: 0.93rem; color: var(--ink-2);
  line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  max-height: 7.5rem; overflow: hidden; position: relative;
}
.result-caption.is-clamped::after {
  content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 3rem;
  background: linear-gradient(transparent, var(--surface));
}

.media-list { display: grid; gap: 1px; background: var(--line); }

.media-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4);
  background: var(--surface);
}

.media-thumb {
  width: 68px; height: 68px; flex-shrink: 0;
  border-radius: 10px; overflow: hidden;
  background: var(--bg-sunken);
  position: relative;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .badge-type {
  position: absolute; right: 4px; bottom: 4px;
  background: rgb(0 0 0 / 0.66); color: #fff;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.1rem 0.3rem; border-radius: 4px; text-transform: uppercase;
}

.media-info { flex: 1; min-width: 0; }
.media-label { font-weight: 620; font-size: 0.95rem; }
.media-detail { font-size: var(--step--1); color: var(--ink-muted); }
.media-note {
  font-size: var(--step--1); color: var(--ink-3);
  margin-top: 0.2rem; line-height: 1.45;
}

.result-foot {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  font-size: var(--step--1); color: var(--ink-muted);
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Errors */
.result-error {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--err-bg);
  border: 1px solid color-mix(in srgb, var(--err) 28%, transparent);
  border-radius: var(--radius);
  color: var(--ink); text-align: left;
  animation: rise 0.25s var(--ease);
}
.result-error svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--err); margin-top: 2px; }
.result-error p { margin: 0; font-size: 0.94rem; line-height: 1.55; }

/* --------------------------------------------------------------- hashtags */

.tag-tiers { display: grid; gap: var(--sp-4); }

.tier {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-4); text-align: left;
}
.tier-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); margin-bottom: 0.15rem; }
.tier-name { font-weight: 680; font-size: 0.98rem; }
.tier-count { font-size: var(--step--1); color: var(--ink-muted); }
.tier-note { font-size: var(--step--1); color: var(--ink-3); margin-bottom: var(--sp-3); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-chip {
  padding: 0.3rem 0.62rem;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: 7px; font-size: 0.855rem; color: var(--ink-2);
  cursor: pointer; transition: all 0.12s var(--ease);
  font-family: var(--mono);
}
.tag-chip:hover { border-color: var(--brand); color: var(--brand); }
.tag-chip.is-copied { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

.blend-box {
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: var(--radius); padding: var(--sp-4); text-align: left;
}
.blend-text {
  font-family: var(--mono); font-size: 0.845rem; line-height: 1.75;
  color: var(--ink-2); word-break: break-word; margin-bottom: var(--sp-3);
}

.advice-list { margin: 0; padding-left: 1.15rem; text-align: left; }
.advice-list li { margin-bottom: var(--sp-2); font-size: 0.92rem; color: var(--ink-2); line-height: 1.55; }

/* --------------------------------------------------------------- layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17.5rem;
  gap: var(--sp-7);
  padding-block: var(--sp-7) var(--sp-8);
  align-items: start;
}
@media (max-width: 62rem) {
  .layout { grid-template-columns: 1fr; gap: var(--sp-6); }
}

.sidebar { position: sticky; top: 8rem; display: grid; gap: var(--sp-4); }
@media (max-width: 62rem) { .sidebar { position: static; } }

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

.prose { max-width: var(--measure); font-size: 1.045rem; line-height: 1.75; }
.prose-centred { margin-inline: auto; }

.prose > section { margin-bottom: var(--sp-7); }
.prose h2 {
  margin-top: var(--sp-7); margin-bottom: var(--sp-4);
  font-size: var(--step-2); scroll-margin-top: 7rem;
}
.prose > section:first-child h2, .prose > h2:first-child { margin-top: 0; }
.prose h3 { margin-top: var(--sp-5); font-size: var(--step-1); scroll-margin-top: 7rem; }
.prose p { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 640; }
.prose ul, .prose ol { color: var(--ink-2); padding-left: 1.35rem; margin-bottom: var(--sp-4); }
.prose li { margin-bottom: 0.45rem; }
.prose li::marker { color: var(--ink-muted); }

.prose img { border-radius: var(--radius); margin-block: var(--sp-5); border: 1px solid var(--line); }
.prose figure { margin: var(--sp-5) 0; }
.prose figcaption { font-size: var(--step--1); color: var(--ink-muted); text-align: center; margin-top: var(--sp-2); }

.prose blockquote {
  margin: var(--sp-5) 0; padding: var(--sp-2) 0 var(--sp-2) var(--sp-5);
  border-left: 3px solid var(--brand);
  color: var(--ink-2); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose pre {
  background: var(--bg-sunken); border: 1px solid var(--line);
  padding: var(--sp-4); border-radius: var(--radius);
  overflow-x: auto; font-size: 0.88rem;
}
.prose pre code { background: none; border: 0; padding: 0; }

.prose table { width: 100%; border-collapse: collapse; margin-block: var(--sp-5); font-size: 0.94rem; }
.prose th, .prose td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { font-weight: 640; background: var(--bg-alt); }

.prose .note {
  background: var(--bg-alt); border: 1px solid var(--line);
  border-left: 3px solid var(--ink-muted);
  padding: var(--sp-4); border-radius: var(--radius-sm);
  font-size: 0.94rem; color: var(--ink-2);
}

.inline-link { font-weight: 550; }

/* --------------------------------------------------------------- steps */

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-4); }
.steps li { display: flex; gap: var(--sp-4); align-items: flex-start; margin: 0; scroll-margin-top: 7rem; }
.step-num {
  flex-shrink: 0; width: 2rem; height: 2rem;
  display: grid; place-items: center;
  background: var(--grad); color: #fff;
  border-radius: 50%; font-weight: 700; font-size: 0.9rem;
}
.steps h3 { margin: 0.15rem 0 0.3rem; font-size: 1.02rem; }
.steps p { margin: 0; font-size: 0.96rem; }

/* --------------------------------------------------------------- FAQ */

.faq { display: grid; gap: var(--sp-2); }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s var(--ease);
}
.faq-item[open] { border-color: var(--line-strong); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4);
  cursor: pointer; font-weight: 600; font-size: 0.985rem;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--bg-alt); }
.chev {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: var(--ink-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.2s var(--ease);
}
.faq-item[open] .chev { transform: rotate(180deg); }
.faq-answer { padding: 0 var(--sp-4) var(--sp-4); }
.faq-answer p { margin: 0; color: var(--ink-2); font-size: 0.955rem; line-height: 1.65; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.card-quiet { background: var(--bg-alt); }
.card-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em;
              color: var(--ink-muted); font-weight: 700; margin-bottom: var(--sp-3); }
.card p { font-size: 0.92rem; color: var(--ink-2); margin-bottom: var(--sp-3); }
.card-more { font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.card-more:hover { text-decoration: underline; }

.related-list, .link-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-3); }
.related-list a { text-decoration: none; display: block; }
.related-label {
  display: block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-muted); margin-bottom: 0.1rem;
}
.related-anchor { display: block; font-size: 0.92rem; color: var(--brand); line-height: 1.45; }
.related-list a:hover .related-anchor { text-decoration: underline; }

.link-list li { display: flex; flex-direction: column; gap: 0.1rem; }
.link-list a { font-size: 0.92rem; text-decoration: none; font-weight: 550; line-height: 1.45; }
.link-list a:hover { text-decoration: underline; }

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

.page-head {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  padding-block: var(--sp-7);
}
.page-head h1 { margin-bottom: var(--sp-3); }
.page-lede { font-size: var(--step-1); color: var(--ink-2); max-width: 38rem; line-height: 1.55; }

.crumbs { font-size: var(--step--1); color: var(--ink-muted); margin-bottom: var(--sp-3); display: flex; flex-wrap: wrap; gap: 0.4rem; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }

.blog-search {
  display: flex; align-items: center; gap: var(--sp-2);
  max-width: 30rem; margin-top: var(--sp-5);
  background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: 11px; padding: 0.25rem 0.25rem 0.25rem 0.85rem;
}
.blog-search:focus-within { border-color: var(--brand); }
.search-icon { width: 17px; height: 17px; fill: none; stroke: var(--ink-muted); stroke-width: 2; flex-shrink: 0; }
.blog-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0.55rem 0; }
.blog-search input:focus { outline: none; }

.pill-nav { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); }
.pill {
  padding: 0.36rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 0.86rem; font-weight: 550; color: var(--ink-2); text-decoration: none;
}
.pill:hover { border-color: var(--ink-muted); color: var(--ink); }
.pill.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill-count { opacity: 0.55; font-size: 0.78rem; }

.post-grid {
  display: grid; gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  padding-block: var(--sp-7);
}
.post-grid-3 { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }

.post-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.post-card-link { text-decoration: none; color: inherit; display: block; height: 100%; }

.post-card-media { aspect-ratio: 16 / 9; background: var(--bg-sunken); overflow: hidden; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; }

.post-card-body { padding: var(--sp-4); }
.post-card-title { font-size: 1.08rem; margin: var(--sp-2) 0; line-height: 1.35; color: var(--ink); }
.post-card:hover .post-card-title { color: var(--brand); }
.post-card-excerpt { font-size: 0.91rem; color: var(--ink-3); margin-bottom: var(--sp-3); line-height: 1.55; }
.post-card-meta { font-size: 0.8rem; color: var(--ink-muted); display: flex; gap: 0.4rem; align-items: center; }

.post-card-lead { grid-column: 1 / -1; }
@media (min-width: 48rem) {
  .post-card-lead .post-card-link { display: grid; grid-template-columns: 1.15fr 1fr; }
  .post-card-lead .post-card-media { aspect-ratio: auto; height: 100%; min-height: 15rem; }
  .post-card-lead .post-card-body { padding: var(--sp-6); align-self: center; }
  .post-card-lead .post-card-title { font-size: var(--step-2); }
  .post-card-lead .post-card-excerpt { font-size: 1rem; }
}

.tag {
  display: inline-block; padding: 0.17rem 0.55rem;
  background: var(--brand-soft); color: var(--brand-ink);
  border-radius: 5px; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.045em;
}

.pagination {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
  padding-bottom: var(--sp-8);
}
.page-count { font-size: var(--step--1); color: var(--ink-muted); }

.empty { text-align: center; padding: var(--sp-8) var(--sp-4); max-width: 30rem; margin-inline: auto; }
.empty h2 { font-size: var(--step-2); }
.empty p { color: var(--ink-3); margin-bottom: var(--sp-5); }

/* --------------------------------------------------------------- article */

.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 60; background: transparent; pointer-events: none;
}
.read-progress span {
  display: block; height: 100%; width: 0%;
  background: var(--grad); transition: width 0.08s linear;
}

.article-head { padding-block: var(--sp-7) var(--sp-5); }
.article-title { font-size: var(--step-4); margin-bottom: var(--sp-4); }
.article-standfirst {
  font-size: var(--step-1); color: var(--ink-2);
  line-height: 1.55; margin-bottom: var(--sp-4);
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
  font-size: 0.88rem; color: var(--ink-3);
  padding-top: var(--sp-3); border-top: 1px solid var(--line);
}

.article-cover { margin-block: 0 var(--sp-6); }
.article-cover img {
  width: 100%; border-radius: var(--radius-lg);
  aspect-ratio: 21 / 9; object-fit: cover; border: 1px solid var(--line);
}
.article-cover figcaption { font-size: var(--step--1); color: var(--ink-muted); text-align: center; margin-top: var(--sp-2); }

.article-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--sp-7);
  padding-bottom: var(--sp-8);
  align-items: start;
}
@media (max-width: 62rem) {
  .article-layout { grid-template-columns: 1fr; gap: var(--sp-5); }
}

.toc {
  position: sticky; top: 8rem;
  border-left: 2px solid var(--line);
  padding-left: var(--sp-4);
}
@media (max-width: 62rem) {
  .toc {
    position: static; border-left: 0; padding: var(--sp-4);
    background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius);
  }
}
.toc-title {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-muted); font-weight: 700; margin-bottom: var(--sp-3);
}
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.toc a {
  font-size: 0.875rem; color: var(--ink-3); text-decoration: none;
  line-height: 1.4; display: block; transition: color 0.12s var(--ease);
}
.toc a:hover { color: var(--ink); }
.toc a.is-current { color: var(--brand); font-weight: 600; }
.toc .toc-l3 { padding-left: var(--sp-4); font-size: 0.83rem; }

.article-body { font-size: 1.075rem; }
.article-body > *:first-child { margin-top: 0; }

.article-share {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-top: var(--sp-7); padding-top: var(--sp-5);
  border-top: 1px solid var(--line);
  font-size: 0.92rem; color: var(--ink-3);
}
.article-share svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; }

.tools-strip { padding-block: var(--sp-7); border-top: 1px solid var(--line); }
.tools-strip h2 { font-size: var(--step-1); margin-bottom: var(--sp-4); }
.tools-strip-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.strip-card {
  display: block; padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none;
  transition: all 0.15s var(--ease);
}
.strip-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.strip-label {
  display: block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted);
  margin-bottom: 0.2rem;
}
.strip-anchor { display: block; font-size: 0.95rem; color: var(--brand); line-height: 1.45; }

.related-posts { padding-bottom: var(--sp-8); border-top: 1px solid var(--line); padding-top: var(--sp-6); }
.related-posts h2 { font-size: var(--step-1); }
.related-posts .post-grid { padding-top: var(--sp-4); }

/* --------------------------------------------------------------- forms */

.form-field { margin-bottom: var(--sp-4); }
.form-field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.optional { font-weight: 400; color: var(--ink-muted); font-size: 0.85rem; }

.form-field input[type="text"], .form-field input[type="email"],
.form-field input[type="password"], .form-field input[type="search"],
.form-field input[type="datetime-local"],
.form-field textarea, .form-field select {
  width: 100%; padding: 0.62rem 0.8rem;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 9px;
}
.form-field textarea { resize: vertical; line-height: 1.6; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 34rem) { .form-row { grid-template-columns: 1fr; } }

.field-help { display: block; font-size: 0.82rem; color: var(--ink-muted); margin-top: 0.3rem; line-height: 1.5; }
.form-note { font-size: 0.85rem; color: var(--ink-muted); margin-top: var(--sp-3); }
.contact-form { margin-bottom: var(--sp-7); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.alert {
  padding: var(--sp-4); border-radius: var(--radius);
  margin-bottom: var(--sp-5); font-size: 0.94rem; line-height: 1.6;
  border: 1px solid transparent;
}
.alert-success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ink); }
.alert-error   { background: var(--err-bg); border-color: color-mix(in srgb, var(--err) 30%, transparent); color: var(--ink); }

/* --------------------------------------------------------------- 404 */

.notfound { text-align: center; padding-block: var(--sp-9); }
.notfound-code {
  font-size: clamp(4rem, 14vw, 7rem); font-weight: 800; line-height: 1; margin: 0 0 var(--sp-3);
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.notfound-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-5); }
.notfound-posts { margin-top: var(--sp-8); text-align: left; max-width: 24rem; margin-inline: auto; }
.notfound-posts h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }

/* --------------------------------------------------------------- footer */

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  padding-top: var(--sp-7);
  margin-top: auto;
}
.footer-grid {
  display: grid; gap: var(--sp-6);
  grid-template-columns: 1.6fr repeat(3, 1fr);
  padding-bottom: var(--sp-6);
}
@media (max-width: 52rem) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 30rem) { .footer-grid { grid-template-columns: 1fr; } }

.footer-blurb { font-size: 0.89rem; color: var(--ink-3); margin-top: var(--sp-3); max-width: 22rem; line-height: 1.6; }
.footer-col h2 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-muted); font-weight: 700; margin-bottom: var(--sp-3); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.footer-col a { font-size: 0.9rem; color: var(--ink-2); text-decoration: none; }
.footer-col a:hover { color: var(--brand); }

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-block: var(--sp-4) var(--sp-5);
}
.footer-bottom p { font-size: 0.8rem; color: var(--ink-muted); margin: 0 0 0.4rem; line-height: 1.6; max-width: 52rem; }
.footer-copy { font-weight: 500; }

body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* --------------------------------------------------------------- toast */

.toast {
  position: fixed; bottom: var(--sp-5); left: 50%;
  transform: translateX(-50%) translateY(1.5rem);
  background: var(--ink); color: var(--bg);
  padding: 0.7rem 1.15rem; border-radius: 999px;
  font-size: 0.88rem; font-weight: 550;
  box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

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

@media (max-width: 40rem) {
  .main-nav { display: none; }
  .header-inner { gap: var(--sp-3); }
  .brand { margin-right: auto; }
  .tool-form { flex-direction: column; }
  .btn-submit { width: 100%; padding-block: 0.85rem; }
  .hero { padding-block: var(--sp-6); }
  .media-item { gap: var(--sp-3); padding: var(--sp-3); }
  .media-thumb { width: 54px; height: 54px; }
  .wrap { padding-inline: var(--sp-4); }
}

/* --------------------------------------------------------------- ad slots */
/* A slot only reaches the page once it has code in it, so there is never an
   empty bordered box. No min-height either: reserving space for an ad that is
   not there is exactly the placeholder pattern AdSense policy prohibits. */

.ad-slot {
  display: block;
  margin-inline: auto;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}
.ad-slot:empty { display: none; }

.ad-slot-header,
.ad-slot-footer { padding-block: var(--sp-4); max-width: var(--wrap); padding-inline: var(--sp-5); }
.ad-slot-footer { border-top: 1px solid var(--line); }

.ad-slot-result { margin-top: var(--sp-5); }

.ad-slot-content_top { margin-bottom: var(--sp-6); }
.ad-slot-content_bottom { margin-top: var(--sp-6); }

.ad-slot-sidebar { margin-block: 0; }

@media (max-width: 62rem) {
  .ad-slot-sidebar { display: none; }
}

/* ------------------------------------------------------- tool screenshot */

.tool-figure {
  margin: var(--sp-5) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
}
.tool-figure img { width: 100%; height: auto; display: block; }
.tool-figure figcaption {
  font-size: var(--step--1);
  color: var(--ink-muted);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  text-align: center;
}
