/* Theme styles. All colours, sizes and spacing come from tokens.css. */

/* Fonts (open licence, bundled) */
@font-face { font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2-variations"); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--gh-font-body, var(--font-body, var(--font-sans))); font-size: var(--text-base); line-height: var(--leading-normal);
}
.font-serif { --font-body: var(--font-serif); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--gh-font-heading, inherit); line-height: var(--leading-tight); margin: 0 0 var(--space-3); font-weight: var(--weight-bold); }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--space-4); }
.muted { color: var(--text-muted); }
.lead { font-size: var(--text-lg); color: var(--text-muted); max-width: 60ch; }
.center { text-align: center; }
.center .lead { margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--space-3); top: -100px; background: var(--accent); color: var(--on-accent); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); z-index: 100; }
.skip-link:focus { top: var(--space-3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layout */
.container { width: min(100% - 2 * var(--space-4), var(--max)); margin-inline: auto; }
.container-narrow { width: min(100% - 2 * var(--space-4), var(--content)); }
.section { padding-block: var(--space-8); }
.section-tint { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); margin-bottom: var(--space-5); }
.section-head h2 { margin: 0; }
.page-head { margin-bottom: var(--space-6); }
.picks-intro { max-width: var(--content); margin-bottom: var(--space-6); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.center-row { justify-content: center; }
.grid { display: grid; gap: var(--space-5); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-products[data-layout="Grid"], .grid-products:not([data-layout]) { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-products[data-layout="List"] { grid-template-columns: 1fr; }
.grid-tiers { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); max-width: 960px; margin-inline: auto; }

/* Header */
.site-header { background: var(--bg); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.header-sticky .site-header { position: sticky; top: 0; box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--header-height); gap: var(--space-4); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text); text-decoration: none; font-weight: var(--weight-bold); }
.brand-logo { height: 40px; width: auto; }
.header-panel { display: flex; align-items: center; gap: var(--space-5); flex: 1; justify-content: space-between; }
.nav-list { display: flex; flex-wrap: wrap; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.nav-list a { color: var(--text); text-decoration: none; font-weight: var(--weight-medium); }
.nav-list a:hover, .nav-current a { color: var(--accent-text); }
.header-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.icon-btn { background: transparent; border: 0; color: var(--text); width: 40px; height: 40px; border-radius: var(--radius-md); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.menu-btn { display: none; }

/* Buttons and forms */
.btn { font: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: background var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease); }
.btn-lg { min-height: 48px; padding-inline: var(--space-5); font-size: var(--text-base); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-input); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.input { font: inherit; height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--border-input); background: var(--bg); color: var(--text); min-width: 0; width: 100%; }
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.newsletter-field { display: block; }
.newsletter-form { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2); max-width: 460px; margin-top: var(--space-4); }
.center .newsletter-form { margin-inline: auto; }
.newsletter-form .msg, .auth-form .msg { grid-column: 1 / -1; }
.auth-form { display: grid; gap: var(--space-3); max-width: 380px; margin: var(--space-5) auto; text-align: left; }
.msg { display: none; font-size: var(--text-sm); margin: 0; }
.msg-success { color: var(--success); }
.msg-error { color: var(--danger); }
form.success .msg-success, form.error .msg-error { display: block; }
.label-loading { display: none; }
form.loading .label-default { display: none; }
form.loading .label-loading { display: inline; }

.switch { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--radius-full); overflow: hidden; }
.switch button { font: inherit; font-size: var(--text-sm); background: transparent; color: var(--text); border: 0; padding: 6px 12px; cursor: pointer; }
.switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Hero */
.hero { padding-block: var(--space-8); position: relative; border-bottom: 1px solid var(--border); }
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--gradient-brand); }
.hero-inner { display: grid; gap: var(--space-6); align-items: center; }
.hero h1 { font-size: var(--text-2xl); max-width: 18ch; }
.hero[data-image="Side"] .hero-inner { grid-template-columns: 1.1fr .9fr; }
.hero[data-image="Hidden"] .hero-media { display: none; }
.hero[data-image="Background"] { color: var(--text); }
.hero[data-image="Background"] .hero-media { position: absolute; inset: 0; z-index: 0; opacity: .18; }
.hero[data-image="Background"] .hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero[data-image="Background"] .hero-text { position: relative; z-index: 1; }
.hero-media img { border-radius: var(--radius-lg); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: box-shadow var(--motion-base) var(--ease); }
.card:hover { box-shadow: var(--shadow-md); }
.card-bar { height: 6px; background: var(--tag-color, var(--gradient-brand)); }
.card-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.post-card .card-media img { aspect-ratio: 16 / 10; }
.card-body { padding: var(--space-5); display: grid; gap: var(--space-2); align-content: start; flex: 1; }
.card-title { margin: 0; font-size: var(--text-lg); }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent-text); text-decoration: underline; }
.card-excerpt { margin: 0; font-size: var(--text-sm); }
.card-link { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.card-meta { display: flex; gap: var(--space-2); align-items: center; margin: 0; font-size: var(--text-sm); }
.card-foot { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin: 0; font-size: var(--text-sm); }
.tag-label { color: var(--accent-text); font-weight: var(--weight-semibold); text-decoration: none; }
.grid-products[data-layout="List"] .product-card { flex-direction: row; }
.grid-products[data-layout="List"] .product-card .card-bar { width: 6px; height: auto; }
.grid-products[data-layout="List"] .product-card .card-media { width: 220px; flex: none; }
.grid-products[data-layout="List"] .product-card .card-media img { height: 100%; aspect-ratio: auto; }
.avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; }
.avatar-lg { width: 96px; height: 96px; margin-bottom: var(--space-3); }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: var(--text-sm); padding: 4px 12px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text); text-decoration: none; width: fit-content; }
.chip b { color: var(--text-muted); font-weight: var(--weight-medium); }
.chip:hover { outline: 1px solid var(--accent); }
.chip-lg { font-size: var(--text-base); padding: 8px 16px; }
.chip-list { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0 0 var(--space-5); padding: 0; }
.badge { font-size: var(--text-xs); background: var(--accent); color: var(--on-accent); padding: 2px 8px; border-radius: var(--radius-full); font-weight: var(--weight-semibold); }
.testimonial { padding: var(--space-5); gap: var(--space-4); margin: 0; }
.testimonial blockquote { margin: 0; font-size: var(--text-base); }
.testimonial figcaption { display: flex; align-items: center; gap: var(--space-3); }
.testimonial cite { font-style: normal; font-weight: var(--weight-semibold); }
.tag-head { position: relative; padding-top: var(--space-5); }
.tag-head .card-bar { position: absolute; top: 0; left: 0; right: 0; border-radius: var(--radius-full); }

