/* =========================================================
   toolbox: "craft paper" theme
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@500;700;800&display=swap');

:root {
    --bg: #f5efe3;
    --surface: #fffaf0;
    --text: #1c1a17;
    --muted: #6b6558;
    --soft: #d8ceb6; /* light dividers, dots */
    --line: #1c1a17; /* component borders */
    --hard: #1c1a17; /* hard offset shadows */
    --accent: #e4572e;
    --accent-text: #b8391a; /* accent for small text (better contrast) */
    --on-accent: #1c1a17;
    --teal: #3a9d8f;
    --ok: #1f7a45;
    --err: #c0392b;
    --radius: 10px;
    --header-h: 64px;
    --font-head: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Consolas, monospace;
}

[data-theme="dark"] {
    --bg: #15130e;
    --surface: #1e1b15;
    --text: #f1ead9;
    --muted: #a39b88;
    --soft: #2e2a20;
    --line: #4d4637;
    --hard: #000;
    --accent: #f07048;
    --accent-text: #ff8d68;
    --teal: #55c1b1;
    --ok: #5fd08a;
    --err: #ff7a6b;
}

/* ---------- Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background .3s, color .3s;
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    line-height: 1.15;
    letter-spacing: -.02em;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

[hidden] {
    display: none !important;
}

.container {
    width: min(1180px, 100% - 2rem);
    margin-inline: auto;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.accent {
    color: var(--accent);
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: .78rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent-text);
    font-weight: 600;
    margin-bottom: .9rem;
}

.dot-c {
    display: inline-block;
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    margin-right: .45rem;
    background: var(--c, var(--accent));
    border: 1px solid var(--line);
    flex: none;
}

/* ---------- Header ---------- */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1.5px solid var(--line);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    gap: 1rem;
}

.logo {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.55rem;
    letter-spacing: -.04em;
    line-height: 1;
}

    .logo b {
        color: var(--accent);
    }

.main-nav ul {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    list-style: none;
}

.main-nav a, .nav-btn {
    font-weight: 600;
    font-size: .95rem;
    color: var(--text);
    transition: color .15s;
}

    .main-nav a:hover, .nav-btn:hover, .has-menu.open .nav-btn {
        color: var(--accent-text);
    }

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.caret {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s;
}

.has-menu.open .caret {
    transform: rotate(180deg);
}

.actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.icon-btn {
    min-width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    display: grid;
    place-items: center;
    transition: background .15s;
}

    .icon-btn:hover {
        background: color-mix(in srgb, var(--accent) 18%, var(--surface));
    }

    .icon-btn svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.menu-btn {
    display: none;
    padding: 0 .9rem;
    font-weight: 700;
    font-size: .9rem;
}

