/* ==========================================================================
   Motivation Matrix — visual system
   1. Theme tokens        5. Card rail
   2. Base + scrollbars   6. Footer
   3. Header + toolbar    7. Modals / shop / checkout
   4. Quote viewer        8. Responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. THEME TOKENS
   -------------------------------------------------------------------------- */

:root,
[data-theme="parchment"] {
    color-scheme: light;

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --display-weight: 400;
    --display-tracking: -0.035em;

    --radius-sm: 0.22rem;
    --radius-md: 0.32rem;
    --radius-lg: 0.5rem;

    --bg-base: #f2e8d8;
    --bg-layers:
        radial-gradient(circle at 12% 8%, rgba(255, 251, 241, 0.92), transparent 32rem),
        radial-gradient(circle at 88% 64%, rgba(185, 138, 82, 0.12), transparent 34rem),
        linear-gradient(142deg, rgba(255, 255, 255, 0.18), transparent 48%);
    --texture:
        repeating-linear-gradient(117deg, rgba(74, 51, 38, 0.025) 0, rgba(74, 51, 38, 0.025) 1px, transparent 1px, transparent 5px),
        repeating-linear-gradient(21deg, rgba(255, 255, 255, 0.14) 0, rgba(255, 255, 255, 0.14) 1px, transparent 1px, transparent 8px);
    --texture-opacity: 0.42;

    --ink: #2d241d;
    --ink-soft: #6c5b4c;
    --ink-faint: #8a7663;
    --ink-strong: #342219;

    --surface: #fffaf0;
    --surface-raised: #f8efdf;
    --surface-sunken: rgba(74, 51, 38, 0.05);
    --line: rgba(74, 51, 38, 0.28);
    --line-soft: rgba(74, 51, 38, 0.14);

    --accent: #a64f34;
    --accent-soft: rgba(166, 79, 52, 0.12);
    --accent-2: #a37a45;
    --on-accent: #fdf6ea;

    --btn-bg: #4a3326;
    --btn-bg-hover: #342219;
    --btn-ink: #fbf6ec;
    --btn-border: #342219;
    --btn-arrow: #e1ad80;

    --chip-bg: rgba(255, 250, 240, 0.72);
    --chip-ink: #4a3326;
    --chip-line: rgba(74, 51, 38, 0.2);
    --chip-bg-hover: #fffaf0;

    --frame-bg: #eadbc6;
    --frame-inner: #fffaf0;
    --frame-line: rgba(74, 51, 38, 0.28);
    --frame-pad: clamp(0.45rem, 1.2vw, 0.72rem);
    --frame-texture:
        repeating-linear-gradient(105deg, rgba(74, 51, 38, 0.025) 0, rgba(74, 51, 38, 0.025) 1px, transparent 1px, transparent 6px);
    --frame-sheen: linear-gradient(rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.1));
    --shadow-card:
        0 1.5rem 3.8rem rgba(68, 43, 29, 0.17),
        0 0.25rem 0.8rem rgba(68, 43, 29, 0.09),
        inset 0 0 0 1px rgba(255, 255, 255, 0.62);
    --shadow-soft: 0 0.28rem 0.65rem rgba(52, 34, 25, 0.12);
    --shadow-modal: 0 2rem 5rem rgba(45, 30, 20, 0.32);

    --disabled-bg: #d5c5b1;
    --disabled-ink: #5b4d3f;
    --lock-bg: rgba(166, 79, 52, 0.14);
    --lock-ink: #8f3f27;
    --header-bg: rgba(248, 239, 223, 0.86);
    --footer-bg: rgba(237, 224, 204, 0.54);
    --scrim: rgba(45, 32, 22, 0.55);
}

