/* Kremesicle — warm, compact editorial blog. Light-first, no framework. */

:root {
    --bg: #faf8f4;
    --bg-elev: #f3efe8;
    --bg-card: #ffffff;
    --border: rgba(40, 34, 28, 0.12);
    --text: #2b2722;
    --text-muted: #756d62;
    --accent: #b4632f;        /* warm clay */
    --accent-hover: #944d20;
    --shadow: 0 1px 2px rgba(40, 34, 28, 0.05), 0 2px 8px rgba(40, 34, 28, 0.04);
    --radius: 10px;
    --nav-h: 56px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1a1816;
        --bg-elev: #211e1b;
        --bg-card: #232019;
        --border: rgba(255, 250, 240, 0.10);
        --text: #ece6dc;
        --text-muted: #a59c8e;
        --accent: #d98c5a;
        --accent-hover: #e7a878;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.25);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
        --bg: #1a1816;
        --bg-elev: #211e1b;
        --bg-card: #232019;
        --border: rgba(255, 250, 240, 0.10);
        --text: #ece6dc;
        --text-muted: #a59c8e;
        --accent: #d98c5a;
        --accent-hover: #e7a878;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.25);
        color-scheme: dark;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    line-height: 1;
    padding: 0.35rem 0.6rem;
}
.theme-toggle:hover { border-color: var(--accent); }

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

h1, h2, h3, h4 {
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 650;
    margin: 0 0 0.5em;
    text-wrap: balance;
    color: var(--text);
}

h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

code {
    font-family: "Cascadia Code", "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.88em;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.1em 0.35em;
}

.container {
    width: min(880px, 100% - 2.25rem);
    margin-inline: auto;
}

/* ---------- Header / nav ---------- */

#header-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--border);
}

#header .inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--nav-h);
}

#header h1 { margin: 0; }

#logo {
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--text);
}

#logo:hover { color: var(--accent); }

#nav ul {
    display: flex;
    gap: 0.15rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

#nav a {
    display: block;
    padding: 0.35rem 0.7rem;
    border-radius: 7px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.15s ease, background 0.15s ease;
}

#nav a:hover,
#nav a[aria-current="page"] {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

#nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.3rem 0.55rem;
    font-size: 1rem;
    cursor: pointer;
}

@media (max-width: 640px) {
    #nav-toggle { display: block; }

    #nav {
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: var(--bg-elev);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        display: none;
        padding: 0.6rem 1.125rem 0.85rem;
    }

    #nav.open { display: block; }

    #nav ul { flex-direction: column; }
    #nav a { padding: 0.6rem 0.7rem; border-radius: 8px; }
}

/* ---------- Main ---------- */

#main-wrapper { flex: 1; padding: clamp(1.5rem, 3vw, 2.5rem) 0; }

header.major {
    margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
}

header.major p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: -0.25rem;
}

/* Grid system as CSS grid */
.row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: clamp(0.85rem, 1.75vw, 1.35rem);
}

.row + .row, .row + article, article + article { margin-top: clamp(0.85rem, 1.75vw, 1.35rem); }

.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

@media (max-width: 760px) {
    .col-4.col-12-medium, .col-8.col-12-medium, .col-6.col-12-medium { grid-column: span 12; }
    .col-3.col-6-medium { grid-column: span 6; }
}

@media (max-width: 560px) {
    .col-3.col-12-small, .col-3.col-6-medium { grid-column: span 12; }
}

/* ---------- Cards ---------- */

.box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1rem, 2vw, 1.35rem);
    box-shadow: var(--shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease;
}

.box > p { color: var(--text-muted); font-size: 0.95rem; }
.box > footer, .box > p:has(+ footer) { margin-top: auto; }

