/* ---------- Design tokens ---------- */
:root {
    --bg: #fdf9f2;
    --surface: #f6ecdd;
    --ink: #221a16;
    --muted: #6b5f52;
    --border: #e7d9c2;
    --accent: #7a1f2b;
    --accent-ink: #fdf6ee;
    --diff-minus-bg: #f3ddd7;
    --diff-minus-ink: #7a1f2b;
    --diff-plus-bg: #e6ecd9;
    --diff-plus-ink: #3f5a2a;
}

.dark {
    --bg: #17120f;
    --surface: #241c17;
    --ink: #f5ece1;
    --muted: #b3a290;
    --border: #392c24;
    --accent: #d98a94;
    --accent-ink: #1c1210;
    --diff-minus-bg: #3a1f1d;
    --diff-minus-ink: #eda6a2;
    --diff-plus-bg: #223020;
    --diff-plus-ink: #a9d78f;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.15s ease, color 0.15s ease;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, textarea, select { font: inherit; }

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    padding-bottom: 16px;
}

.logo {
    font-weight: 800;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

.main-nav {
    display: none;
    gap: 28px;
}

.main-nav a {
    font-size: 0.9375rem;
    font-weight: 500;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent);
    border-color: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.icon-btn svg { width: 16px; height: 16px; }

.icon-btn:hover { border-color: var(--accent); }

.btn-header { display: none; }

.mobile-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px 24px 20px;
    border-top: 1px solid var(--border);
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
    padding: 10px 4px;
    font-weight: 500;
    border-radius: 6px;
}

.mobile-menu a:hover { background-color: var(--surface); }

.mobile-menu .btn { margin-top: 8px; justify-content: center; }

@media (min-width: 860px) {
    .main-nav { display: flex; }
    .btn-header { display: inline-flex; }
    .mobile-only { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1;
    transition: opacity 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }

.btn-primary { background-color: var(--accent); color: var(--accent-ink); }
.btn-secondary { background-color: transparent; color: var(--ink); border: 1px solid var(--border); }

/* ---------- Typography helpers ---------- */
.eyebrow {
    display: inline-block;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; }

/* ---------- Consistent type scale (use these instead of inline styles) ---------- */
.page-title {
    margin-top: 12px;
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
}

.section-heading {
    font-size: 1.5rem;
    font-weight: 800;
}

.section-lead {
    margin-top: 10px;
    font-size: 1.125rem;
    color: var(--ink);
    line-height: 1.7;
}

.body-text {
    margin-top: 14px;
    font-size: 1rem;
    color: var(--muted);
    line-height: 1.8;
}

.bullet-list {
    margin-top: 20px;
    padding-left: 20px;
    list-style: disc;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.9;
}

.bullet-list li { margin-bottom: 8px; }

.link-accent { color: var(--accent); font-weight: 600; }

.avatar {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 999px;
    margin: 0 auto 24px;
    border: 3px solid var(--border);
    display: block;
}

.numbered-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
}

.numbered-row:last-child { border-bottom: none; }

.numbered-row .n {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.numbered-row h3 { font-size: 1.1875rem; font-weight: 800; }
.numbered-row p { margin-top: 6px; font-size: 0.9375rem; color: var(--muted); }
.numbered-row a { display: inline-block; margin-top: 10px; font-weight: 600; color: var(--accent); }

/* ---------- Sections & layout ---------- */
.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.section-bordered { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background-color: var(--surface); }

.hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    max-width: 720px;
    margin-top: 16px;
}

.hero p.lead {
    max-width: 560px;
    font-size: 1.125rem;
    color: var(--muted);
    margin-top: 20px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
}

.code-note {
    margin-top: 48px;
    max-width: 560px;
    border-left: 2px solid var(--accent);
    padding-left: 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--muted);
}

/* ---------- Diff block ---------- */
.diff {
    margin-top: 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
}

