/*
 * notekpr's look on C4Stack's default design, linked after its stylesheet: the
 * website's (site/style.css) colours, type, buttons, header and footer for every page,
 * C4Stack's own included, and its pricing cards, chips and kickers for the account
 * page. Change them with the website's. Muted text is a little darker than the
 * website's, so small text on forms stays readable.
 *
 * Three voices, as on the website: a bold sans for what we say, the mono of Markdown
 * for what it is (kickers like "## Your plan"), and Excalidraw's hand for asides
 * (the footer's).
 */

@font-face {
    font-family: "Excalifont";
    src: url(fonts/Excalifont-Latin.woff2) format("woff2");
    font-display: swap;
}

:root {
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --font-hand: "Excalifont", "Segoe Print", "Bradley Hand", cursive;
    --radius: 10px;
    --radius-lg: 18px;
    --wrap: 68rem;

    --bg: #ffffff;
    --surface: #ffffff;
    --sunken: #f7f7f5;
    --line: #e6e6e1;
    --line-strong: #d4d4cd;
    --text: #22221f;
    --text-soft: #4a4a46;
    --muted: #6e6e68;
    --accent: #5b5bd6;
    --accent-hover: #4545b8;
    --on-accent: #ffffff;
    --focus: #5b5bd6;
    --shadow: none;

    /* The website's own. */
    --accent-bg: #ececfb;
    --accent-ink: #4545b8;
    --ok: #2f9e5a;
    --coral: #e8590c;
    --dot: #d9d9e3;
    --glow-1: rgba(91, 91, 214, 0.18);
    --glow-2: rgba(255, 196, 70, 0.2);
    --lift: 0 10px 30px rgba(30, 30, 60, 0.1), 0 1px 3px rgba(30, 30, 60, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17171b;
        --surface: #1e1e23;
        --sunken: #141417;
        --line: #2d2d34;
        --line-strong: #3d3d45;
        --text: #ececea;
        --text-soft: #c8c8c3;
        --muted: #8e8e96;
        --accent: #8b8cf4;
        --accent-hover: #a9aaff;
        --on-accent: #15151a;
        --focus: #a9aaff;

        --accent-bg: #2a2a46;
        --accent-ink: #a9aaff;
        --ok: #4cc27a;
        --coral: #ff8a4c;
        --dot: #2c2c36;
        --glow-1: rgba(139, 140, 244, 0.2);
        --glow-2: rgba(255, 196, 70, 0.08);
        --lift: 0 10px 30px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.35);
    }
}

/* Every page ------------------------------------------------------------------ */

/* The website's glow and dotted paper behind the top of every page. */
body {
    position: relative;
    isolation: isolate;
    font-size: 1.0625rem;
    line-height: 1.6;
}

body::before,
body::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    pointer-events: none;
}

body::before {
    z-index: -2;
    height: 40rem;
    background:
        radial-gradient(40rem 26rem at 12% 0%, var(--glow-1), transparent 70%),
        radial-gradient(36rem 24rem at 92% 4%, var(--glow-2), transparent 70%);
}

body::after {
    z-index: -1;
    height: 32rem;
    opacity: 0.8;
    background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}

h1,
h2,
h3 {
    font-weight: 780;
    line-height: 1.1;
    letter-spacing: -0.028em;
    text-wrap: balance;
}

h1 {
    font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.2rem);
}

h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.1rem);
    line-height: 1.12;
}

h3 {
    font-size: 1.2rem;
    font-weight: 680;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

strong,
b {
    font-weight: 650;
}

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

a:hover {
    color: var(--accent-ink);
    text-decoration-thickness: 2px;
}

::selection {
    background: var(--accent-bg);
}

/* The header: translucent over the glow, as the website's. */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
}

.site-header .wrap {
    padding-block: 0.65rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
    font: 650 1.08rem/1 var(--font-mono);
    letter-spacing: -0.01em;
}

.brand .icon {
    width: 28px;
    height: 28px;
    flex: none;
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.brand:hover .icon {
    transform: rotate(-12deg) scale(1.06);
}

.icon-ink {
    fill: var(--accent);
}

.icon-paper {
    fill: var(--bg);
}

.site-nav {
    font-size: 0.875rem;
}

.site-nav ul {
    gap: 0.25rem 1.2rem;
}

.site-nav a {
    padding-block: 0.25rem;
    color: var(--text-soft);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text);
    text-decoration: none;
}

.site-nav a[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--accent);
}

.site-main {
    padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5.5rem);
}

.lead,
.lede {
    max-width: 66ch;
    color: var(--text-soft);
    font-size: 1.2rem;
    line-height: 1.55;
}

/* Buttons: the website's pills. */
.btn {
    min-height: 2.75rem;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 650;
    line-height: 1;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.btn:hover {
    border-color: var(--text-soft);
    transform: translateY(-1px);
}

.btn.primary {
    box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn.primary:hover {
    border-color: var(--accent);
    background: var(--accent);
    filter: brightness(1.07);
    box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}

.btn.ghost:hover {
    transform: none;
}

.btn.small {
    min-height: 2.1rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
    border-color: var(--line-strong);
    transform: none;
    filter: none;
}

.btn.primary[aria-disabled="true"]:hover {
    border-color: var(--accent);
}

.panel {
    padding: clamp(1.25rem, 3vw, 1.75rem);
    border-radius: var(--radius-lg);
}

/* A panel's title shows its Markdown, faintly, as the website's headings do. */
.panel h2 {
    font-size: 1.35rem;
}

.panel h2::before {
    content: "### ";
    color: var(--accent);
    font: 500 0.75em/1 var(--font-mono);
    letter-spacing: 0;
    opacity: 0.55;
}

.dialog {
    border-radius: var(--radius-lg);
}

.notice {
    border-radius: 12px;
}

/* The footer, as the website's. */
.site-foot {
    border-top: 1px solid var(--line);
    background: var(--sunken);
}

.foot-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr));
    gap: 2rem;
    padding-block: clamp(2.5rem, 5vw, 3.5rem) 1.5rem;
}

