:root {
  --paper: #fbfaf6;
  --panel: #ffffff;
  --ink: #171816;
  --muted: #585f5a;
  --line: #d9d7cf;
  --line-strong: #b7b4aa;
  --blue: #164f76;
  --blue-soft: #e7f0f5;
  --green: #28624b;
  --green-soft: #e7f1eb;
  --red: #9a3d2f;
  --red-soft: #f6e7e3;
  --gold: #775917;
  --gold-soft: #f4ecd4;
  --max: 760px;
  --media-wide: 960px;
  --media-gap: clamp(30px, 5vw, 48px);
  --media-radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 246, 0.96);
}

.header-inner,
.article,
.footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
}

.brand,
.back-link {
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.back-link {
  color: var(--muted);
}

.article {
  padding: 64px 0 76px;
}

.article-header {
  display: grid;
  gap: 14px;
  margin-bottom: 36px;
}

.kicker,
.meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
ul,
ol,
blockquote,
pre {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  max-width: 720px;
  font-size: clamp(2.1rem, 7vw, 4rem);
  line-height: 1.05;
}

h2 {
  margin: 44px 0 12px;
  font-size: 1.45rem;
  line-height: 1.2;
}

h3 {
  margin: 30px 0 10px;
  font-size: 1.05rem;
  line-height: 1.25;
}

p,
li {
  overflow-wrap: anywhere;
}

.dek {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.12rem;
}

blockquote {
  border-left: 4px solid var(--gold);
  margin-left: 0;
  padding: 4px 0 4px 18px;
  color: var(--muted);
}

.article-figure {
  width: min(var(--max), 100%);
  margin: var(--media-gap) auto;
}

.article-figure.wide {
  width: min(var(--media-wide), calc(100vw - 40px));
  margin-left: 50%;
  transform: translateX(-50%);
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--media-radius);
  background: var(--panel);
  object-fit: contain;
}

.article-figure figcaption {
  max-width: var(--max);
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.article-figure.phone-shot {
  width: min(340px, 100%);
}

.article-figure.portrait {
  width: min(420px, 100%);
}

.article-figure.compact {
  width: min(640px, 100%);
}

.video-embed {
  width: min(var(--max), 100%);
  margin: var(--media-gap) auto;
}

.video-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--media-radius);
  background: #000;
}

.video-embed.short {
  width: min(320px, 100%);
}

.video-embed.short .video-frame {
  aspect-ratio: 9 / 16;
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.byline-small {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.byline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.28rem;
  height: 1.28rem;
  margin-left: 0.18em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.54rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  vertical-align: 0.12em;
  white-space: nowrap;
}

.byline-icon:hover {
  border-color: currentColor;
  color: var(--ink);
}

.quant-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  width: min(var(--media-wide), calc(100vw - 40px));
  margin: var(--media-gap) 0 var(--media-gap) 50%;
  transform: translateX(-50%);
}

.quant-gallery a {
  display: block;
  text-decoration: none;
}

.quant-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--line);
  border-radius: var(--media-radius);
  background: var(--panel);
}

.quant-gallery span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  padding: 0.08em 0.28em;
  font-size: 0.88em;
}

pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
}

pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 28px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  .header-inner,
  .article,
  .footer {
    width: min(var(--max), calc(100% - 28px));
  }

  .article {
    padding-top: 42px;
  }

  .article-figure.wide {
    width: calc(100vw - 28px);
  }

  .quant-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: calc(100vw - 28px);
    gap: 10px;
  }
}