[data-theme="midnight"] {
    color-scheme: dark;

    --font-display: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --display-weight: 600;
    --display-tracking: -0.05em;

    --radius-sm: 0.6rem;
    --radius-md: 0.85rem;
    --radius-lg: 1.25rem;

    --bg-base: #0b0e16;
    --bg-layers:
        radial-gradient(circle at 18% 4%, rgba(124, 140, 255, 0.24), transparent 28rem),
        radial-gradient(circle at 84% 78%, rgba(46, 214, 214, 0.14), transparent 30rem),
        linear-gradient(168deg, rgba(30, 36, 58, 0.9), transparent 60%);
    --texture: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0.5px, transparent 0.6px);
    --texture-opacity: 0.5;

    --ink: #e8ecf7;
    --ink-soft: #9aa4c0;
    --ink-faint: #7d87a5;
    --ink-strong: #ffffff;

    --surface: #141a29;
    --surface-raised: #1b2233;
    --surface-sunken: rgba(255, 255, 255, 0.04);
    --line: rgba(148, 163, 216, 0.24);
    --line-soft: rgba(148, 163, 216, 0.14);

    --accent: #8b9bff;
    --accent-soft: rgba(139, 155, 255, 0.16);
    --accent-2: #3fd7cd;
    --on-accent: #0b0e16;

    --btn-bg: linear-gradient(135deg, #7c8cff, #5f6ff0);
    --btn-bg-hover: linear-gradient(135deg, #93a1ff, #7183ff);
    --btn-ink: #0b0e16;
    --btn-border: transparent;
    --btn-arrow: #0b0e16;

    --chip-bg: rgba(255, 255, 255, 0.05);
    --chip-ink: #cfd6ea;
    --chip-line: rgba(148, 163, 216, 0.22);
    --chip-bg-hover: rgba(139, 155, 255, 0.16);

    --frame-bg: #161d2c;
    --frame-inner: #0b0e16;
    --frame-line: rgba(148, 163, 216, 0.26);
    --frame-pad: clamp(0.5rem, 1.4vw, 0.85rem);
    --frame-texture: none;
    --frame-sheen: linear-gradient(150deg, rgba(139, 155, 255, 0.18), transparent 55%);
    --shadow-card:
        0 2rem 5rem rgba(4, 6, 14, 0.75),
        0 0 0 1px rgba(148, 163, 216, 0.12),
        0 0 3.5rem rgba(124, 140, 255, 0.16);
    --shadow-soft: 0 0.5rem 1.4rem rgba(4, 6, 14, 0.6);
    --shadow-modal: 0 2.5rem 6rem rgba(0, 0, 0, 0.7);

    --disabled-bg: rgba(255, 255, 255, 0.06);
    --disabled-ink: #6d7691;
    --lock-bg: rgba(139, 155, 255, 0.16);
    --lock-ink: #a9b5ff;
    --header-bg: rgba(15, 20, 33, 0.82);
    --footer-bg: rgba(15, 20, 33, 0.7);
    --scrim: rgba(4, 6, 14, 0.72);
}

[data-theme="sagepress"] {
    color-scheme: light;

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --display-weight: 400;
    --display-tracking: -0.02em;

    --radius-sm: 0.35rem;
    --radius-md: 0.55rem;
    --radius-lg: 0.9rem;

    --bg-base: #eaeee3;
    --bg-layers:
        radial-gradient(circle at 78% 6%, rgba(255, 255, 255, 0.9), transparent 30rem),
        radial-gradient(circle at 8% 82%, rgba(93, 125, 99, 0.14), transparent 32rem),
        linear-gradient(200deg, rgba(255, 255, 255, 0.5), transparent 55%);
    --texture:
        repeating-linear-gradient(90deg, rgba(37, 53, 42, 0.035) 0, rgba(37, 53, 42, 0.035) 1px, transparent 1px, transparent 22px);
    --texture-opacity: 0.5;

    --ink: #22301f;
    --ink-soft: #5c6b56;
    --ink-faint: #7b8875;
    --ink-strong: #16210f;

    --surface: #fbfcf8;
    --surface-raised: #f2f5ec;
    --surface-sunken: rgba(37, 53, 42, 0.05);
    --line: rgba(37, 53, 42, 0.22);
    --line-soft: rgba(37, 53, 42, 0.12);

    --accent: #b4674b;
    --accent-soft: rgba(180, 103, 75, 0.13);
    --accent-2: #5d7d63;
    --on-accent: #fdfbf7;

    --btn-bg: #34452f;
    --btn-bg-hover: #22301f;
    --btn-ink: #f4f7ee;
    --btn-border: #22301f;
    --btn-arrow: #c8d9b9;

    --chip-bg: rgba(255, 255, 255, 0.7);
    --chip-ink: #34452f;
    --chip-line: rgba(37, 53, 42, 0.18);
    --chip-bg-hover: #ffffff;

    --frame-bg: #ffffff;
    --frame-inner: #fbfcf8;
    --frame-line: rgba(37, 53, 42, 0.16);
    --frame-pad: clamp(0.75rem, 2vw, 1.35rem);
    --frame-texture: none;
    --frame-sheen: none;
    --shadow-card:
        0 1.2rem 3rem rgba(34, 48, 31, 0.13),
        0 0.15rem 0.5rem rgba(34, 48, 31, 0.07);
    --shadow-soft: 0 0.3rem 0.8rem rgba(34, 48, 31, 0.1);
    --shadow-modal: 0 2rem 5rem rgba(34, 48, 31, 0.25);

    --disabled-bg: #dfe4d7;
    --disabled-ink: #6f7d68;
    --lock-bg: rgba(180, 103, 75, 0.14);
    --lock-ink: #955034;
    --header-bg: rgba(247, 249, 243, 0.88);
    --footer-bg: rgba(228, 234, 220, 0.6);
    --scrim: rgba(30, 42, 27, 0.5);
}

[data-theme="goldenhour"] {
    color-scheme: dark;

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --display-weight: 400;
    --display-tracking: -0.03em;

    --radius-sm: 999px;
    --radius-md: 1.1rem;
    --radius-lg: 1.6rem;

    --bg-base: #2a161a;
    --bg-layers:
        radial-gradient(circle at 50% -6%, rgba(255, 175, 92, 0.4), transparent 30rem),
        radial-gradient(circle at 12% 96%, rgba(199, 74, 62, 0.32), transparent 34rem),
        linear-gradient(178deg, rgba(88, 38, 32, 0.75), transparent 65%);
    --texture: radial-gradient(circle at 50% 50%, rgba(255, 208, 138, 0.06) 1px, transparent 1.2px);
    --texture-opacity: 0.55;

    --ink: #ffeede;
    --ink-soft: #d5ab94;
    --ink-faint: #bd917a;
    --ink-strong: #fff8ef;

    --surface: #3a1f21;
    --surface-raised: #472626;
    --surface-sunken: rgba(255, 208, 138, 0.07);
    --line: rgba(255, 197, 138, 0.26);
    --line-soft: rgba(255, 197, 138, 0.14);

    --accent: #ffa94d;
    --accent-soft: rgba(255, 169, 77, 0.18);
    --accent-2: #ffd08a;
    --on-accent: #2a161a;

    --btn-bg: linear-gradient(135deg, #ffb35c, #f2762f);
    --btn-bg-hover: linear-gradient(135deg, #ffc478, #ff8c45);
    --btn-ink: #35171a;
    --btn-border: transparent;
    --btn-arrow: #35171a;

    --chip-bg: rgba(255, 208, 138, 0.1);
    --chip-ink: #ffe3c4;
    --chip-line: rgba(255, 197, 138, 0.24);
    --chip-bg-hover: rgba(255, 169, 77, 0.22);

    --frame-bg: #43231f;
    --frame-inner: #2a161a;
    --frame-line: rgba(255, 197, 138, 0.28);
    --frame-pad: clamp(0.55rem, 1.5vw, 0.95rem);
    --frame-texture: none;
    --frame-sheen: linear-gradient(160deg, rgba(255, 208, 138, 0.22), transparent 60%);
    --shadow-card:
        0 2rem 4.5rem rgba(24, 8, 10, 0.7),
        0 0 4rem rgba(255, 150, 70, 0.2);
    --shadow-soft: 0 0.5rem 1.2rem rgba(24, 8, 10, 0.5);
    --shadow-modal: 0 2.5rem 6rem rgba(16, 5, 7, 0.72);

    --disabled-bg: rgba(255, 208, 138, 0.09);
    --disabled-ink: #ab8874;
    --lock-bg: rgba(255, 169, 77, 0.18);
    --lock-ink: #ffc078;
    --header-bg: rgba(48, 25, 28, 0.82);
    --footer-bg: rgba(48, 25, 28, 0.68);
    --scrim: rgba(20, 7, 9, 0.68);
}

[data-theme="blueprint"] {
    color-scheme: dark;

    --font-display: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
    --font-body: "Instrument Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --display-weight: 600;
    --display-tracking: -0.03em;

    --radius-sm: 0px;
    --radius-md: 0px;
    --radius-lg: 0px;

    --bg-base: #0d1620;
    --bg-layers:
        radial-gradient(circle at 82% 10%, rgba(79, 209, 197, 0.14), transparent 30rem),
        linear-gradient(190deg, rgba(21, 38, 54, 0.85), transparent 62%);
    --texture:
        repeating-linear-gradient(0deg, rgba(147, 197, 224, 0.09) 0, rgba(147, 197, 224, 0.09) 1px, transparent 1px, transparent 28px),
        repeating-linear-gradient(90deg, rgba(147, 197, 224, 0.09) 0, rgba(147, 197, 224, 0.09) 1px, transparent 1px, transparent 28px);
    --texture-opacity: 0.7;

    --ink: #d3e6f4;
    --ink-soft: #8fa9bd;
    --ink-faint: #7893a8;
    --ink-strong: #f2fbff;

    --surface: #132231;
    --surface-raised: #18293b;
    --surface-sunken: rgba(147, 197, 224, 0.06);
    --line: rgba(147, 197, 224, 0.3);
    --line-soft: rgba(147, 197, 224, 0.16);

    --accent: #4fd1c5;
    --accent-soft: rgba(79, 209, 197, 0.14);
    --accent-2: #ffb347;
    --on-accent: #07131c;

    --btn-bg: #16303f;
    --btn-bg-hover: #1d4152;
    --btn-ink: #cfeef0;
    --btn-border: #4fd1c5;
    --btn-arrow: #4fd1c5;

    --chip-bg: rgba(147, 197, 224, 0.06);
    --chip-ink: #bcd6e8;
    --chip-line: rgba(147, 197, 224, 0.28);
    --chip-bg-hover: rgba(79, 209, 197, 0.16);

    --frame-bg: #0f1d29;
    --frame-inner: #07131c;
    --frame-line: rgba(79, 209, 197, 0.4);
    --frame-pad: clamp(0.4rem, 1.1vw, 0.7rem);
    --frame-texture: none;
    --frame-sheen: none;
    --shadow-card:
        0 1.5rem 3.5rem rgba(2, 8, 14, 0.7),
        0 0 0 1px rgba(79, 209, 197, 0.22);
    --shadow-soft: 0 0.3rem 0.9rem rgba(2, 8, 14, 0.55);
    --shadow-modal: 0 2rem 5rem rgba(2, 8, 14, 0.75);

    --disabled-bg: rgba(147, 197, 224, 0.07);
    --disabled-ink: #6c8398;
    --lock-bg: rgba(255, 179, 71, 0.16);
    --lock-ink: #ffc46b;
    --header-bg: rgba(13, 22, 32, 0.86);
    --footer-bg: rgba(13, 22, 32, 0.72);
    --scrim: rgba(3, 9, 15, 0.72);
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--bg-base);
    scrollbar-color: var(--line) transparent;
    scrollbar-width: thin;
}

body {
    position: relative;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    color: var(--ink);
    font-family: var(--font-body);
    background: var(--bg-layers), var(--bg-base);
    transition: background-color 320ms ease, color 320ms ease;
}

body.is-scroll-locked {
    overflow: hidden;
}

body::before {
    position: fixed;
    z-index: 0;
    inset: 0;
    content: "";
    pointer-events: none;
    opacity: var(--texture-opacity);
    background: var(--texture);
}

body > header,
body > main,
body > footer {
    position: relative;
    z-index: 1;
}

body > main {
    width: 100%;
    flex: 1 0 auto;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--accent);
    text-underline-offset: 0.2em;
}

[hidden] {
    display: none !important;
}

::selection {
    color: var(--on-accent);
    background: var(--accent);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--surface-sunken);
}