/* Mega menu */
.mega {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1.5px solid var(--line);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

.has-menu.open .mega {
    display: block;
}

.mega-grid {
    display: grid;
    gap: 1.6rem 2rem;
    padding: 1.8rem 0;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.main-nav .mega ul {
    display: grid;
    gap: .1rem;
    padding: 0;
}

.main-nav .mega a {
    display: block;
    padding: .28rem 0;
    font-size: .93rem;
    color: var(--muted);
    font-weight: 500;
}

    .main-nav .mega a:hover {
        color: var(--accent-text);
    }

.main-nav .mega .mega-title {
    display: flex;
    align-items: center;
    margin-bottom: .35rem;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

    .main-nav .mega .mega-title:hover {
        color: var(--accent-text);
    }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1.5px solid var(--line);
    padding: clamp(2.5rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem);
    background-image: radial-gradient(var(--soft) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
}

    .hero .container {
        position: relative;
    }

    .hero h1 {
        font-size: clamp(2.5rem, 7vw, 5rem);
        line-height: 1;
        letter-spacing: -.04em;
        font-weight: 800;
        max-width: 13ch;
    }

.scribble {
    position: relative;
    white-space: nowrap;
}

    .scribble svg {
        position: absolute;
        left: -2%;
        bottom: -.14em;
        width: 104%;
        height: .3em;
        overflow: visible;
        fill: none;
        stroke: var(--accent);
        stroke-width: 4;
        stroke-linecap: round;
    }

    .scribble path {
        vector-effect: non-scaling-stroke;
    }

.hero-sub {
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
    max-width: 520px;
    margin: 1.3rem 0 1.8rem;
}

.search {
    display: flex;
    align-items: center;
    gap: .7rem;
    max-width: 560px;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: .3rem .6rem .3rem 1rem;
    box-shadow: 4px 4px 0 var(--hard);
    transition: box-shadow .15s, transform .15s;
}

    .search:focus-within {
        transform: translate(-2px, -2px);
        box-shadow: 6px 6px 0 var(--accent);
    }

    .search svg {
        width: 20px;
        height: 20px;
        flex: none;
        fill: none;
        stroke: var(--muted);
        stroke-width: 2;
        stroke-linecap: round;
    }

    .search input {
        flex: 1;
        min-width: 0;
        border: 0;
        outline: 0;
        background: none;
        color: var(--text);
        font: inherit;
        font-size: 1.05rem;
        padding: .75rem 0;
    }

        .search input::placeholder {
            color: var(--muted);
        }

.kbd {
    font-family: var(--font-mono);
    border: 1.5px solid var(--soft);
    border-bottom-width: 3px;
    border-radius: 6px;
    padding: .05rem .5rem;
    font-size: .8rem;
    color: var(--muted);
}

.quick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem 1.1rem;
    margin-top: 1.6rem;
    font-size: .92rem;
    color: var(--muted);
}

    .quick a {
        color: var(--text);
        font-weight: 600;
        text-decoration: underline;
        text-decoration-color: var(--accent);
        text-decoration-thickness: 2px;
        text-underline-offset: 3px;
    }

        .quick a:hover {
            color: var(--accent-text);
        }

.hero-meta {
    margin-top: 1.4rem;
    color: var(--muted);
    font-size: .9rem;
    font-family: var(--font-mono);
}

    .hero-meta b {
        color: var(--text);
    }

.sticker {
    position: absolute;
    right: 2%;
    top: 50%;
    margin-top: -70px;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    transform: rotate(10deg);
    background: var(--accent);
    color: var(--on-accent);
    border: 1.5px solid var(--hard);
    box-shadow: 4px 4px 0 var(--hard);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.4rem;
    line-height: 1.05;
}

/* ---------- Sections ---------- */
section {
    padding: clamp(2.5rem, 6vw, 4rem) 0;
}

.section-head {
    margin-bottom: 1.8rem;
}

    .section-head h2 {
        font-size: clamp(1.7rem, 3.6vw, 2.4rem);
    }

    .section-head p {
        color: var(--muted);
        margin-top: .3rem;
    }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 3rem 0;
    display: none;
}

/* ---------- Cards ---------- */
.grid {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.2rem 1.3rem;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

a.card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 5px 5px 0 var(--hard);
}

[data-theme="dark"] a.card:hover {
    border-color: var(--accent);
    box-shadow: 5px 5px 0 var(--accent);
}

.card .tag {
    display: flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
}

.card h3 {
    font-size: 1.2rem;
}

.card p {
    color: var(--muted);
    font-size: .92rem;
    flex: 1;
}

.card .go {
    font-weight: 700;
    font-size: .88rem;
    color: var(--accent-text);
}

.cat-card {
    background: color-mix(in srgb, var(--c, var(--accent)) 26%, var(--surface));
    min-height: 220px;
    gap: .6rem;
    padding: 1.3rem;
}

.cat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .8rem;
}

.cat-num {
    font-family: var(--font-mono);
    font-size: .85rem;
    font-weight: 700;
}