.diff-filename {
    padding: 8px 16px;
    font-size: 0.75rem;
    color: var(--muted);
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
}

.diff-line {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.diff-line:last-child { border-bottom: none; }
.diff-line .marker { user-select: none; opacity: 0.6; }

.diff-line.minus { background-color: var(--diff-minus-bg); color: var(--diff-minus-ink); }
.diff-line.plus { background-color: var(--diff-plus-bg); color: var(--diff-plus-ink); }

/* ---------- Cards & grids ---------- */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
}

.grid { display: grid; gap: 24px; }

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 860px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.price-card { display: flex; flex-direction: column; gap: 16px; }
.price-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price-card .price { margin-top: auto; font-size: 1.5rem; font-weight: 800; }

.case-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    background-color: var(--surface);
    transition: border-color 0.15s ease;
}

.case-card:hover { border-color: var(--accent); }

.case-compare {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

@media (min-width: 640px) {
    .case-compare { grid-template-columns: repeat(2, 1fr); }
    .case-compare.with-result { grid-template-columns: repeat(3, 1fr); }
}

.case-block {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    background-color: var(--bg);
}

.case-block.result {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    background-color: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.case-block .label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.case-block.result .label { color: var(--accent); }
.case-block p:not(.label) { margin-top: 8px; font-size: 0.9375rem; }

/* ---------- Steps ---------- */
.steps {
    display: grid;
    gap: 24px;
    margin-top: 32px;
}

@media (min-width: 640px) {
    .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
    .steps { grid-template-columns: repeat(5, 1fr); }
}

.step-number { color: var(--accent); font-weight: 800; font-size: 0.875rem; }
.steps h3 { font-size: 1rem; margin-top: 8px; }
.steps p { margin-top: 4px; font-size: 0.875rem; color: var(--muted); }

/* ---------- CTA banner ---------- */
.cta-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* ---------- Prose (blog articles) ---------- */
.prose { max-width: 680px; }
.prose p { margin-bottom: 20px; line-height: 1.75; }
.prose h2 { font-size: 1.375rem; font-weight: 700; margin-top: 40px; margin-bottom: 12px; }
.prose ul { list-style: disc; padding-left: 24px; margin-bottom: 20px; }
.prose li { margin-bottom: 8px; }

/* ---------- Blog list ---------- */
.post-list-item {
    display: block;
    padding: 28px 0;
    border-bottom: 1px solid var(--border);
}

.post-list-item:first-child { padding-top: 0; }
.post-list-item h2 { font-size: 1.375rem; margin-top: 8px; }
.post-list-item:hover h2 { color: var(--accent); }
.post-list-item .date {
    display: block;
    margin-top: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 8px; }

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--ink);
}

.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); }

.form-note { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

.form-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
}

.form-status.success { background-color: var(--diff-plus-bg); color: var(--diff-plus-ink); }
.form-status.error { background-color: var(--diff-minus-bg); color: var(--diff-minus-ink); }

/* ---------- Newsletter box ---------- */
.newsletter-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
    background-color: var(--surface);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.newsletter-form input {
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--ink);
}

.newsletter-form input:focus { outline: none; border-color: var(--accent); }

@media (min-width: 560px) {
    .newsletter-form { flex-direction: row; }
    .newsletter-form input { flex: 1; }
}

/* ---------- Lead magnets ---------- */
.resource-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
    background-color: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resource-card .resource-format {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 96px; }
.footer-inner { display: grid; gap: 40px; padding: 48px 24px; }

@media (min-width: 760px) {
    .footer-inner { grid-template-columns: 2fr 1fr 1fr; }
}

.footer-brand p.muted { max-width: 320px; margin-top: 12px; font-size: 0.9375rem; }
.footer-heading { font-size: 0.875rem; font-weight: 700; margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 8px; font-size: 0.9375rem; color: var(--muted); }
.footer-col ul li a:hover { color: var(--accent); }

.footer-bottom {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
}

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
