/*
 * The Crease site: a warm paper notebook under studio light. Cream canvas, paper-white cards with hairline
 * borders, near-monochrome type with a two-tone headline, dark filled buttons and one cool blue that only
 * accents. The Compose viewports use the same palette (SiteTheme.kt).
 */
@font-face {
    font-family: Inter;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/inter_regular.ttf') format('truetype');
}

@font-face {
    font-family: Inter;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/inter_semibold.ttf') format('truetype');
}

:root {
    --canvas: #efefe4;
    --paper: #fcfcf9;
    --bright: #ffffff;
    --mist: #f4f4ee;
    --line: #d7d7d6;
    --grid: #c1c1c0;
    --ink: #181818;
    --slate: #6b6b65;
    --iron: #666666;
    --blue: #5d8cd7;
    --ok: #23864d;
    --on-ink: #fcfcf9;

    --code-keyword: #3f6fbf;
    --code-string: #23864d;
    --code-comment: #6e6e68;
    --code-annotation: #b05a14;
    --code-number: #b05a14;
    --code-type: #7a45b5;
    --code-call: #1f6f8b;

    --shadow-card: rgba(0, 0, 0, 0.12) 0 4px 10px 0, rgba(0, 0, 0, 0.12) 0 2px 4px -1px,
        rgba(0, 0, 0, 0.12) 0 0 4px -1px;

    --font: Inter, 'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

/* Dark: the same notebook at night. Kept in one block and applied by the switch or the system. */
:root[data-theme='dark'] {
    --canvas: #121210;
    --paper: #1c1c1a;
    --bright: #232320;
    --mist: #161614;
    --line: #33332f;
    --grid: #3a3a36;
    --ink: #ededE6;
    --slate: #8f8f88;
    --iron: #a3a39c;
    --blue: #81adec;
    --ok: #5fd08f;
    --on-ink: #181818;

    --code-keyword: #81adec;
    --code-string: #8fd6a4;
    --code-comment: #929289;
    --code-annotation: #f0a868;
    --code-number: #f0a868;
    --code-type: #c7a3f2;
    --code-call: #7fd3e6;

    --shadow-card: rgba(0, 0, 0, 0.5) 0 4px 10px 0, rgba(0, 0, 0, 0.4) 0 2px 4px -1px,
        rgba(0, 0, 0, 0.4) 0 0 4px -1px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-padding-top: 64px;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 400 16px/1.5 var(--font);
    letter-spacing: -0.16px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--ink);
    text-decoration: none;
    border-radius: 4px;
}

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

code {
    font-family: var(--mono);
    font-size: 0.86em;
    letter-spacing: 0.1px;
}

p code {
    padding: 1px 5px;
    background: var(--mist);
    border: 1px solid var(--line);
    border-radius: 4px;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 400;
}

.muted {
    color: var(--slate);
}

.container,
.nav-inner,
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navigation */
.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--canvas) 88%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.nav nav {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    letter-spacing: -0.14px;
}

.nav nav a {
    padding: 6px 8px;
}

.nav nav a:hover {
    color: var(--iron);
}

.nav-strong {
    font-weight: 600;
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-left: 4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--slate);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

/* The icon shows the theme a click switches to. */
.theme-toggle .icon-sun,
:root[data-theme='dark'] .theme-toggle .icon-moon {
    display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
    display: block;
}

/* Hero */
.hero {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 24px 64px;
    overflow: hidden;
}

.grid-wedge {
    position: absolute;
    top: 0;
    right: 0;
    width: 520px;
    height: 420px;
    opacity: 0.55;
    background-image:
        repeating-linear-gradient(30deg, var(--grid) 0 1px, transparent 1px 28px),
        repeating-linear-gradient(150deg, var(--grid) 0 1px, transparent 1px 28px),
        repeating-linear-gradient(90deg, var(--grid) 0 1px, transparent 1px 48.5px);
    clip-path: polygon(100% 0, 100% 100%, 0 0);
    pointer-events: none;
}

.eyebrow {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--slate);
}

.hero h1 {
    position: relative;
    max-width: 860px;
    font-size: 64px;
    line-height: 1.04;
    letter-spacing: -1.28px;
}

.hero h1 span {
    display: block;
}

.lede {
    position: relative;
    max-width: 58ch;
    margin: 24px 0 0;
    font-size: 18px;
    line-height: 1.75;
    letter-spacing: -0.18px;
    color: var(--iron);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-top: 32px;
}