::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--line);
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    background-clip: content-box;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* --------------------------------------------------------------------------
   3. HEADER + TOOLBAR
   -------------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--line-soft);
    background: var(--header-bg);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.site-header__inner {
    width: min(100%, 72rem);
    margin: 0 auto;
    padding: 0.6rem clamp(0.85rem, 4vw, 3.5rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
}

.brand__mark {
    width: 2.15rem;
    height: 2.15rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-sm);
    color: var(--btn-ink);
    font-family: var(--font-display);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--btn-bg);
    box-shadow: var(--shadow-soft);
}

.brand__text {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    line-height: 1.1;
}

.brand__name {
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
}

.brand__tag {
    color: var(--ink-faint);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.tool {
    position: relative;
    min-width: 2.45rem;
    height: 2.45rem;
    padding: 0 0.68rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--chip-line);
    border-radius: var(--radius-sm);
    color: var(--chip-ink);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1;
    background: var(--chip-bg);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.tool:hover {
    border-color: var(--accent);
    color: var(--ink-strong);
    background: var(--chip-bg-hover);
    transform: translateY(-1px);
}

.tool:active {
    transform: translateY(0);
}

.tool:focus-visible,
.brand:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.tool svg {
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
}

.tool--primary {
    border-color: var(--btn-border);
    color: var(--btn-ink);
    background: var(--btn-bg);
}

.tool--primary:hover {
    color: var(--btn-ink);
    background: var(--btn-bg-hover);
}

.tool--primary svg {
    color: var(--btn-ink);
}

.tool__label {
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Lock / premium badging on live controls
   -------------------------------------------------------------------------- */

.is-locked {
    opacity: 0.66;
}

.is-locked:hover {
    opacity: 1;
}

.lock-badge {
    position: absolute;
    top: -0.4rem;
    right: -0.35rem;
    width: 1.05rem;
    height: 1.05rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--lock-ink);
    background: var(--lock-bg);
    box-shadow: 0 0 0 1px var(--lock-ink), 0 2px 5px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lock-badge svg {
    width: 0.62rem;
    height: 0.62rem;
    display: block;
}

.pill-badge {
    padding: 0.1rem 0.36rem;
    border-radius: 999px;
    color: var(--lock-ink);
    font-family: var(--font-body);
    font-size: 0.53rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.5;
    text-transform: uppercase;
    background: var(--lock-bg);
    box-shadow: inset 0 0 0 1px var(--lock-ink);
}

.pill-badge--free {
    color: var(--accent-2);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--accent-2);
}

.pill-badge--active {
    color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* --------------------------------------------------------------------------
   Theme menu
   -------------------------------------------------------------------------- */

.tool-wrap {
    position: relative;
}

.theme-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.5rem);
    right: 0;
    width: min(21rem, calc(100vw - 1.7rem));
    padding: 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-modal);
    animation: menu-in 160ms ease;
}