/* Pagination */
.pagination { display: flex; gap: var(--space-5); align-items: center; justify-content: center; margin-top: var(--space-7); }

/* Tiers */
.tier { padding: var(--space-5); gap: var(--space-3); }
.tier h2 { font-size: var(--text-lg); margin: 0; }
.tier-paid { border-color: var(--accent); }
.price { font-size: var(--text-xl); font-weight: var(--weight-bold); margin: 0; }
.price .muted { font-size: var(--text-sm); font-weight: var(--weight-regular); }
.benefits { padding-left: var(--space-5); margin: 0; }
.price-yearly { display: none; }
[data-billing-state="yearly"] .price-yearly { display: inline; }
[data-billing-state="yearly"] .price-monthly { display: none; }
[data-billing-state="yearly"] a.btn.price-yearly { display: inline-flex; }

/* Post */
.post-head { margin-bottom: var(--space-5); }
.post-title { font-size: var(--text-2xl); }
.post-byline { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.post-image { margin: 0 0 var(--space-6); }
.post-image img { width: 100%; border-radius: var(--radius-lg); }
.img-small .page:not([class*="page-img-"]) .post-image, .img-small .post-image-product { max-width: 320px; }
.img-medium .page:not([class*="page-img-"]) .post-image, .img-medium .post-image-product { max-width: 480px; }
/* per-page image tags */
.page-img-small .post-image { max-width: 320px; }
.page-img-medium .post-image { max-width: 480px; }
.page-img-large .post-image { max-width: none; }
.page-img-center .post-image { margin-inline: auto; }
.page-img-right .post-image { margin-left: auto; }
.page-img-center .post-image img, .page-img-right .post-image img { width: 100%; }
/* full-width banner: the image sits behind a dark layer so the white text always has enough contrast */
.page-hero { background: linear-gradient(rgba(0, 0, 0, .62), rgba(0, 0, 0, .62)), var(--hero-image) center / cover no-repeat; color: #fff; min-height: 300px; display: flex; align-items: center; padding-block: var(--space-8); }
.page-hero h1, .page-hero .lead { color: #fff; }
.page-hero .lead { margin-bottom: 0; }
.page-img-hero { padding-top: var(--space-7); }
.post-image figcaption { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-2); }
.buy-bar { display: grid; gap: var(--space-2); margin-block: var(--space-4); }
.buy-bar[hidden] { display: none; }
.disclosure { font-size: var(--text-sm); }
.toc { border-left: 2px solid var(--border); padding-left: var(--space-4); margin-bottom: var(--space-6); }
.toc[hidden] { display: none; }
.toc-title { font-weight: var(--weight-semibold); margin-bottom: var(--space-2); }
.toc-list { margin: 0; padding-left: var(--space-4); color: var(--text-muted); }
.toc-list a { color: var(--text-muted); }
.toc-list a[aria-current="true"] { color: var(--accent-text); font-weight: var(--weight-semibold); }

.gh-content > * + * { margin-top: var(--space-4); }
.gh-content h2, .gh-content h3 { margin-top: var(--space-7); scroll-margin-top: calc(var(--header-height) + var(--space-4)); }
.gh-content p, .gh-content li { font-size: 1.0625rem; }
.gh-content blockquote:not([class]) { border-left: 4px solid var(--accent); padding-left: var(--space-4); margin-left: 0; color: var(--text-muted); }
.gh-content img { border-radius: var(--radius-md); }
.gh-content pre { background: var(--surface-2); padding: var(--space-4); border-radius: var(--radius-md); overflow-x: auto; }
.gh-content code { font-family: var(--font-mono); font-size: .9em; }
.gh-content hr { border: 0; border-top: 1px solid var(--border); margin-block: var(--space-6); }
.gh-content table { width: 100%; border-collapse: collapse; }
.gh-content th, .gh-content td { border-bottom: 1px solid var(--border); padding: var(--space-2) var(--space-3); text-align: left; }
.kg-width-wide { width: min(100vw - 2 * var(--space-4), var(--max)); margin-inline: 50%; transform: translateX(-50%); }
.kg-width-full { width: 100vw; margin-inline: 50%; transform: translateX(-50%); }
.kg-width-full img, .kg-width-wide img { width: 100%; }
.kg-card { margin-block: var(--space-5); }
.kg-btn, .kg-btn-accent { background: var(--accent) !important; color: var(--on-accent) !important; border-radius: var(--radius-md) !important; font-weight: var(--weight-semibold); text-decoration: none; }
.kg-callout-card { background: var(--surface-2); border-radius: var(--radius-md); }
.kg-toggle-card { background: var(--bg) !important; border: 1px solid var(--border) !important; box-shadow: none !important; border-radius: var(--radius-md) !important; }
.kg-toggle-heading-text { color: var(--text); font-size: var(--text-base); }
.kg-toggle-content { color: var(--text-muted); }

/* Ghost's built-in upgrade prompt for gated posts */
.gh-post-upgrade-cta { margin-top: var(--space-6); }
.gh-post-upgrade-cta-content { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: var(--radius-lg) !important; padding: var(--space-6) var(--space-5) !important; box-shadow: var(--shadow-sm); }
.gh-post-upgrade-cta h2 { color: var(--text) !important; font-size: var(--text-xl); }
.gh-post-upgrade-cta .gh-btn { background: var(--accent) !important; color: var(--on-accent) !important; border-radius: var(--radius-md) !important; min-height: 48px; padding: 0 var(--space-5) !important; display: inline-flex !important; align-items: center; font-weight: var(--weight-semibold); text-decoration: none; }
.gh-post-upgrade-cta small, .gh-post-upgrade-cta p { color: var(--text-muted) !important; }
.gh-post-upgrade-cta a:not(.gh-btn) { color: var(--accent-text) !important; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: var(--space-7) var(--space-5); margin-top: var(--space-8); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--space-6); }
.footer-nav .nav-list { flex-direction: column; gap: var(--space-2); }
.social-list { display: flex; flex-direction: row !important; flex-wrap: wrap; gap: var(--space-3) !important; list-style: none; margin: 0; padding: 0; }
.social-list a { color: var(--text); display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-full); background: var(--surface-2); }
.social-list a:hover { color: var(--accent-text); }
.footer-meta { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.footer-meta p { margin-bottom: var(--space-2); font-size: var(--text-sm); }
.closing { text-align: center; }

/* Responsive */
@media (min-width: 1024px) { h1 { font-size: var(--text-2xl); } .hero h1 { font-size: var(--text-3xl); } }
@media (max-width: 860px) {
  .icon-btn.menu-btn { display: inline-grid; }
  .header-panel { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--border); padding: var(--space-4); flex-direction: column; align-items: flex-start; }
  .header-panel.is-open { display: flex; }
  .nav-list { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero[data-image="Side"] .hero-inner { grid-template-columns: 1fr; }
  .grid-products[data-layout="List"] .product-card { flex-direction: column; }
  .grid-products[data-layout="List"] .product-card .card-media { width: 100%; }
  h1, .post-title { font-size: var(--text-xl); }
}
@media print { .site-header, .site-footer, .newsletter-form, .buy-bar { display: none; } }
