/* ============================================================
   Cute Flexi Maker — Parts Guide
   Stylesheet (organized in clearly labelled sections)
   ============================================================ */


/* ----------------------------------------------------------
   1. Design tokens
   ---------------------------------------------------------- */
:root {
    /* Colors */
    --color-bg: #f5ecdc;
    --color-surface: #ffffff;
    --color-surface-alt: #ede2cc;
    --color-text: #2a2118;
    --color-text-muted: #6a5a48;
    --color-accent: #d97e3a;
    --color-accent-dark: #b15a1f;
    --color-shadow: rgba(70, 45, 20, 0.12);

    /* Typography */
    --font-display: "Bowlby One", "Bungee", system-ui, -apple-system, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    /* Spacing */
    --space-1: 0.5rem;
    --space-2: 1rem;
    --space-3: 1.5rem;
    --space-4: 2rem;
    --space-5: 3rem;
    --space-6: 4rem;

    /* Layout */
    --content-max: 960px;
    --content-wide-max: 1100px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --header-height: 68px;
}

@font-face {
    font-family: "Bowlby One";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local("Bowlby One"),
         url("https://fonts.gstatic.com/s/bowlbyone/v23/taiPGmVuC4y96PFeqp8sqomI_OE.woff2") format("woff2");
}

@font-face {
    font-family: "Borsok";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../borsok-font/boorsok.ttf") format("truetype"),
         url("../borsok-font/boorsok.otf") format("opentype");
}


/* ----------------------------------------------------------
   2. Reset & base
   ---------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
    font-family: var(--font-display);
    line-height: 1.1;
    letter-spacing: 0.5px;
    margin: 0;
}

a {
    color: var(--color-accent-dark);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--color-text);
    color: #fff;
    padding: var(--space-2);
    z-index: 1000;
}

.skip-link:focus {
    left: var(--space-2);
    top: var(--space-2);
}

/* Empty anchor used to offset scrollIntoView for sub-sections that share a page */
.anchor-offset {
    display: block;
    height: 0;
    width: 0;
    position: relative;
    top: calc(var(--header-height) * -1);
    visibility: hidden;
}


/* ----------------------------------------------------------
   3. Buttons
   ---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.65em 1.2em;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn--primary {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 4px 14px var(--color-shadow);
}

.btn--primary:hover,
.btn--primary:focus-visible {
    background: var(--color-accent-dark);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn--ghost {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-text);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
    background: var(--color-text);
    color: #fff;
    text-decoration: none;
}

.btn--large {
    padding: 0.9em 1.6em;
    font-size: 1.1rem;
}


/* ----------------------------------------------------------
   4. Header
   ---------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(245, 236, 220, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(70, 45, 20, 0.1);
}

.site-header__inner {
    max-width: var(--content-wide-max);
    margin: 0 auto;
    padding: 0 var(--space-3);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.site-header__brand {
    display: flex;
    flex-direction: column;
    color: var(--color-text);
}

.site-header__brand:hover {
    text-decoration: none;
}

.site-header__title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}

.site-header__subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.site-header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.site-header__nav a {
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
}

.site-header__nav a.is-active {
    color: var(--color-accent-dark);
}

.site-header__nav a.btn {
    color: #fff;
}

.lang-picker-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.lang-picker-wrap__label {
    font-weight: 500;
}

.lang-picker {
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-surface);
    border: 1px solid rgba(70, 45, 20, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.35rem 1.6rem 0.35rem 0.65rem;
    font: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='%236a5a48' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 10px 7px;
}

.lang-picker:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}


/* ----------------------------------------------------------
   5. Hero
   ---------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    max-width: var(--content-wide-max);
    padding: var(--space-3) var(--space-3) 0;
}

.hero__image {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px var(--color-shadow);
    object-fit: cover;
}

.hero__overlay {
    margin: var(--space-3) auto 0;
    max-width: 720px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
    box-shadow: 0 10px 30px var(--color-shadow);
    position: relative;
    z-index: 2;
}

.hero__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.hero__title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    color: var(--color-accent-dark);
    margin: var(--space-1) 0 var(--space-2);
}

.hero__lead {
    font-family: "Borsok", var(--font-body);
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin: 0 auto var(--space-3);
    max-width: 540px;
}

.hero__actions {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    flex-wrap: wrap;
}


/* ----------------------------------------------------------
   6. Table of contents
   ---------------------------------------------------------- */