.theme-menu__title {
    padding: 0.35rem 0.5rem 0.5rem;
    color: var(--ink-faint);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.theme-option {
    position: relative;
    width: 100%;
    padding: 0.5rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: inherit;
    text-align: left;
    background: transparent;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.theme-option + .theme-option {
    margin-top: 0.15rem;
}

.theme-option:hover {
    border-color: var(--line-soft);
    background: var(--surface-sunken);
}

.theme-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.theme-option[aria-checked="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.theme-swatch {
    width: 2.7rem;
    height: 1.95rem;
    flex: 0 0 auto;
    overflow: hidden;
    display: flex;
    border: 1px solid var(--line-soft);
    border-radius: calc(var(--radius-sm) * 0.6);
}

.theme-swatch span {
    flex: 1;
}

.theme-swatch span:first-child {
    flex: 1.9;
}

.theme-option__text {
    min-width: 0;
    flex: 1;
}

.theme-option__name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--ink-strong);
    font-size: 0.85rem;
    font-weight: 600;
}

.theme-option__desc {
    margin-top: 0.12rem;
    color: var(--ink-faint);
    font-size: 0.72rem;
    line-height: 1.35;
}

.theme-option__check {
    flex: 0 0 auto;
    color: var(--accent);
    opacity: 0;
}

.theme-option[aria-checked="true"] .theme-option__check {
    opacity: 1;
}

.theme-option__check svg,
.theme-option__lock svg {
    width: 1rem;
    height: 1rem;
    display: block;
}

.theme-option__lock {
    flex: 0 0 auto;
    color: var(--lock-ink);
    opacity: 0.85;
}

@keyframes menu-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   4. QUOTE VIEWER
   -------------------------------------------------------------------------- */

.quote-viewer {
    width: min(100%, 72rem);
    margin: 0 auto;
    padding: clamp(1.4rem, 3.4vw, 2.9rem) clamp(1rem, 5vw, 3.5rem) clamp(1.75rem, 3.5vw, 2.75rem);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quote-viewer__intro {
    position: relative;
    width: min(100%, 42rem);
    margin: 0 0 clamp(1.2rem, 2.6vw, 1.9rem);
    padding-left: clamp(1rem, 3vw, 1.65rem);
    text-align: left;
}

.quote-viewer__intro::before {
    position: absolute;
    top: 0.15rem;
    bottom: 0.05rem;
    left: 0;
    width: 2px;
    content: "";
    background: linear-gradient(to bottom, var(--accent) 0 62%, var(--accent-soft) 62% 100%);
}

.quote-viewer__eyebrow {
    margin: 0 0 0.6rem;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    line-height: 1.3;
    text-transform: uppercase;
}

.quote-viewer h1 {
    margin: 0;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: clamp(1.95rem, 4.4vw, 3.15rem);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.03;
}

.quote-viewer__lede {
    max-width: 35rem;
    margin: 0.7rem 0 0;
    color: var(--ink-soft);
    font-size: clamp(0.92rem, 1.6vw, 1.02rem);
    line-height: 1.55;
}

.quote-stage {
    /* Cards are not all square: the deck runs from tall portraits to squares.
       --card-ratio is written by the viewer once a card reports its real size,
       and the frame is bounded on BOTH axes so a tall card cannot run away. */
    --card-ratio: 1;
    --card-max-w: min(100%, clamp(16rem, 52vmin, 32rem));
    --card-max-h: min(58svh, 30rem);
    --card-inset: calc(2 * var(--frame-pad) + 2px);

    width: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    touch-action: pan-y;
}

.quote-frame {
    position: relative;
    width: min(
        var(--card-max-w),
        calc((var(--card-max-h) - var(--card-inset)) * var(--card-ratio) + var(--card-inset))
    );
    margin: 0;
    padding: var(--frame-pad);
    border: 1px solid var(--frame-line);
    border-radius: var(--radius-md);
    background: var(--frame-sheen), var(--frame-texture), var(--frame-bg);
    box-shadow: var(--shadow-card);
    transition:
        width 340ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 320ms ease,
        border-radius 320ms ease,
        box-shadow 320ms ease;
}

.quote-frame::after {
    position: absolute;
    z-index: -1;
    right: 8%;
    bottom: -0.7rem;
    left: 8%;
    height: 1.2rem;
    content: "";
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.18);
    filter: blur(0.8rem);
}