.button {
    padding: 8px 16px;
    background: var(--ink);
    color: var(--on-ink);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.button:hover {
    opacity: 0.88;
}

.ghost {
    font-size: 14px;
    font-weight: 600;
}

.ghost:hover {
    color: var(--iron);
}

.install {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    margin-top: 40px;
    padding: 6px 6px 6px 14px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.install-label {
    font: 400 11px/1 var(--mono);
    letter-spacing: 0.17px;
    color: var(--slate);
}

.install code {
    overflow-x: auto;
    white-space: nowrap;
    font-size: 13px;
}

/* Buttons in the code panels */
.copy,
.source-toggle,
.imports-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--bright);
    color: var(--ink);
    font: 600 12px/16px var(--font);
    cursor: pointer;
    white-space: nowrap;
}

.copy:hover,
.source-toggle:hover,
.imports-toggle:hover {
    border-color: var(--slate);
}

.copy .check {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: var(--ok);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.copy.copied {
    color: var(--ok);
    border-color: var(--ok);
}

.source-toggle {
    justify-self: start;
}

/* Sections */
.section {
    padding: 48px 0;
}

.section h2 {
    max-width: 760px;
    font-size: 48px;
    line-height: 1.12;
    letter-spacing: -0.96px;
}

/* The playground as the product card */
.showcase {
    padding-top: 0;
}

.product-card {
    background: var(--paper);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.product-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    font: 400 11px/1 var(--mono);
    color: var(--slate);
}

.product-bar i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--line);
}

.product-bar span {
    margin-left: 10px;
}

.playground {
    height: 820px;
    background: var(--mist);
}

.caption {
    max-width: 640px;
    margin: 16px auto 0;
    text-align: center;
    font-size: 14px;
    color: var(--iron);
}

/* Compatibility */
.compat {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 40px 0 0;
    padding: 0;
    list-style: none;
}

.compat li {
    display: flex;
    gap: 14px;
    padding: 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.compat svg {
    flex: none;
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.compat strong {
    display: block;
    font-weight: 600;
    font-size: 15px;
}

.compat span {
    display: block;
    margin-top: 2px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--iron);
}

.compat code {
    font-size: 0.92em;
}

/* Examples */
.examples {
    display: grid;
    gap: 24px;
    margin-top: 40px;
}

.example {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 32px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.example h3 {
    font-size: 24px;
    line-height: 1.3;
    letter-spacing: 0.1px;
}

.example header p {
    max-width: 70ch;
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--iron);
}

.live {
    height: 600px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--mist);
}

.live.tall {
    height: 720px;
}

/* Source panel */
.source {
    display: grid;
}

.source[data-open='false'] .source-panel {
    display: none;
}

.source-panel {
    margin-top: 12px;
    background: var(--bright);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.source-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 8px 8px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.tabs button {
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--slate);
    font: 400 12px/16px var(--mono);
    cursor: pointer;
}

.tabs button[aria-selected='true'] {
    background: var(--mist);
    color: var(--ink);
}

.source pre {
    margin: 0;
    max-height: 560px;
    overflow: auto;
    padding: 16px 20px 20px;
    font: 400 13px/1.7 var(--mono);
    letter-spacing: 0.1px;
    tab-size: 4;
    color: var(--ink);
}

.imports-toggle {
    display: flex;
    width: fit-content;
    margin: 0;
    padding: 1px 8px;
    font: 400 12px/18px var(--mono);
    color: var(--slate);
}

.imports-body {
    display: block;
}

.imports[data-collapsed='true'] .imports-body {
    display: none;
}

.tok-keyword {
    color: var(--code-keyword);
    font-weight: 600;
}

.tok-string {
    color: var(--code-string);
}

.tok-comment {
    color: var(--code-comment);
    font-style: italic;
}

.tok-annotation,
.tok-number {
    color: var(--code-annotation);
}

.tok-type {
    color: var(--code-type);
}

.tok-call {
    color: var(--code-call);
}

/* Footer */
.footer {
    margin-top: 48px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--iron);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.footer a {
    color: var(--iron);
}

.footer a:hover {
    color: var(--ink);
}

.brand-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 960px) {
    .compat {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav nav a[href='#compatibility'],
    .nav nav a[href='#examples'] {
        display: none;
    }
}

@media (max-width: 640px) {
    .hero {
        padding-top: 64px;
    }

    .hero h1 {
        font-size: 44px;
        letter-spacing: -0.88px;
    }

    .section h2 {
        font-size: 34px;
        letter-spacing: -0.5px;
    }

    .lede {
        font-size: 16px;
    }

    .grid-wedge {
        width: 260px;
        height: 220px;
    }

    .nav nav a[href='#playground-section'],
    .nav nav a[href='https://crease-black.vercel.app'] {
        display: none;
    }

    .compat {
        grid-template-columns: minmax(0, 1fr);
    }

    .example {
        padding: 20px;
    }

    .live {
        height: 520px;
    }

    .playground {
        height: 720px;
    }

    .footer-inner {
        flex-direction: column;
    }
}