.toc {
    max-width: var(--content-max);
    margin: var(--space-6) auto var(--space-5);
    padding: 0 var(--space-3);
}

.toc__title {
    font-size: 2rem;
    color: var(--color-accent-dark);
    text-align: center;
    margin-bottom: var(--space-3);
}

.toc__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-1) var(--space-3);
    counter-reset: toc;
}

.toc__list a {
    counter-increment: toc;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-2);
    padding: 0.7em 1em;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: "Borsok", var(--font-body);
    font-weight: 500;
    background: transparent;
    transition: background 0.15s ease;
}

.toc__list a::before {
    content: counter(toc, decimal-leading-zero);
    color: var(--color-accent);
    font-family: var(--font-display);
    font-size: 0.85em;
    flex-shrink: 0;
    width: 2em;
}

.toc__list a:hover,
.toc__list a:focus-visible {
    background: var(--color-surface);
    text-decoration: none;
}

.toc__list a {
    align-items: center;
}

.toc__list a > span:first-of-type {
    flex-grow: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


/* ----------------------------------------------------------
   7. Guide sections
   ---------------------------------------------------------- */
.guide {
    max-width: var(--content-wide-max);
    margin: 0 auto;
    padding: 0 var(--space-3);
}

.section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-4);
    margin-bottom: var(--space-4);
    box-shadow: 0 4px 20px var(--color-shadow);
}

.section__header {
    text-align: center;
    margin-bottom: var(--space-4);
}

.section__title {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--color-accent-dark);
    margin-bottom: var(--space-1);
}

.section__subtitle {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: var(--color-accent-dark);
    margin: var(--space-5) 0 var(--space-2);
    font-family: var(--font-display);
}

.section__intro {
    font-family: "Borsok", var(--font-body);
    color: var(--color-text-muted);
    max-width: 60ch;
    margin: 0 auto;
    font-size: 1rem;
}

.section__notes {
    font-family: "Borsok", var(--font-body);
    max-width: 64ch;
    margin: 0 auto var(--space-3);
    padding-left: var(--space-3);
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.section__notes li + li {
    margin-top: 0.3em;
}


/* ----------------------------------------------------------
   7b. Parts grid (individual part cards)
   ---------------------------------------------------------- */
.parts-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-2);
}

.parts-grid figure {
    margin: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    transition: transform 0.2s ease;
}

.badge-new {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e63946;
    color: #fff;
    font-family: "Fredoka", var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transform: rotate(-15deg);
    clip-path: polygon(
        50% 0%, 58.3% 19.1%, 75% 6.7%, 72.6% 27.4%, 93.3% 25%, 80.9% 41.7%,
        100% 50%, 80.9% 58.3%, 93.3% 75%, 72.6% 72.6%, 75% 93.3%, 58.3% 80.9%,
        50% 100%, 41.7% 80.9%, 25% 93.3%, 27.4% 72.6%, 6.7% 75%, 19.1% 58.3%,
        0% 50%, 19.1% 41.7%, 6.7% 25%, 27.4% 27.4%, 25% 6.7%, 41.7% 19.1%
    );
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
    pointer-events: none;
    z-index: 2;
}

.parts-grid figure:hover {
    transform: translateY(-3px);
}

.parts-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: transparent;
}

.parts-grid figcaption {
    font-family: "Borsok", "Fredoka", var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    text-align: center;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    line-height: 1.1;
}


/* ----------------------------------------------------------
   7c. Symbols layout
   ---------------------------------------------------------- */