.quote-media {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: var(--card-ratio, 1);
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid var(--frame-line);
    border-radius: calc(var(--radius-md) * 0.7);
    background: var(--frame-inner);
    transition: aspect-ratio 340ms cubic-bezier(0.22, 1, 0.36, 1);
}

.quote-image {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    user-select: none;
    background: var(--frame-inner);
    transition: opacity 180ms ease, transform 240ms ease;
}

.quote-loading,
.quote-error {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--ink-soft);
    text-align: center;
    background: var(--frame-inner);
}

.quote-loading {
    opacity: 0;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.quote-loading__mark {
    width: 2.8rem;
    height: 2px;
    overflow: hidden;
    background: var(--line-soft);
}

.quote-loading__mark::after {
    width: 50%;
    height: 100%;
    display: block;
    content: "";
    background: var(--accent);
    animation: loading-thread 1.1s ease-in-out infinite alternate;
}

.quote-error {
    z-index: 3;
    color: var(--ink);
}

.quote-error strong {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 4vw, 1.85rem);
    font-weight: var(--display-weight);
}

.quote-error span:last-child {
    max-width: 19rem;
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.55;
}

.quote-error__mark {
    color: var(--accent);
    font-size: 2rem;
    line-height: 1;
}

.is-enhanced .quote-stage[data-state="loading"] .quote-image {
    opacity: 0;
    transform: scale(0.992);
}

.is-enhanced .quote-stage[data-state="loading"] .quote-loading {
    z-index: 3;
    opacity: 1;
}

.is-enhanced .quote-stage[data-state="error"] .quote-image {
    opacity: 0;
}

.quote-empty {
    width: min(100%, 34rem);
    min-height: clamp(17rem, 46vmin, 25rem);
    padding: clamp(2rem, 7vw, 4rem);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    border: 1px solid var(--frame-line);
    border-radius: var(--radius-md);
    color: var(--ink);
    background: var(--frame-sheen), var(--frame-bg);
    box-shadow: var(--shadow-soft);
}

.quote-empty__mark {
    width: 3.25rem;
    height: 3px;
    margin-bottom: 1.6rem;
    background: var(--accent);
}

.quote-empty h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 5vw, 2.5rem);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.08;
}

.quote-empty p {
    max-width: 28rem;
    margin: 0.9rem 0 0;
    color: var(--ink-soft);
    line-height: 1.65;
}

.quote-empty code {
    padding: 0.08em 0.28em;
    border: 1px solid var(--line-soft);
    border-radius: 3px;
    color: var(--ink-strong);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.9em;
    background: var(--surface-sunken);
}

/* --------------------------------------------------------------------------
   5. CARD RAIL + NAVIGATION
   -------------------------------------------------------------------------- */

