/* SaaS Design Agency: Medium-style layout. Tokens measured from medium.com (knowledge/medium-design-tokens.md). */
:root {
  --ink: #242424; --ink-2: #6B6B6B; --line: #F2F2F2; --soft: #F9F9F9; --green: #1A8917; --paper: #fff; --pill: #E6E6E6;
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, Cambria, "Times New Roman", Times, serif;
  --head-h: 57px; --side-w: 240px; --col: 680px; --rail-w: 368px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; border-radius: 4px; }
.skip:focus { left: 8px; }

/* header */
.hd { position: sticky; top: 0; z-index: 30; height: var(--head-h); background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 24px; }
.hd .burger { width: 40px; height: 40px; margin-left: -8px; display: grid; place-items: center; color: var(--ink-2); border-radius: 50%; }
.hd .burger:hover { color: var(--ink); }
.wordmark { font-family: var(--serif); font-weight: 800; font-size: 25px; letter-spacing: -0.035em; color: #000; white-space: nowrap; line-height: 1; }
.search { margin-left: 8px; width: 240px; height: 40px; border-radius: 20px; background: var(--soft); display: flex; align-items: center; gap: 10px; padding: 0 14px 0 12px; color: var(--ink-2); }
.search input { border: 0; background: transparent; font: 14px var(--sans); color: var(--ink); width: 100%; outline: none; }
.search input::placeholder { color: var(--ink-2); }
.search:focus-within { box-shadow: 0 0 0 1px var(--ink); }
.hd .sicon { display: none; margin-left: auto; width: 40px; height: 40px; place-items: center; color: var(--ink-2); }
.hd .agency { margin-left: auto; font-size: 14px; color: var(--ink-2); }
.hd .agency:hover { color: var(--ink); }

/* shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--head-h)); }
body.side-closed .shell { grid-template-columns: 0 minmax(0, 1fr); }
body.side-closed .side { visibility: hidden; }
.side { border-right: 1px solid var(--line); padding: 24px 0; position: sticky; top: var(--head-h); height: calc(100vh - var(--head-h)); overflow-y: auto; background: var(--paper); }
.side a { display: flex; align-items: center; gap: 16px; padding: 10px 24px; font-size: 16px; line-height: 24px; color: var(--ink-2); position: relative; }
.side a:hover { color: var(--ink); }
.side a[aria-current="page"] { color: var(--ink); }
.side a.nav[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 10px; width: 2px; height: 24px; background: var(--ink); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 16px 24px; }
.side .lbl { font-size: 13px; color: var(--ink-2); padding: 6px 24px 4px; }
.side a.topic { font-size: 14px; padding: 7px 24px 7px 64px; line-height: 20px; }
.ico { width: 24px; height: 24px; flex: none; }
.scrim { display: none; }
main { min-width: 0; }

/* home */
.home { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-w); }
.feed-col { padding: 40px 24px 80px; display: flex; justify-content: center; min-width: 0; }
.feed { width: 100%; max-width: var(--col); min-width: 0; }
.ftabs { display: flex; gap: 32px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ftabs a { padding: 16px 0 15px; color: var(--ink-2); }
.ftabs a:hover { color: var(--ink); }
.ftabs a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--ink); margin-bottom: -1px; }
.post { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 56px; padding: 32px 0 24px; border-bottom: 1px solid var(--line); }
.post.nothumb { grid-template-columns: minmax(0, 1fr); }
.by { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 20px; color: var(--ink-2); min-width: 0; }
.by a { color: var(--ink); }
.by a:hover { text-decoration: underline; }
.av { width: 20px; height: 20px; border-radius: 50%; flex: none; overflow: hidden; background: #D9DCE1; display: grid; place-items: center; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av svg { width: 100%; height: 100%; }
.av.org { background: var(--ink); color: #fff; font: 700 9px/1 var(--sans); letter-spacing: .02em; }
.post h2 { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -0.016em; margin: 12px 0 8px; text-wrap: balance; }
.card-link { display: block; }
.post p.sub { font-size: 16px; line-height: 20px; color: var(--ink-2); margin: 0; }
.meta { display: flex; align-items: center; gap: 20px; margin-top: 24px; font-size: 13px; color: var(--ink-2); }
.meta .grow { flex: 1; }
.meta .i, .act { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); min-height: 32px; }
.act:hover { color: var(--ink); }
.act[aria-pressed="true"] { color: var(--ink); }
.act[aria-pressed="true"] .save-o { display: none; }
.act:not([aria-pressed="true"]) .save-f { display: none; }
.thumb { width: 160px; height: 107px; border-radius: 2px; overflow: hidden; align-self: center; background: var(--line); display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.more-link { display: flex; justify-content: center; margin-top: 32px; }
.btn-o { border: 1px solid var(--ink); border-radius: 100px; padding: 8px 18px; font-size: 14px; }
.btn-o:hover { background: var(--ink); color: #fff; }
.empty { padding: 64px 0; text-align: center; color: var(--ink-2); }
.empty h2 { font-size: 22px; color: var(--ink); margin: 0 0 8px; }

.rail { border-left: 1px solid var(--line); padding: 40px 24px 40px 40px; min-width: 0; }
.rail h4 { font-size: 16px; line-height: 20px; font-weight: 500; margin: 0 0 18px; }
.rail section + section { margin-top: 40px; }
.pick { margin-bottom: 22px; display: block; }
.pick .by { font-size: 12px; }
.pick h5 { font-size: 16px; line-height: 20px; font-weight: 700; margin: 8px 0 6px; letter-spacing: -0.01em; }
.pick .d { font-size: 13px; color: var(--ink-2); }
.pick:hover h5 { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--line); border-radius: 100px; padding: 8px 16px; font-size: 14px; line-height: 20px; white-space: nowrap; }
.chip:hover { background: #E8E8E8; }
.foot { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); margin-top: 32px; }
.foot a:hover { color: var(--ink); }

/* article */
.art-col { display: flex; justify-content: center; padding: 48px 24px 0; }
.art { width: 100%; max-width: var(--col); min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { border: 1px solid var(--pill); border-radius: 100px; padding: 6px 14px; font-size: 14px; line-height: 20px; white-space: nowrap; }
.pill:hover { border-color: var(--ink-2); }
.art h1 { font-size: 42px; line-height: 52px; font-weight: 700; letter-spacing: -0.011em; margin: 28px 0 0; text-wrap: balance; }
.art .sub { font-size: 22px; line-height: 28px; color: var(--ink-2); margin: 16px 0 28px; font-weight: 400; }
.author { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-2); }
.author .av { width: 44px; height: 44px; }
.author .av.org { font-size: 13px; }
.author .nm { color: var(--ink); font-weight: 500; font-size: 16px; }
.author .nm:hover { text-decoration: underline; }
.abar { display: flex; align-items: center; gap: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 8px; margin: 28px 0 40px; font-size: 14px; color: var(--ink-2); }
.abar .grow { flex: 1; }
.abar.end { border: 0; padding-left: 0; margin: 24px 0 0; }
.clap { position: relative; }
.clap .bubble { position: absolute; left: -6px; top: -36px; background: var(--ink); color: #fff; font-size: 13px; border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; pointer-events: none; }
.clap.pop .bubble { opacity: 1; transform: none; }
.clap[data-mine]:not([data-mine="0"]) svg { color: var(--ink); }
figure { margin: 0; }
.hero img, .fig img { width: 100%; }
figcaption, .cap { font: 14px/20px var(--sans); color: var(--ink-2); text-align: center; margin-top: 10px; }
.tldr { margin: 40px 0 0; border-left: 3px solid var(--ink); padding: 4px 0 4px 20px; }
.tldr .k { font: 600 13px/20px var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 6px; }
.tldr ul { margin: 0; padding-left: 20px; font: 18px/28px var(--serif); display: grid; gap: 6px; }
.prose { font-family: var(--serif); }
.prose > * { margin: 0; }
.prose p, .prose li { font-size: 20px; line-height: 32px; letter-spacing: -0.003em; }
.prose p { margin-top: 33px; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose h2 { font: 700 24px/30px var(--sans); letter-spacing: -0.016em; margin-top: 56px; scroll-margin-top: 80px; text-wrap: balance; }
.prose h3 { font: 700 20px/24px var(--sans); letter-spacing: -0.012em; margin-top: 40px; scroll-margin-top: 80px; }
.prose h2 + p, .prose h3 + p { margin-top: 10px; }
.prose ul, .prose ol { margin-top: 24px; padding-left: 30px; display: grid; gap: 12px; }
.prose blockquote { margin-top: 40px; border-left: 3px solid var(--ink); padding-left: 20px; font: italic 20px/32px var(--serif); }
.prose code { font: 15px Menlo, Monaco, "Courier New", monospace; background: var(--line); padding: 3px 4px; border-radius: 3px; }
.prose pre { margin-top: 40px; background: var(--soft); border-radius: 4px; padding: 24px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 15px; line-height: 22px; }
.prose figure { margin-top: 40px; }
.prose figure video { width: 100%; background: #000; }
.prose hr { border: 0; margin: 40px 0 0; height: auto; overflow: visible; text-align: center; }
.prose hr::before { content: "· · ·"; display: block; font-size: 28px; line-height: 28px; letter-spacing: .5em; color: var(--ink); }
.prose .callout { margin-top: 40px; background: var(--soft); border-radius: 4px; padding: 20px 24px; font: 18px/28px var(--serif); }
.prose .tbl { margin-top: 40px; overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; font: 15px/22px var(--sans); }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { font-weight: 600; border-bottom-color: var(--ink); }
.prose .embed { margin-top: 32px; display: block; border: 1px solid var(--line); border-radius: 4px; padding: 16px 20px; font-family: var(--sans); }
.prose .embed b { display: block; font-size: 16px; }
.prose .embed span { font-size: 14px; color: var(--ink-2); }
.faq { margin-top: 56px; }
.faq h2 { font: 700 24px/30px var(--sans); letter-spacing: -0.016em; margin: 0 0 4px; }
.faq details { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq summary { font: 700 18px/26px var(--sans); list-style: none; display: flex; justify-content: space-between; gap: 16px; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; color: var(--ink-2); font-size: 22px; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { margin-top: 10px; font: 18px/28px var(--serif); }
.endpills { margin-top: 48px; }
.wb { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; margin: 48px 0 0; padding-bottom: 8px; }
.wb .av { width: 64px; height: 64px; }
.wb .av.org { font-size: 18px; }
.wb h3 { margin: 4px 0 6px; font-size: 24px; line-height: 30px; font-weight: 500; letter-spacing: -0.016em; }
.wb .f { font-size: 14px; color: var(--ink-2); }
.wb p { font-size: 14px; line-height: 20px; margin: 14px 0 0; max-width: 560px; }
.wb p a { text-decoration: underline; }
.more { background: var(--soft); margin-top: 72px; padding: 56px 24px 72px; display: flex; justify-content: center; }
.more-in { width: 100%; max-width: var(--col); }
.more h3 { font-size: 20px; line-height: 24px; margin: 0 0 28px; font-weight: 500; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px 32px; }
.mcard .mi { display: block; aspect-ratio: 3/2; border-radius: 2px; overflow: hidden; margin-bottom: 16px; background: var(--line); }
.mcard .mi img { width: 100%; height: 100%; object-fit: cover; }
.mcard h4 { font-size: 20px; line-height: 24px; font-weight: 700; margin: 10px 0 6px; letter-spacing: -0.016em; }
.mcard p { font-size: 15px; line-height: 20px; color: var(--ink-2); margin: 0; }
.mcard .meta { margin-top: 14px; }
.toc { position: fixed; right: 28px; top: 50%; transform: translateY(-50%); display: grid; gap: 4px; z-index: 5; }
.toc a { display: block; padding: 4px 0; }
.toc a span { width: 16px; height: 2px; background: #D6D6D6; display: block; transition: width .15s, background .15s; }
.toc a.on span, .toc a:hover span { background: var(--ink); width: 18px; }
.sfoot { border-top: 1px solid var(--line); padding: 24px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-2); }
.sfoot a:hover { color: var(--ink); }
.preview-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #FFF4CC; color: var(--ink); font-size: 13px; text-align: center; padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -1px 0 rgba(0,0,0,.06); }

/* topic / list pages */
.thead { text-align: center; padding: 56px 24px 36px; }
.thead .lbl { font-size: 14px; color: var(--ink-2); }
.thead h1 { font-size: 42px; line-height: 52px; letter-spacing: -0.011em; margin: 8px 0; font-weight: 700; }
.thead .c { font-size: 14px; color: var(--ink-2); }
.thead .chips { justify-content: center; margin-top: 24px; }
.list-col { display: flex; justify-content: center; padding: 0 24px 80px; }
.list-col .feed { border-top: 1px solid var(--line); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; max-width: 900px; margin: 0 auto; padding: 0 24px 80px; }
.tcard { border: 1px solid var(--line); border-radius: 4px; padding: 20px; }
.tcard:hover { border-color: var(--pill); }
.tcard b { display: block; font-size: 18px; }
.tcard span { font-size: 14px; color: var(--ink-2); }
.sform { display: flex; gap: 8px; max-width: 560px; margin: 24px auto 0; }
.sform input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--pill); border-radius: 22px; padding: 0 18px; font: 16px var(--sans); }
.sform button { height: 44px; padding: 0 20px; border-radius: 22px; background: var(--ink); color: #fff; font-size: 14px; }

/* share popover */
.sharepop { position: fixed; z-index: 60; background: var(--paper); border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.15); padding: 8px 0; min-width: 200px; }
.sharepop button, .sharepop a { display: flex; width: 100%; padding: 10px 20px; font-size: 14px; color: var(--ink-2); text-align: left; }
.sharepop button:hover, .sharepop a:hover { color: var(--ink); background: var(--soft); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 14px; padding: 10px 18px; border-radius: 4px; z-index: 70; }

/* ---------- responsive (Medium's breakpoints) ---------- */
@media (max-width: 1080px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .rail { border-left: 0; border-top: 1px solid var(--line); padding: 40px 24px 48px; display: flex; justify-content: center; background: var(--soft); }
  .rail > div { width: 100%; max-width: var(--col); }
  .toc { display: none; }
}
@media (max-width: 904px) {
  .shell, body.side-closed .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: var(--head-h); left: 0; bottom: 0; height: auto; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; box-shadow: 4px 0 16px rgba(0,0,0,.08); border-right: 0; }
  body.drawer-open .side { transform: none; visibility: visible; }
  body.drawer-open .scrim { display: block; position: fixed; inset: var(--head-h) 0 0 0; background: rgba(0,0,0,.28); z-index: 35; }
  body.side-closed .side { visibility: hidden; }
  body.drawer-open.side-closed .side { visibility: visible; }
}
@media (max-width: 728px) {
  .hd { padding: 0 16px; gap: 12px; }
  .wordmark { font-size: 21px; }
  .search, .hd .agency { display: none; }
  .hd .sicon { display: grid; }
  .feed-col { padding: 8px 24px 56px; }
  .post { grid-template-columns: minmax(0, 1fr) 80px; gap: 16px; padding: 22px 0 18px; }
  .post h2 { font-size: 16px; line-height: 20px; letter-spacing: -0.01em; margin: 8px 0 0; }
  .post p.sub { display: none; }
  .thumb { width: 80px; height: 53px; align-self: start; margin-top: 28px; }
  .meta { margin-top: 14px; gap: 16px; }
  .meta svg { width: 20px; height: 20px; }
  .rail { padding: 28px 24px 36px; }
  .art-col { padding: 24px 24px 0; }
  .pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -24px; padding-right: 24px; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { font-size: 13px; padding: 5px 12px; }
  .art h1 { font-size: 32px; line-height: 38px; margin-top: 18px; }
  .art .sub { font-size: 20px; line-height: 24px; margin: 10px 0 22px; }
  .abar { margin: 20px -24px 24px; padding: 4px 24px; gap: 22px; }
  .abar.end { margin: 16px 0 0; padding: 0; }
  .hero { margin: 0 -24px; }
  .tldr { margin-top: 28px; }
  .tldr ul { font-size: 17px; line-height: 26px; }
  .prose p, .prose li { font-size: 18px; line-height: 32px; }
  .prose p { margin-top: 26px; }
  .prose h2 { font-size: 20px; line-height: 24px; margin-top: 40px; }
  .prose h3 { font-size: 18px; line-height: 24px; margin-top: 32px; }
  .prose h2 + p, .prose h3 + p { margin-top: 8px; }
  .prose blockquote { font-size: 18px; line-height: 30px; }
  .prose figure, .prose pre { margin-left: -24px; margin-right: -24px; }
  .prose pre { border-radius: 0; }
  .prose figure figcaption, .hero figcaption { padding: 0 24px; }
  .faq h2 { font-size: 20px; line-height: 24px; }
  .faq summary { font-size: 16px; line-height: 24px; }
  .faq details > div { font-size: 17px; line-height: 26px; }
  .wb { grid-template-columns: 48px minmax(0, 1fr); gap: 16px; }
  .wb .av { width: 48px; height: 48px; }
  .wb h3 { font-size: 20px; line-height: 24px; }
  .more { padding: 40px 24px 56px; margin-top: 48px; }
  .mgrid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .thead { padding: 36px 24px 24px; }
  .thead h1 { font-size: 32px; line-height: 38px; }
  .thead .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 20px -24px 0; padding: 0 24px; scrollbar-width: none; }
  .act, .meta .i { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
