@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Fira+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Pebble palette */
    --pebble-champagne: #F3EEE3;
    --pebble-forest: #1B2B24;
    --pebble-gold: #C48A4E;
    --pebble-rose: #C4756A;
    --pebble-ink-2: #4A5E55;
    --pebble-ink-3: #8A9E95;
    --pebble-sage: #D1D7D3;
    --pebble-sage-deep: #B0BEB8;
    --pebble-emerald: #5FA26B;
    --pebble-slate-base: #020617;
    --pebble-slate-surface: #0F172A;

    /* Type */
    --pebble-serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
    --pebble-sans: 'Geist', 'Fira Sans', 'Inter', system-ui, sans-serif;
    --pebble-mono: 'Geist Mono', 'Fira Code', monospace;
    --pebble-ls-micro: 0.28em;
    --pebble-ls-heading: -0.025em;

    /* Motion */
    --pebble-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --pebble-spring: cubic-bezier(0.22, 1.2, 0.36, 1);

    /* Surfaces */
    --pebble-radius: 18px;
    --pebble-border: rgba(27, 43, 36, 0.12);
    --pebble-glass: rgba(243, 238, 227, 0.82);
    --pebble-shadow: 0 18px 42px rgba(27, 43, 36, 0.12);

    /* Legacy token aliases used across pages (light) */
    --bg-primary: var(--pebble-champagne);
    --bg-card: #ffffff;
    --text-primary: var(--pebble-forest);
    --text-secondary: var(--pebble-ink-2);
    --accent-cyan: var(--pebble-gold);
    --accent-blue: var(--pebble-forest);
    --accent-violet: var(--pebble-gold);
    --border-color: rgba(27, 43, 36, 0.12);
    --card-radius: 18px;
}

:root:not([data-theme]),
[data-theme="light"] {
    --pebble-bg: var(--pebble-champagne);
    --pebble-surface: rgba(255, 255, 255, 0.78);
    --pebble-surface-2: rgba(255, 255, 255, 0.58);
    --pebble-ink: var(--pebble-forest);
    --pebble-ink-soft: #4A5E55;
    --pebble-ink-mute: #8A9E95;
}

[data-theme="dark"] {
    --pebble-bg: #1B2B24;
    --pebble-surface: rgba(15, 26, 21, 0.92);
    --pebble-surface-2: rgba(27, 43, 36, 0.85);
    --pebble-ink: #F3EEE3;
    --pebble-ink-soft: #D1D7D3;
    --pebble-ink-mute: rgba(243, 238, 227, 0.62);
    --pebble-border: rgba(243, 238, 227, 0.14);
    --pebble-glass: rgba(15, 26, 21, 0.88);
    --pebble-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);

    /* Legacy token aliases for dark */
    --bg-primary: var(--pebble-bg);
    --bg-card: var(--pebble-surface);
    --text-primary: var(--pebble-ink);
    --text-secondary: var(--pebble-ink-mute);
    --accent-cyan: var(--pebble-gold);
    --accent-blue: var(--pebble-gold);
    --accent-violet: var(--pebble-gold);
    --border-color: var(--pebble-border);
}

/* Core canvas */
body.pebble-page {
    background: var(--pebble-bg, #F3EEE3);
    color: var(--pebble-ink, #1B2B24);
    font-family: var(--pebble-sans);
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.6s var(--pebble-ease), color 0.4s var(--pebble-ease);
    position: relative;
}

body.pebble-page::after {
    /* subtle film grain */
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
h4 {
    font-family: var(--pebble-serif);
    font-style: italic;
    letter-spacing: var(--pebble-ls-heading);
    font-weight: 400;
}

.micro-label {
    font-family: var(--pebble-mono);
    font-size: 10px;
    letter-spacing: var(--pebble-ls-micro);
    text-transform: uppercase;
    color: var(--pebble-ink-mute);
}

.pebble-body-copy {
    font-family: var(--pebble-sans);
    line-height: 1.6;
    color: var(--pebble-ink-soft);
}

/* Glass nav used on landing / hub */
.pebble-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1100px, calc(100% - 48px));
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--pebble-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--pebble-border);
    border-radius: 14px;
    box-shadow: 0 2px 20px rgba(27, 43, 36, 0.08), 0 1px 0 rgba(255, 255, 255, 0.38) inset;
    transition: opacity 0.35s var(--pebble-ease), transform 0.35s var(--pebble-ease);
    z-index: 120;
}