.card-rail {
    width: min(100%, 38rem);
    margin-top: clamp(0.9rem, 2vw, 1.35rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.rail-btn {
    position: relative;
    min-height: 2.4rem;
    padding: 0 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--chip-line);
    border-radius: var(--radius-sm);
    color: var(--chip-ink);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    line-height: 1;
    text-transform: uppercase;
    background: var(--chip-bg);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.rail-btn:hover {
    border-color: var(--accent);
    color: var(--ink-strong);
    background: var(--chip-bg-hover);
    transform: translateY(-1px);
}

.rail-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.rail-btn svg {
    width: 0.95rem;
    height: 0.95rem;
    flex: 0 0 auto;
}

.rail-btn[aria-pressed="true"] {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.rail-btn[aria-pressed="true"] .rail-btn__heart {
    fill: currentColor;
}

.quote-controls {
    width: min(100%, 38rem);
    margin-top: clamp(0.9rem, 2vw, 1.25rem);
    display: grid;
    grid-template-columns: minmax(7.5rem, 1fr) minmax(6rem, auto) minmax(7.5rem, 1fr);
    align-items: center;
    gap: clamp(0.55rem, 2vw, 1.1rem);
}

.quote-control {
    min-height: 3rem;
    padding: 0.65rem clamp(0.8rem, 3vw, 1.15rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-sm);
    color: var(--btn-ink);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1;
    text-transform: uppercase;
    background: var(--btn-bg);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.quote-control--previous {
    justify-self: start;
}

.quote-control--next {
    justify-self: end;
}

.quote-control__arrow {
    color: var(--btn-arrow);
    font-size: 1rem;
    line-height: 1;
    transition: transform 160ms ease;
}

.quote-control:hover:not(:disabled) {
    background: var(--btn-bg-hover);
    transform: translateY(-1px);
}

.quote-control--previous:hover:not(:disabled) .quote-control__arrow {
    transform: translateX(-2px);
}

.quote-control--next:hover:not(:disabled) .quote-control__arrow {
    transform: translateX(2px);
}

.quote-control:active:not(:disabled) {
    box-shadow: none;
    transform: translateY(1px);
}

.quote-control:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.quote-control:disabled {
    border-color: transparent;
    color: var(--disabled-ink);
    background: var(--disabled-bg);
    box-shadow: none;
    cursor: not-allowed;
}

.quote-control:disabled .quote-control__arrow {
    color: var(--disabled-ink);
}

.quote-position {
    position: relative;
    min-width: 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
}

.quote-counter {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5em;
    color: var(--ink-strong);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: 0.15em;
    line-height: 1;
}

.quote-counter__label {
    white-space: nowrap;
    color: var(--ink-faint);
    font-size: 0.86em;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.quote-progress {
    width: 4.5rem;
    height: 2px;
    overflow: hidden;
    display: block;
    background: var(--line-soft);
}

.quote-progress__fill {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--accent);
    transform: scaleX(var(--quote-progress, 0));
    transform-origin: left center;
    transition: transform 260ms ease;
}

.quote-noscript {
    margin: 0.85rem 0 0;
    color: var(--ink-soft);
    font-size: 0.82rem;
    text-align: center;
}

@keyframes loading-thread {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(200%);
    }
}

/* --------------------------------------------------------------------------
   6. FOOTER
   -------------------------------------------------------------------------- */

.site-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--line-soft);
    background: var(--footer-bg);
}

.site-footer__inner {
    width: min(100%, 72rem);
    margin: 0 auto;
    padding: 1.4rem clamp(1rem, 5vw, 3.5rem) 1.6rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem 1.5rem;
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1.15rem;
}

.site-footer__links a {
    padding: 0.2rem 0;
    border-bottom: 1px solid transparent;
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color 150ms ease, border-color 150ms ease;
}

.site-footer__links a:hover {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.site-footer__links a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.site-footer__meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.55rem;
    color: var(--ink-faint);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.site-footer__meta a {
    color: var(--ink-soft);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--line-soft);
    transition: color 150ms ease, border-color 150ms ease;
}

.site-footer__meta a:hover {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.site-footer__dot {
    opacity: 0.5;
}

.site-footer__version {
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    color: var(--ink-faint);
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.06em;
    background: var(--surface-sunken);
    box-shadow: inset 0 0 0 1px var(--line-soft);
}

/* --------------------------------------------------------------------------
   7. MODALS
   -------------------------------------------------------------------------- */

.modal-scrim {
    position: fixed;
    z-index: 90;
    inset: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(0.75rem, 3vw, 2rem);
    background: var(--scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: scrim-in 180ms ease;
}

.modal {
    position: relative;
    width: min(100%, 44rem);
    max-height: min(88svh, 54rem);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-modal);
    animation: modal-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal--narrow {
    width: min(100%, 28rem);
}

.modal--wide {
    width: min(100%, 52rem);
}

.modal__close {
    position: absolute;
    z-index: 3;
    top: 0.55rem;
    right: 0.65rem;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: var(--ink-faint);
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    background: transparent;
    box-shadow: none;
    opacity: 0.65;
    cursor: pointer;
    transition: color 150ms ease, opacity 150ms ease;
}

.modal__close:hover {
    color: var(--accent);
    opacity: 1;
}

.modal__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    opacity: 1;
}

.modal__head {
    flex: 0 0 auto;
    padding: clamp(1.3rem, 3vw, 1.75rem) clamp(1.2rem, 3.5vw, 2rem) 0.9rem;
    padding-right: 3.2rem;
    border-bottom: 1px solid var(--line-soft);
}

.modal__eyebrow {
    margin: 0 0 0.4rem;
    color: var(--accent);
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.modal__title {
    margin: 0;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3.2vw, 1.85rem);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.14;
}

.modal__sub {
    max-width: 38rem;
    margin: 0.5rem 0 0;
    color: var(--ink-soft);
    font-size: 0.88rem;
    line-height: 1.6;
}

.modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(1.05rem, 3vw, 1.5rem) clamp(1.2rem, 3.5vw, 2rem);
    scrollbar-color: var(--line) transparent;
    scrollbar-width: thin;
}

.modal__foot {
    flex: 0 0 auto;
    padding: 0.9rem clamp(1.2rem, 3.5vw, 2rem) clamp(1.1rem, 3vw, 1.4rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    border-top: 1px solid var(--line-soft);
}

.modal__foot-note {
    flex: 1 1 12rem;
    min-width: 0;
    margin: 0;
    color: var(--ink-faint);
    font-size: 0.74rem;
    line-height: 1.5;
}

.modal__foot-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

@keyframes scrim-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Buttons inside modals ---------------------------------------------------- */

.btn {
    min-height: 2.75rem;
    padding: 0 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-sm);
    color: var(--btn-ink);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    background: var(--btn-bg);
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.btn:hover:not(:disabled) {
    background: var(--btn-bg-hover);
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.btn:disabled {
    border-color: transparent;
    color: var(--disabled-ink);
    background: var(--disabled-bg);
    cursor: not-allowed;
    transform: none;
}

.btn--ghost {
    border-color: var(--chip-line);
    color: var(--chip-ink);
    background: transparent;
}

.btn--ghost:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn--block {
    width: 100%;
}

.btn--sm {
    min-height: 2.3rem;
    padding: 0 0.85rem;
    font-size: 0.7rem;
}

.link-btn {
    padding: 0;
    border: 0;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    background: none;
    text-decoration: underline;
    text-underline-offset: 0.22em;
    cursor: pointer;
}

.link-btn:hover {
    color: var(--ink-strong);
}

/* --------------------------------------------------------------------------
   Shop
   -------------------------------------------------------------------------- */

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.shop-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.05rem 1.05rem 1.1rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.shop-card:hover {
    border-color: var(--line);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.shop-card.is-owned {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.shop-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}

.shop-card__icon {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    color: var(--accent);
    background: var(--surface);
}

.shop-card__icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.shop-card__price {
    padding: 0.24rem 0.55rem;
    border-radius: 999px;
    color: var(--ink-strong);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line-soft);
}

.shop-card__price--free {
    color: var(--accent-2);
    box-shadow: inset 0 0 0 1px var(--accent-2);
}

.shop-card__title {
    margin: 0.7rem 0 0;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: 1.06rem;
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.2;
}

.shop-card__desc {
    margin: 0.35rem 0 0;
    color: var(--ink-soft);
    font-size: 0.8rem;
    line-height: 1.5;
}

.shop-card__list {
    margin: 0.6rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    list-style: none;
}

.shop-card__list li {
    position: relative;
    padding-left: 0.95rem;
    color: var(--ink-soft);
    font-size: 0.755rem;
    line-height: 1.45;
}

.shop-card__list li::before {
    position: absolute;
    top: 0.5em;
    left: 0;
    width: 0.32rem;
    height: 0.32rem;
    content: "";
    border-radius: 50%;
    background: var(--accent);
}

.shop-card__preview {
    margin: 0.7rem 0 0;
    display: flex;
    gap: 0.3rem;
}

.shop-card__preview .theme-swatch {
    width: auto;
    height: 1.5rem;
    flex: 1 1 0;
    min-width: 0;
}

.shop-card__cta {
    margin-top: auto;
    padding-top: 0.9rem;
}

.shop-card__cta .btn {
    width: 100%;
}

/* Discount ---------------------------------------------------------------- */

.promo {
    margin-top: 1.1rem;
    padding: 0.95rem 1.05rem 1.05rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.promo__title {
    margin: 0;
    color: var(--ink-strong);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.promo__hint {
    margin: 0.25rem 0 0.7rem;
    color: var(--ink-faint);
    font-size: 0.76rem;
    line-height: 1.5;
}

.promo__form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.promo__input {
    flex: 1 1 11rem;
    min-width: 0;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-strong);
    font-size: 0.88rem;
    letter-spacing: 0.14em;
    background: var(--surface);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.promo__input::placeholder {
    color: var(--ink-faint);
    letter-spacing: 0.08em;
    opacity: 0.75;
}

.promo__input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.promo__feedback {
    margin: 0.6rem 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
}

.promo__feedback[data-tone="ok"] {
    color: var(--accent-2);
    font-weight: 600;
}

.promo__feedback[data-tone="error"] {
    color: var(--accent);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Single-item checkout
   -------------------------------------------------------------------------- */

.checkout {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.checkout__icon {
    width: 3.6rem;
    height: 3.6rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    color: var(--accent);
    background: var(--surface-raised);
}

.checkout__icon svg {
    width: 1.7rem;
    height: 1.7rem;
}

.checkout__price {
    margin-top: 0.9rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    color: var(--on-accent);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--accent);
}

.checkout__title {
    margin: 0.75rem 0 0;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 3vw, 1.6rem);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.18;
}

.checkout__desc {
    max-width: 26rem;
    margin: 0.55rem 0 0;
    color: var(--ink-soft);
    font-size: 0.88rem;
    line-height: 1.62;
}

.checkout__list {
    width: min(100%, 26rem);
    margin: 1rem 0 0;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    list-style: none;
    text-align: left;
    background: var(--surface-raised);
}

.checkout__list li {
    position: relative;
    padding-left: 1.2rem;
    color: var(--ink-soft);
    font-size: 0.79rem;
    line-height: 1.5;
}

.checkout__list li::before {
    position: absolute;
    top: 0;
    left: 0;
    content: "\2713";
    color: var(--accent);
    font-weight: 700;
}

.checkout__note {
    margin: 0.9rem 0 0;
    color: var(--ink-faint);
    font-size: 0.75rem;
    line-height: 1.5;
}

.checkout__status {
    margin: 0.75rem 0 0;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--ink-strong);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.5;
    background: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Info modal
   -------------------------------------------------------------------------- */

.info-block + .info-block {
    margin-top: 1.15rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--line-soft);
}

.info-block h3 {
    margin: 0 0 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
}

.info-block p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.85rem;
    line-height: 1.62;
}

.info-block ul {
    margin: 0.5rem 0 0;
    padding-left: 1.05rem;
    color: var(--ink-soft);
    font-size: 0.83rem;
    line-height: 1.6;
}

.info-block li + li {
    margin-top: 0.2rem;
}

/* --------------------------------------------------------------------------
   Collection modal
   -------------------------------------------------------------------------- */

.jump-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
    padding-bottom: 1.05rem;
    margin-bottom: 1.05rem;
    border-bottom: 1px solid var(--line-soft);
}

.jump-form__field {
    flex: 1 1 9rem;
    min-width: 0;
}

.jump-form label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--ink-faint);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.jump-form input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-strong);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    background: var(--surface);
}