.cat-ico {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1.5px solid var(--line);
}

    .cat-ico svg {
        width: 24px;
        height: 24px;
        fill: none;
        stroke: var(--text);
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.cat-card h3 {
    font-size: 1.5rem;
}

.cat-card p {
    color: var(--text);
    opacity: .78;
}

.cat-card .count {
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.chip {
    display: inline-block;
    white-space: nowrap;
    padding: .45rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-weight: 600;
    font-size: .92rem;
    transition: background .15s;
}

    .chip:hover {
        background: color-mix(in srgb, var(--accent) 18%, var(--surface));
    }

    .chip.active {
        background: var(--accent);
        color: var(--on-accent);
        border-color: var(--hard);
    }

/* ---------- Ground rules + CTA ---------- */
.rules {
    display: grid;
    gap: 1.8rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.rule {
    border-top: 1.5px solid var(--line);
    padding-top: 1rem;
}

    .rule .n {
        font-family: var(--font-mono);
        color: var(--accent-text);
        font-weight: 700;
        font-size: .85rem;
    }

    .rule h3 {
        font-size: 1.3rem;
        margin: .3rem 0 .4rem;
    }

    .rule p {
        color: var(--muted);
        font-size: .95rem;
    }

.cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem 2rem;
    padding: clamp(1.5rem, 5vw, 3rem);
    background: var(--accent);
    color: var(--on-accent);
    border: 1.5px solid var(--hard);
    border-radius: var(--radius);
    box-shadow: 6px 6px 0 var(--hard);
}

    .cta h2 {
        font-size: clamp(1.5rem, 3.4vw, 2.2rem);
        max-width: 18ch;
    }

    .cta p {
        margin-top: .4rem;
        max-width: 44ch;
    }

.btn {
    display: inline-block;
    padding: .8rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    background: #1c1a17;
    color: #f5efe3;
    border: 1.5px solid #1c1a17;
    transition: transform .15s;
}

    .btn:hover {
        transform: translate(-2px, -2px);
    }

/* ---------- Footer ---------- */
footer {
    margin-top: 3rem;
    border-top: 1.5px solid var(--line);
    padding: 2.5rem 0 1.5rem;
    background: var(--surface);
    color: var(--muted);
}

.footer-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1.6fr 1fr 1fr;
}

footer .logo {
    color: var(--text);
}

footer h4 {
    font-family: var(--font-mono);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    margin-bottom: .8rem;
}

footer ul {
    list-style: none;
    display: grid;
    gap: .45rem;
}

    footer ul a {
        color: var(--text);
    }

footer a:hover {
    color: var(--accent-text);
}

.copyright {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--soft);
    font-size: .85rem;
    font-family: var(--font-mono);
}

/* ---------- Tool pages ---------- */
.tool-page {
    padding: 2rem 0 1rem;
}

.back {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

    .back:hover {
        color: var(--accent-text);
    }

.tool-page h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: -.03em;
}

.tool-page h2 {
    font-size: 1.3rem;
    margin: 1.5rem 0 .6rem;
}

.lead {
    color: var(--muted);
    margin: .6rem 0 1.6rem;
    max-width: 680px;
    font-size: 1.05rem;
}

.note {
    color: var(--muted);
    font-size: .85rem;
    margin-top: 1.2rem;
}

#related {
    padding: 2.5rem 0 0;
}

    #related h2 {
        font-size: 1.6rem;
        margin: 0 0 1rem;
    }

.tool-card {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(1.1rem, 3vw, 2rem);
    box-shadow: 6px 6px 0 var(--hard);
}

    .tool-card :where(input:not([type=checkbox]):not([type=range]):not([type=color]), select, textarea) {
        width: 100%;
        padding: .7rem .9rem;
        border: 1.5px solid var(--line);
        border-radius: 8px;
        background: var(--bg);
        color: var(--text);
        font: inherit;
    }

    .tool-card :where(input, select, textarea):focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
    }

/* ===== Playful sky theme ===== */
:root {
    --bg: #e6f6fb;
    --surface: #ffffff;
    --accent: #ff7a3d;
    --accent-text: #c2410c;
    --sun: #ffd23f;
    --teal: #2a9d8f;
}

[data-theme="dark"] {
    --bg: #0e2230;
    --surface: #16323f;
    --accent: #ff8a55;
}