.pebble-nav.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-80px);
}

/* Stone button */
.stone-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    font-family: var(--pebble-sans);
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--pebble-bg);
    background: linear-gradient(135deg, var(--pebble-forest), var(--pebble-gold));
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 999px 720px 980px 820px / 960px 820px 720px 980px;
    box-shadow: 0 12px 30px rgba(27, 43, 36, 0.18), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
    cursor: pointer;
    transition: transform 0.24s var(--pebble-ease), box-shadow 0.24s var(--pebble-ease), filter 0.24s var(--pebble-ease);
}

.stone-button:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 18px 36px rgba(27, 43, 36, 0.22);
}

.stone-button:active {
    transform: translateY(0);
    filter: saturate(1.05);
}

/* Inputs with bottom rule */
.pebble-input {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--pebble-border);
    background: transparent;
    font-family: var(--pebble-sans);
    font-size: 15px;
    color: var(--pebble-ink);
    transition: border-color 0.2s var(--pebble-ease);
}

.pebble-input:focus {
    outline: none;
    border-color: var(--pebble-ink);
}

.pebble-input::placeholder {
    color: var(--pebble-ink-mute);
}

/* Generic utility so pages without bespoke CSS pick up Pebble palette */
html,
body {
    background: var(--bg-primary, var(--pebble-bg, #F3EEE3));
    color: var(--text-primary, var(--pebble-ink, #1B2B24));
}

/* Gorge grid (three columns with empty center) */
.gorge-grid {
    display: grid;
    grid-template-columns: 200px 1fr 360px;
    gap: 48px;
}

@media (max-width: 980px) {
    .gorge-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

.step-card {
    position: relative;
    padding: 26px;
    background: var(--pebble-surface);
    border: 1px solid var(--pebble-border);
    border-radius: 18px;
    box-shadow: 0 10px 26px rgba(27, 43, 36, 0.1);
    transform: translateX(var(--indent, 0px));
    transition: transform 0.3s var(--pebble-ease), box-shadow 0.3s var(--pebble-ease);
}

.step-card:hover {
    transform: translateX(calc(var(--indent, 0px) + 4px)) translateY(-2px);
    box-shadow: 0 16px 30px rgba(27, 43, 36, 0.14);
}

.step-card .step-label {
    display: block;
    margin-bottom: 12px;
    font-family: var(--pebble-mono);
    letter-spacing: var(--pebble-ls-micro);
    font-size: 11px;
    color: var(--pebble-ink-mute);
    text-transform: uppercase;
}

.step-card .step-title {
    font-family: var(--pebble-serif);
    font-style: italic;
    letter-spacing: var(--pebble-ls-heading);
    margin: 0 0 8px 0;
}

.step-card .step-desc {
    margin: 0;
    font-family: var(--pebble-sans);
    color: var(--pebble-ink-soft);
    line-height: 1.6;
}

/* Staggered / staircase list (history, goals) */
.staircase-list>*:nth-child(1) {
    transform: translateX(0);
}

.staircase-list>*:nth-child(2) {
    transform: translateX(10px);
}

.staircase-list>*:nth-child(3) {
    transform: translateX(20px);
}

.staircase-list>*:nth-child(4) {
    transform: translateX(30px);
}

.staircase-list>*:nth-child(5) {
    transform: translateX(40px);
}

.staircase-list>* {
    transition: transform 0.28s var(--pebble-ease);
}

/* Page transitions use an overlay to avoid flashes */
.pebble-transition-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: var(--pebble-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.8s var(--pebble-ease);
    z-index: 1500;
}

.pebble-transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── Brand cursive: applied to every "pebble" text instance site-wide ── */
.brand-cursive,
body.post-login .brand-cursive,
body.post-login span.brand-cursive,
body.post-login div.brand-cursive {
    font-family: 'Dancing Script', 'Segoe Script', 'Brush Script MT', cursive !important;
    font-style: normal !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em !important;
    text-transform: lowercase !important;
    line-height: 1 !important;
    display: inline-block;
}