.symbols-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: var(--space-4);
    align-items: center;
    margin-top: var(--space-3);
}

.symbols-layout__preview {
    margin: 0;
}

.symbols-layout__preview img {
    width: 100%;
    height: auto;
}

.symbols-layout__keys {
    display: grid;
    gap: var(--space-3);
}

.symbols-key__title {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-accent-dark);
    margin: 0 0 var(--space-1);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.symbols-key__list {
    font-family: var(--font-display);
    margin: 0;
    color: var(--color-text);
    word-spacing: 0.6em;
    font-size: 1rem;
}


/* ----------------------------------------------------------
   8. Text-heavy section (Changing Colors / Disable Parts)
   ---------------------------------------------------------- */
.section--text .text-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: var(--space-4);
    align-items: start;
}

.steps {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.steps li {
    counter-increment: step;
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px dashed rgba(106, 90, 72, 0.2);
}

.steps li::before {
    content: counter(step);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--color-accent);
    color: #fff;
    font-family: var(--font-display);
    font-size: 0.95rem;
}

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

.steps__body {
    flex-grow: 1;
    color: var(--color-text);
}

.text-layout__figure {
    margin: 0;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--space-2);
}

.text-layout__figure img {
    border-radius: var(--radius-sm);
}

.disable-list {
    columns: 2;
    column-gap: var(--space-4);
    list-style: square;
    margin: var(--space-3) 0 0;
    padding-left: var(--space-3);
    color: var(--color-text);
}

.disable-list li {
    break-inside: avoid;
    margin-bottom: 0.4em;
}

.disable-list__parent {
    color: var(--color-text-muted);
    font-size: 0.85em;
}


/* ----------------------------------------------------------
   9. CTA & Footer
   ---------------------------------------------------------- */
.cta {
    text-align: center;
    padding: var(--space-6) var(--space-3);
    background: var(--color-surface-alt);
    margin-top: var(--space-5);
}

.cta__title {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--color-accent-dark);
    margin-bottom: var(--space-2);
}

.cta__lead {
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}

.site-footer {
    text-align: center;
    padding: var(--space-4) var(--space-3);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.site-footer p {
    margin: 0.3em 0;
}

.site-footer__small {
    font-size: 0.8rem;
    opacity: 0.8;
}


/* ----------------------------------------------------------
   10. Back-to-top button
   ---------------------------------------------------------- */
.back-to-top {
    position: fixed;
    right: var(--space-3);
    bottom: var(--space-3);
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: none;
    background: var(--color-accent);
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 6px 20px var(--color-shadow);
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 90;
}

.back-to-top:hover {
    background: var(--color-accent-dark);
    transform: translateY(-2px);
}


/* ----------------------------------------------------------
   11. Responsive
   ---------------------------------------------------------- */
@media (max-width: 800px) {
    .site-header__nav a:not(.btn) {
        display: none;
    }

    .lang-picker-wrap__label {
        display: none;
    }

    .site-header__inner {
        gap: var(--space-2);
        padding: 0 var(--space-2);
    }

    .site-header__brand {
        min-width: 0;
        flex: 1 1 auto;
    }

    .site-header__title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hero__overlay {
        margin-top: var(--space-2);
        padding: var(--space-3) var(--space-2);
    }

    .section {
        padding: var(--space-4) var(--space-2);
    }

    .section--text .text-layout,
    .symbols-layout {
        grid-template-columns: 1fr;
    }

    .disable-list {
        columns: 1;
    }
}

@media (max-width: 500px) {
    .site-header__brand .site-header__subtitle {
        display: none;
    }

    .site-header__title {
        font-size: 0.95rem;
    }

    .toc__list {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: var(--space-2);
    }
}


/* ----------------------------------------------------------
   12. Print
   ---------------------------------------------------------- */
@media print {
    .site-header,
    .back-to-top,
    .cta,
    .site-header__nav,
    .lang-picker-wrap,
    .toc {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .section {
        box-shadow: none;
        page-break-after: always;
    }
}