.jump-form input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.collection-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.collection-head h3 {
    margin: 0;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
}

.collection-head span {
    color: var(--ink-faint);
    font-size: 0.75rem;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.55rem;
}

.collection-item {
    position: relative;
    padding: 0;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    cursor: pointer;
    transition: border-color 150ms ease, transform 150ms ease;
}

.collection-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.collection-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.collection-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: var(--surface-sunken);
}

.collection-item__no {
    position: absolute;
    right: 0.25rem;
    bottom: 0.25rem;
    padding: 0.08rem 0.34rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.6rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.6);
}

.collection-empty {
    padding: 1.6rem 1rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    color: var(--ink-faint);
    font-size: 0.84rem;
    line-height: 1.6;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Export modal
   -------------------------------------------------------------------------- */

.export-layout {
    display: grid;
    grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
    gap: 1.15rem;
    align-items: start;
}

.export-preview {
    aspect-ratio: var(--card-ratio, 1);
    padding: 0.6rem;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.export-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    color: inherit;
    text-align: left;
    background: var(--surface-raised);
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.export-option:hover {
    border-color: var(--line);
}

.export-option[aria-checked="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.export-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.export-option__dot {
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 50%;
}

.export-option[aria-checked="true"] .export-option__dot {
    border-color: var(--accent);
    background: radial-gradient(circle, var(--accent) 0 45%, transparent 46%);
}

.export-option__text {
    min-width: 0;
    flex: 1;
}

.export-option__name {
    display: block;
    color: var(--ink-strong);
    font-size: 0.84rem;
    font-weight: 600;
}

.export-option__desc {
    display: block;
    margin-top: 0.1rem;
    color: var(--ink-faint);
    font-size: 0.73rem;
    line-height: 1.4;
}

.export-status {
    margin: 0.85rem 0 0;
    color: var(--ink-faint);
    font-size: 0.76rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Legal / contact content
   -------------------------------------------------------------------------- */

.doc {
    color: var(--ink-soft);
    font-size: 0.875rem;
    line-height: 1.72;
}

.doc h3 {
    margin: 1.35rem 0 0.45rem;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
}

.doc h3:first-child {
    margin-top: 0;
}

.doc p {
    margin: 0 0 0.8rem;
}

.doc ul {
    margin: 0 0 0.9rem;
    padding-left: 1.15rem;
}

.doc li {
    margin-bottom: 0.28rem;
}

.doc strong {
    color: var(--ink-strong);
}

.doc__updated {
    margin: 0 0 1.1rem;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--ink-faint);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    background: var(--surface-sunken);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.7rem;
    margin: 0 0 1.15rem;
}

.contact-card {
    padding: 0.9rem 1rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
}

.contact-card__label {
    color: var(--ink-faint);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.contact-card__value {
    margin-top: 0.28rem;
    color: var(--ink-strong);
    font-size: 0.92rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.contact-card__value a {
    color: var(--accent);
    text-decoration: none;
}

.contact-card__value a:hover {
    text-decoration: underline;
}

/* Standalone legal page --------------------------------------------------- */

.doc-page {
    width: min(100%, 52rem);
    margin: 0 auto;
    padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1rem, 5vw, 3rem) clamp(2.5rem, 5vw, 4rem);
}

.doc-page__eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.doc-page h1 {
    margin: 0 0 1.3rem;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5vw, 2.9rem);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.08;
}

.doc-page__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 2rem;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.doc-page__back:hover {
    text-decoration: underline;
}

.error-page {
    width: min(100%, 44rem);
    margin: 0 auto;
    padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 5vw, 3rem);
}

.error-page h1 {
    margin: 0 0 0.9rem;
    color: var(--ink-strong);
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 5vw, 2.8rem);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
}