.foot-grid .about {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    color: var(--text-soft);
    font-size: 0.94rem;
}

.foot-grid .about p {
    margin: 0;
}

.foot-grid .about .hand {
    color: var(--accent-ink);
    font-size: 1.25rem;
}

.foot-grid h4 {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font: 600 0.75rem/1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.foot-grid ul {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
}

.foot-grid li {
    list-style: none;
    font-size: 0.94rem;
}

.foot-grid a {
    color: var(--text-soft);
    text-decoration: none;
}

.foot-grid a:hover {
    color: var(--text);
    text-decoration: underline;
}

.foot-base {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    padding-block: 1.2rem 2rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font: 400 0.8rem/1.4 var(--font-mono);
}

/* Who makes it: coolapso.sh, as on the website. */
.footer-credit {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font: 500 0.82rem/1 var(--font-mono);
    text-decoration: none;
}

.footer-credit img {
    width: 22px;
    height: 22px;
    border-radius: 5px;
}

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

/* The website's small pieces ---------------------------------------------------- */

.kicker {
    color: var(--accent-ink);
    font: 600 0.95rem/1.2 var(--font-mono);
    letter-spacing: 0.01em;
}

.kicker span {
    color: var(--muted);
    font-weight: 400;
}

.hand {
    font-family: var(--font-hand);
    font-weight: 400;
    letter-spacing: 0;
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-bg);
    color: var(--accent-ink);
    font: 600 0.72rem/1 var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 0.15em;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.chips li {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font: 500 0.82rem/1 var(--font-mono);
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* The account page ------------------------------------------------------------- */

.account-head {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.plans-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: clamp(1rem, 3vw, 2rem);
}

.plans-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.vaults-same {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    color: var(--text-soft);
}

/* The cards: the website's pricing, with the account's plan marked. */
.plans {
    display: grid;
    margin-top: 0.5rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.plan {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.plan.current {
    border: 2px solid var(--accent);
    box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--accent) 60%, transparent);
}

.plan .ribbon {
    position: absolute;
    top: -0.8rem;
    left: 1.2rem;
    padding: 0.4rem 0.6rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font: 650 0.72rem/1 var(--font-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.plan .ribbon.soft {
    background: var(--accent-bg);
    color: var(--accent-ink);
}

.plan .name {
    font: 750 1.2rem/1.2 var(--font-sans);
}

.plan .for {
    min-height: 2.6em;
    color: var(--muted);
    font-size: 0.92rem;
}

.plan .cost {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.plan .price {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    font: 800 2.4rem/1 var(--font-sans);
    letter-spacing: -0.03em;
}

.plan .price small {
    color: var(--muted);
    font: 500 0.85rem/1 var(--font-sans);
    letter-spacing: 0;
}

.plan .per {
    color: var(--muted);
    font-size: 0.85rem;
}

.plan ul {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.plan li {
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-soft);
    font-size: 0.94rem;
    list-style: none;
}

.plan li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--ok);
    font-weight: 800;
}

.plan li b {
    color: var(--text);
}

.plan > .btn,
.plan .btns .btn {
    width: 100%;
}

.plan .btns {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 0.5rem;
}

.addons {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem 2rem;
    padding: 1.2rem 1.35rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--sunken);
}

.addons .copy {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.addons .copy p {
    color: var(--text-soft);
    font-size: 0.95rem;
}

.addons .chips {
    justify-content: flex-end;
    max-width: 30rem;
}

.fine {
    color: var(--muted);
    font-size: 0.85rem;
}

/* The page that asks before a plan change. */
.change {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 40rem;
    margin-top: clamp(1rem, 3vw, 2rem);
}

/* A button that says what is going on once pressed: C4Stack's busy forms
   (data-busy-form) are aria-busy from the submit until the next page. */
.btn .when-busy,
[aria-busy="true"] .btn .when-idle {
    display: none;
}

[aria-busy="true"] .btn .when-busy {
    display: inline;
}

/* Where to go next: the website's "in the box" tiles. */
.next {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: clamp(1rem, 3vw, 2rem);
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16.5rem), 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.tiles li {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    padding: 1.15rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    list-style: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tiles li:has(a):hover {
    border-color: var(--line-strong);
    box-shadow: var(--lift);
    transform: translateY(-3px);
}

.tiles b {
    color: var(--text);
    font: 680 1rem/1.35 var(--font-sans);
}

.tiles li > span {
    color: var(--text-soft);
    font-size: 0.94rem;
}

.tiles a {
    color: inherit;
    text-decoration: none;
}

/* The whole tile follows its link. */
.tiles a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

/* Smaller screens and less motion ----------------------------------------------- */

@media (max-width: 1080px) {
    .addons {
        grid-template-columns: minmax(0, 1fr);
    }

    .addons .chips {
        justify-content: flex-start;
        max-width: none;
    }
}

@media (max-width: 900px) {
    .plans {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

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

    .foot-grid .about {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .foot-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .tiles li,
    .brand .icon {
        transition: none;
    }

    .btn:hover,
    .tiles li:has(a):hover,
    .brand:hover .icon {
        transform: none;
    }
}