body {
    background: linear-gradient(180deg,#bfe9fa 0,var(--bg) 460px) no-repeat, var(--bg);
}

[data-theme="dark"] body {
    background: linear-gradient(180deg,#123247 0,var(--bg) 460px) no-repeat, var(--bg);
}

.hero-art {
    display: block;
    width: min(560px,100%);
    height: auto;
    margin: 24px auto 0;
}

.logo-mark {
    width: 34px;
    height: 34px;
    vertical-align: -9px;
    margin-right: 6px;
}

/* wavy divider: <div class="wave"></div> between sections */
.wave {
    height: 44px;
    background: var(--surface);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24' preserveAspectRatio='none'%3E%3Cpath d='M0 24V12Q15 0 30 12T60 12T90 12T120 12V24Z'/%3E%3C/svg%3E") center/120px 100% repeat-x;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24' preserveAspectRatio='none'%3E%3Cpath d='M0 24V12Q15 0 30 12T60 12T90 12T120 12V24Z'/%3E%3C/svg%3E") center/120px 100% repeat-x;
}
/* ===== SKY THEME (global) ===== */
:root {
    --bg: #e9f7fc;
    --surface: #ffffff;
    --surface-2: #f1fbfe;
    --text: #17324d;
    --muted: #5b7088;
    --border: #cfe6f1;
    --line: #cfe6f1;
    --ink: #17324d;
    --blue: #1f5fae;
    --green: #1fa38a;
    --sun: #ffc933;
    --sun-deep: #e8a200;
    --accent: #1f5fae;
    --accent-text: #1f5fae;
    --teal: #1fa38a;
    --radius: 20px;
    --shadow: 0 6px 18px rgba(31,95,174,.12);
    --font-head: 'Fredoka',system-ui,sans-serif;
    --font-body: 'Nunito',system-ui,sans-serif;
}

[data-theme="dark"] {
    --bg: #0d2236;
    --surface: #14324a;
    --surface-2: #10293e;
    --text: #e8f4fb;
    --muted: #9db8cc;
    --border: #24506e;
    --line: #24506e;
    --ink: #e8f4fb;
    --blue: #8cc4ff;
    --green: #4cd0b4;
    --accent: #5aa9ff;
    --accent-text: #8cc4ff;
    --shadow: 0 6px 18px rgba(0,0,0,.35);
}

html {
    scroll-behavior: smooth
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: linear-gradient(180deg,#bfe9fa 0,var(--bg) 520px) no-repeat,var(--bg);
}

[data-theme="dark"] body {
    background: linear-gradient(180deg,#0a3350 0,var(--bg) 520px) no-repeat,var(--bg)
}

h1, h2, h3, h4 {
    font-family: var(--font-head);
    letter-spacing: 0;
    color: var(--blue)
}

button {
    font-family: var(--font-head)
}

/* soft cards & inputs (tool pages) */
[class*="card"], [class*="panel"] {
    border: 2px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
}

input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
select, textarea {
    border: 2px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

    input:focus, select:focus, textarea:focus {
        outline: 3px solid color-mix(in srgb,var(--sun) 70%,transparent);
        border-color: var(--sun-deep);
    }

/* header */
body > header, .site-header {
    background: color-mix(in srgb,var(--surface) 90%,transparent);
    backdrop-filter: blur(8px);
    border-bottom: 0 !important;
    box-shadow: 0 4px 16px rgba(31,95,174,.10);
}

.logo-mark {
    width: 34px;
    height: 34px;
    vertical-align: -9px;
    margin-right: 6px
}

/* green wavy footer */
footer, .site-footer {
    --text: #fff;
    --muted: #d9fff6;
    --border: rgba(255,255,255,.3);
    position: relative;
    margin-top: 90px;
    border-top: 0 !important;
    background: linear-gradient(180deg,#22b39a,#168f7b);
    color: #eafffa;
}

    footer a {
        color: #fff
    }

    footer h1, footer h2, footer h3, footer h4 {
        color: #fff
    }

    footer::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -39px;
        height: 40px;
        background: #22b39a;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24' preserveAspectRatio='none'%3E%3Cpath d='M0 24V12Q15 0 30 12T60 12T90 12T120 12V24Z'/%3E%3C/svg%3E") center/120px 100% repeat-x;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24' preserveAspectRatio='none'%3E%3Cpath d='M0 24V12Q15 0 30 12T60 12T90 12T120 12V24Z'/%3E%3C/svg%3E") center/120px 100% repeat-x;
    }
    /* ===== Footer: Tools list in 2 columns ===== */
    footer :is(ul,div,nav):has(> a[href*="category/"]),
    footer ul:has(> li > a[href*="category/"]) {
        column-count: 2;
        column-gap: 28px;
    }

        footer :is(ul,div,nav):has(> a[href*="category/"]) > :is(h2,h3,h4,h5,h6) {
            column-span: all
        }

        footer :is(ul,div,nav):has(> a[href*="category/"]) > a {
            display: block;
            break-inside: avoid
        }

        footer ul:has(> li > a[href*="category/"]) > li {
            break-inside: avoid
        }

/* Give the Tools column more room on wide screens */
@media (min-width:900px) {
    footer *:has(> *:has(a[href*="category/"])) {
        grid-template-columns: 1.2fr 1.9fr .8fr .8fr !important;
    }
}

/* Phones: keep 2 columns, tighter gap */
@media (max-width:600px) {
    footer :is(ul,div,nav):has(> a[href*="category/"]),
    footer ul:has(> li > a[href*="category/"]) {
        column-gap: 16px
    }
}