.error-page p {
    margin: 0 0 0.6rem;
    color: var(--ink-soft);
    line-height: 1.65;
}

.error-page__meta {
    margin: 1.1rem 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    font-size: 0.82rem;
    background: var(--surface-raised);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast-host {
    position: fixed;
    z-index: 120;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    max-width: min(100%, 26rem);
    padding: 0.7rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-strong);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
    background: var(--surface);
    box-shadow: var(--shadow-modal);
    animation: toast-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-leaving {
    animation: toast-out 200ms ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE
   -------------------------------------------------------------------------- */

/* Wide screens read as a desk: the deck sits beside its controls instead of
   stacking under them, which also lets a tall card breathe. */
@media (min-width: 68rem) {
    /* Grid (not flex) so a page-level child still stretches to full width. */
    body > main {
        display: grid;
        align-content: center;
    }

    .quote-viewer {
        display: grid;
        grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "intro stage"
            "rail  stage"
            "nav   stage";
        align-items: start;
        gap: 0 clamp(2rem, 5vw, 4.5rem);
    }

    .quote-stage {
        --card-max-w: min(100%, clamp(18rem, 46vw, 34rem));
        --card-max-h: min(66svh, 34rem);
        grid-area: stage;
        align-self: center;
    }

    .quote-viewer__intro {
        width: 100%;
        margin-bottom: 1.6rem;
        grid-area: intro;
    }

    /* In the side column the rail becomes a tidy 2-up tool block; the last
       tool spans the full width so no row is left with an orphan. */
    .card-rail {
        width: 100%;
        margin-top: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.6rem;
        align-self: start;
        grid-area: rail;
    }

    .rail-btn {
        justify-content: flex-start;
        padding-inline: 0.7rem;
    }

    .rail-btn:last-child {
        grid-column: 1 / -1;
    }

    .quote-controls {
        width: 100%;
        margin-top: 1.5rem;
        align-self: end;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "meta meta"
            "prev next";
        gap: 0.9rem 0.6rem;
        grid-area: nav;
    }

    .quote-position {
        align-items: flex-start;
        gap: 0.55rem;
        grid-area: meta;
    }

    .quote-progress {
        width: 100%;
    }

    .quote-control--previous {
        justify-self: stretch;
        grid-area: prev;
    }

    .quote-control--next {
        justify-self: stretch;
        grid-area: next;
    }

    .quote-noscript {
        grid-column: 1 / -1;
    }
}

@media (max-width: 52rem) {
    .export-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .export-preview {
        width: min(100%, 11rem);
        margin: 0 auto;
    }
}

@media (max-width: 44rem) {
    .shop-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .site-header__inner {
        justify-content: center;
        text-align: center;
    }

    .brand {
        flex: 1 1 auto;
    }

    .toolbar {
        width: 100%;
        justify-content: center;
    }

    .site-footer__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .site-footer__links {
        justify-content: center;
    }

    .site-footer__meta {
        justify-content: center;
    }
}

@media (max-width: 36rem) {
    .quote-viewer {
        padding-top: 1.25rem;
    }

    .quote-stage {
        --card-max-h: min(56svh, 26rem);
    }

    .quote-viewer__intro {
        margin-bottom: 1.1rem;
    }

    .tool__label {
        display: none;
    }

    .tool {
        min-width: 2.6rem;
        padding: 0 0.55rem;
    }

    .quote-controls {
        grid-template-columns: minmax(0, 1fr) 4.75rem minmax(0, 1fr);
        gap: 0.55rem;
    }

    .quote-control {
        width: 100%;
        min-height: 3rem;
        padding-inline: 0.6rem;
        gap: 0.4rem;
        font-size: 0.66rem;
        letter-spacing: 0.06em;
    }

    .quote-position {
        min-width: 5.5rem;
    }

    .quote-progress {
        width: 3.75rem;
    }

    .rail-btn__label {
        display: none;
    }

    .rail-btn {
        min-width: 2.6rem;
        padding: 0 0.6rem;
    }

    .modal {
        max-height: 92svh;
    }

    .modal__head {
        padding-top: 1.15rem;
        padding-bottom: 0.75rem;
    }

    .modal__sub {
        font-size: 0.82rem;
    }

    .modal__foot {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .modal__foot-actions {
        width: 100%;
        flex: 0 0 auto;
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .modal__foot .btn {
        width: 100%;
    }

    .modal__foot-note {
        flex: 0 0 auto;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 23rem) {
    .quote-control span:not(.quote-control__arrow) {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .quote-control__arrow {
        font-size: 1.15rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