section.box:hover, .col-4 .box:hover {
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

.box header h3 { margin-bottom: 0.15rem; }
.box header h3 a { color: var(--text); }
.box header h3 a:hover { color: var(--accent); }

.box header p {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.6rem;
}

/* Images */
.image { display: block; overflow: hidden; border-radius: calc(var(--radius) - 4px); }
.image img { width: 100%; height: auto; transition: transform 0.35s ease; }
a.image:hover img { transform: scale(1.03); }
.image.featured { margin-bottom: 1rem; }
.image.featured img { aspect-ratio: 16 / 9; object-fit: cover; }
.image.fit { height: 100%; }
.image.fit img { height: 100%; object-fit: cover; }

@media (max-width: 760px) {
    .image.fit { height: auto; }
    .image.fit img { aspect-ratio: 16 / 9; height: auto; }
}

/* ---------- Buttons ---------- */

ul.actions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.button {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-weight: 550;
    font-size: 0.9rem;
    background: var(--accent);
    color: #fff;
    transition: background 0.15s ease;
}

.button:hover {
    color: #fff;
    background: var(--accent-hover);
}

.button.alt {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.button.alt:hover {
    background: var(--bg-elev);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    color: var(--accent);
}

/* ---------- Footer ---------- */

#footer-wrapper {
    border-top: 1px solid var(--border);
    background: var(--bg-elev);
    padding: clamp(1.5rem, 3vw, 2.25rem) 0 1.25rem;
    margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

#footer h2 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

#footer p { color: var(--text-muted); font-size: 0.9rem; }

#footer section footer { margin-top: 0.85rem; }

ul.divided {
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.divided li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

ul.divided li:last-child { border-bottom: none; }

dl.contact { margin: 0; }
dl.contact dt { font-weight: 600; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
dl.contact dd { margin: 0.1rem 0 0.6rem; font-size: 0.9rem; }

#copyright {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* When copyright is the only footer content, drop the redundant divider. */
#footer > #copyright:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

#copyright ul.menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
    #main > .row, #main > article {
        animation: rise 0.4s ease both;
    }

    @keyframes rise {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: none; }
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    html { scroll-behavior: auto; }
}

/* ======================= v2 redesign ======================= */

.container { width: min(1080px, 100% - 2.25rem); }
#logo .dot { color: var(--accent); }
#header .inner { position: relative; }
#nav a[aria-current="page"] { color: var(--accent); }

.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.lead { font-size: 1.1rem; color: var(--text-muted); }

/* Hero */
.hero {
    padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3rem);
    margin-bottom: clamp(2rem, 4vw, 3rem);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 1.6);
    background:
        radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
        var(--bg-card);
}
.hero h2 {
    font-size: clamp(1.9rem, 5vw, 3.1rem);
    max-width: 18ch;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.hero .lead { max-width: 52ch; margin: 0.75rem 0 1.5rem; }

.button { padding: 0.6rem 1.25rem; }
.button.wide { display: block; text-align: center; width: 100%; padding: 0.75rem 1rem; }
.button.disabled { background: var(--bg-elev); color: var(--text-muted); border: 1px solid var(--border); cursor: not-allowed; }

/* Section headings + card grids */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: clamp(1.75rem, 4vw, 2.5rem) 0 1rem;
}
.section-head h2 { margin: 0; }
.section-head a { font-size: 0.9rem; font-weight: 550; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(0.85rem, 1.75vw, 1.35rem);
}
.cards.three { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.cards .box:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); transform: translateY(-2px); }
.box { transition: border-color 0.2s ease, transform 0.2s ease; }
.box header p { margin-bottom: 0.4rem; }

/* Detail pages */
.crumbs { margin-bottom: 1rem; font-size: 0.9rem; }
.image.featured img { aspect-ratio: 16 / 9; }

.post-page { max-width: 720px; margin-inline: auto; }
.post-page h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -0.02em; }
.prose p { font-size: 1.05rem; line-height: 1.75; margin-bottom: 1.2em; }

.product {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: clamp(1.25rem, 3vw, 2.25rem);
    align-items: start;
}
.product h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.buy { position: sticky; top: calc(var(--nav-h) + 1rem); height: auto; gap: 1rem; }
.price { font-size: 2rem; font-weight: 750; letter-spacing: -0.02em; }
.checks { list-style: none; margin: 0; padding: 0; font-size: 0.92rem; color: var(--text-muted); }
.checks li { padding: 0.35rem 0 0.35rem 1.4rem; position: relative; border-top: 1px solid var(--border); }
.checks li::before { content: "\2713"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; align-items: start; }

/* Footer */
.footer-grid { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.footer-grid p { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.footer-links { list-style: none; display: flex; gap: 1.25rem; margin: 0; padding: 0; font-size: 0.9rem; }
#footer > #copyright:first-child { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
#copyright { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

@media (max-width: 760px) {
    .product, .about-grid { grid-template-columns: 1fr; }
    .buy { position: static; }
}

/* Buy form */
.buy-form { display: grid; gap: 0.75rem; }
.buy-form label { display: grid; gap: 0.25rem; font-size: 0.8rem; color: var(--text-muted); }
.buy-form input { padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.buy-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.buy-form .fine { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin: 0; }
.form-error { color: #d9534f; font-size: 0.85rem; margin: 0; }

/* Screenshot gallery */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.shots img { width: 100%; border: 1px solid var(--border); border-radius: 8px; transition: transform .2s ease; }
.shots a:hover img { transform: scale(1.02); }

/* Screenshot gallery (v2) */
.shots { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); align-items: start; }
.shots figure { margin: 0; }
.shots .shot { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.shots .shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top left; border: 1px solid var(--border); border-radius: 8px; }
.shots figcaption { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; }
#lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; color: #fff; text-align: center; }
#lightbox::backdrop { background: rgba(0,0,0,.82); }
#lightbox img { max-width: 94vw; max-height: 82vh; border-radius: 8px; background: #fff; }
#lightbox p { margin: .6rem 0 0; }
.lb-close { position: absolute; top: .25rem; right: .5rem; font-size: 2rem; line-height: 1; background: none; border: 0; color: #fff; cursor: pointer; }

/* Feature lists */
.feature-list { list-style: none; margin: 0.25rem 0 1.5rem; padding: 0; }
.feature-list li { padding: 0.5rem 0; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.95rem; }
.feature-list li:first-child { border-top: 0; }
.feature-list li strong { color: var(--text); margin-right: 0.35rem; }
.product-main h3 { margin-top: 1.75rem; }

.price .per { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }

.note { color: var(--text-muted); font-size: 0.95rem; margin: 0.25rem 0; }

.byline { margin-top: -0.5rem; opacity: 0.75; }
