/* Postino website. Colors, type and radii come from the Postino design system
   (postino_design_system/, crates/postino-app/src/theme/palette.rs). Plain CSS, no build step. */

@font-face {
    font-family: "Geist";
    src: url("../fonts/Geist-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Geist";
    src: url("../fonts/Geist-Medium.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "Geist";
    src: url("../fonts/Geist-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "Geist Mono";
    src: url("../fonts/GeistMono-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Geist Mono";
    src: url("../fonts/GeistMono-Medium.woff2") format("woff2");
    font-weight: 500 600;
    font-display: swap;
}

/* Tokens */

:root {
    color-scheme: light dark;

    --bg: light-dark(#fcfcfd, #15161a);
    --surface: light-dark(#f4f5f7, #1b1c21);
    --raised: light-dark(#ffffff, #23252c);
    --border: light-dark(#e3e5ea, #2c2e36);
    --border-strong: light-dark(#cdd0d8, #3b3e48);
    --fg: light-dark(#1b1c22, #e9eaee);
    --fg-muted: light-dark(#5c606e, #a0a3ae);
    --fg-subtle: light-dark(#8b8e9a, #6f7280);
    --accent: light-dark(#4f57d8, #5b63e6);
    --accent-hover: light-dark(#434bc9, #6a72ee);
    --accent-fg: #ffffff;
    --accent-text: light-dark(#3f47c4, #a3a9ff);
    --accent-subtle: light-dark(#e8e9fd, #272b4d);
    --hover: light-dark(#eceef2, #25272e);
    --success: light-dark(#1d8657, #4fc88f);
    --success-subtle: light-dark(#e2f4ea, #15302a);
    --warning: light-dark(#9a6500, #e8b75a);
    --danger: light-dark(#cf3535, #f27171);
    --danger-subtle: light-dark(#fde7e7, #3b1e21);
    --info: light-dark(#1c6fb0, #62b3f0);
    --m-patch: light-dark(#7a4fd6, #b597f7);
    --syn-key: light-dark(#3f47c4, #a3a9ff);
    --syn-str: light-dark(#1d7a4f, #86d7a5);
    --syn-num: light-dark(#9a6500, #e8b75a);
    --glow: light-dark(rgba(79, 87, 216, 0.16), rgba(91, 99, 230, 0.22));

    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 10px;
    --r-xl: 14px;

    --page: 1160px;
    --gutter: 24px;
}

/* js/theme.js sets data-theme from the visitor's choice or the system. Without JavaScript the
   page still follows the system through color-scheme. */
:root[data-theme="light"] {
    color-scheme: light;
}

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

/* Base */

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

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

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p {
    margin: 0;
    text-wrap: pretty;
}

code,
kbd,
pre {
    font-family: var(--mono);
}

code {
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
}

kbd {
    display: inline-block;
    font-size: 0.8em;
    padding: 0.05em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    background: var(--raised);
    color: var(--fg-muted);
}

.wrap {
    width: 100%;
    max-width: calc(var(--page) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip {
    position: absolute;
    left: -9999px;
}

.skip:focus {
    left: 16px;
    top: 16px;
    z-index: 10;
    padding: 8px 12px;
    background: var(--raised);
    border-radius: var(--r-md);
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 60px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    width: 28px;
    height: 28px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav a {
    padding: 6px 12px;
    border-radius: var(--r-sm);
    color: var(--fg-muted);
    font-size: 15px;
    font-weight: 500;
}

.nav a:hover {
    color: var(--fg);
    background: var(--hover);
    text-decoration: none;
}

.nav a[aria-current="page"] {
    color: var(--fg);
}

.nav .nav-github {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Theme switch: shows the sun in light mode and the moon in dark mode. Hidden without
   JavaScript, where the page simply follows the system. */
.theme-toggle {
    display: none;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-left: 4px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--raised);
    color: var(--fg-muted);
    cursor: pointer;
    transition:
        background-color 0.15s,
        color 0.15s;
}

:root[data-theme] .theme-toggle {
    display: grid;
}

.theme-toggle:hover {
    background: var(--hover);
    color: var(--fg);
}

.theme-toggle svg {
    grid-area: 1 / 1;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:root[data-theme="dark"] .theme-toggle .sun,
:root[data-theme="light"] .theme-toggle .moon {
    display: none;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    transition:
        background-color 0.15s,
        border-color 0.15s,
        color 0.15s;
}

.btn:hover {
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 1px 2px rgba(16, 18, 40, 0.18);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--raised);
    color: var(--fg);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--hover);
}

/* Hero */

.hero {
    position: relative;
    padding: 88px 0 0;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 30%, transparent 75%);
    opacity: 0.6;
    pointer-events: none;
}

.hero .wrap {
    position: relative;
    text-align: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--raised);
    color: var(--fg-muted);
    font-size: 14px;
    font-weight: 500;
}

.eyebrow .pill {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-subtle);
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 600;
}

.hero h1 {
    max-width: 880px;
    margin: 24px auto 0;
    font-size: clamp(38px, 6.4vw, 66px);
    letter-spacing: -0.035em;
    line-height: 1.04;
}

.hero h1 .accent {
    color: var(--accent-text);
}

.hero .lead {
    max-width: 640px;
    margin: 24px auto 0;
    color: var(--fg-muted);
    font-size: clamp(17px, 2vw, 19px);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 36px;
}

.platforms {
    margin-top: 16px;
    color: var(--fg-subtle);
    font-size: 14px;
}

.hero-shot {
    position: relative;
    margin: 56px auto 0;
    max-width: 1240px;
}

.hero-shot::before {
    content: "";
    position: absolute;
    inset: 8% 6% 20%;
    background: radial-gradient(closest-side, var(--glow), transparent);
    filter: blur(40px);
    z-index: -1;
}

/* The screenshots carry the window's own soft shadow and transparent margin, so the frame
   pulls them out by that margin to line the window edges up with the page grid. */
.shot img {
    width: 100%;
}

/* Every screenshot comes in both themes and shows the one that matches the page. */
.shot .dark,
:root[data-theme="dark"] .shot .light {
    display: none;
}

:root[data-theme="dark"] .shot .dark {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .shot .light {
        display: none;
    }

    :root:not([data-theme]) .shot .dark {
        display: block;
    }
}

.hero-shot .shot {
    margin: 0 -1.4%;
}

/* Highlights strip */

.highlights {
    padding: 56px 0 24px;
}

.highlights ul {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--border);
    overflow: hidden;
}

.highlights li {
    padding: 24px;
    background: var(--bg);
}

.highlights strong {
    display: block;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.highlights span {
    display: block;
    margin-top: 4px;
    color: var(--fg-muted);
    font-size: 15px;
    line-height: 1.5;
}

/* Sections */

.section {
    padding: 104px 0;
}

.section-alt {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-head {
    max-width: 720px;
    margin: 0 auto 56px;
    text-align: center;
}

.kicker {
    display: block;
    margin-bottom: 12px;
    color: var(--accent-text);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.section h2 {
    font-size: clamp(30px, 4.2vw, 44px);
    letter-spacing: -0.03em;
}

.section-head p {
    margin-top: 16px;
    color: var(--fg-muted);
    font-size: 18px;
}

/* Files section: text next to two code panels */

.files {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 56px;
    align-items: center;
}

.files .copy h2 {
    font-size: clamp(30px, 4.2vw, 44px);
}

.files .copy p {
    margin-top: 20px;
    color: var(--fg-muted);
    font-size: 18px;
}

.checks {
    display: grid;
    gap: 12px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.checks li {
    position: relative;
    padding-left: 30px;
    color: var(--fg);
}

.checks li::before,
.checks li::after {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.checks li::before {
    background: var(--success-subtle);
}

/* The tick is a mask, so it takes the theme's success color. */
.checks li::after {
    background: var(--success);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / 20px no-repeat;
}

.code-stack {
    display: grid;
    gap: 16px;
}

.code {
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--raised);
    box-shadow:
        0 1px 2px rgba(16, 18, 40, 0.04),
        0 12px 32px -12px rgba(16, 18, 40, 0.14);
    overflow: hidden;
}

.code-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--fg-muted);
    font-family: var(--mono);
    font-size: 13px;
}

.code-title .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-strong);
    box-shadow:
        16px 0 0 var(--border-strong),
        32px 0 0 var(--border-strong);
    margin-right: 36px;
}

.code pre {
    margin: 0;
    padding: 16px 20px;
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--fg);
    tab-size: 2;
}

.code .m-get {
    color: var(--success);
    font-weight: 600;
}

.code .var {
    color: var(--accent-text);
    background: var(--accent-subtle);
    border-radius: 3px;
}

.code .hd {
    color: var(--syn-key);
}

.code .sec {
    color: var(--m-patch);
    font-weight: 500;
}

.code .str {
    color: var(--syn-str);
}

.code .num {
    color: var(--syn-num);
}

.code .cm {
    color: var(--fg-subtle);
}

.code .fn {
    color: var(--info);
}

.diff .add,
.diff .del,
.diff .ctx {
    display: block;
    margin: 0 -20px;
    padding: 0 20px;
}

.diff .add {
    background: var(--success-subtle);
    color: var(--success);
}

.diff .del {
    background: var(--danger-subtle);
    color: var(--danger);
}

.diff .ctx {
    color: var(--fg-muted);
}

/* Feature rows */

.features {
    display: grid;
    gap: 120px;
}

.feature {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 24px 56px;
    align-items: start;
}

.feature .copy {
    display: contents;
}

.feature h3 {
    font-size: clamp(26px, 3vw, 34px);
    letter-spacing: -0.025em;
}

.feature .text p {
    color: var(--fg-muted);
    font-size: 17px;
}

.feature .text .checks {
    margin-top: 20px;
    font-size: 16px;
}

.feature .shot {
    grid-column: 1 / -1;
    margin: 16px -1.4% 0;
}

/* Light and dark side by side: the dark screenshot sits on top of the light one, cut on a
   diagonal, whatever theme the page uses. */
.themes {
    position: relative;
    display: grid;
    margin: 0 -1.4%;
}

.themes img {
    grid-area: 1 / 1;
    width: 100%;
}

.themes .dark {
    clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%);
}

.themes-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    color: var(--fg-muted);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.themes-note {
    margin-top: 32px;
    color: var(--fg-muted);
    text-align: center;
}

/* Grid of small capabilities */

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--raised);
    transition:
        border-color 0.15s,
        transform 0.15s;
}

.card:hover {
    border-color: var(--border-strong);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    background: var(--accent-subtle);
    color: var(--accent-text);
    font-family: var(--mono);
    font-size: 12.5px;
    font-weight: 600;
}

.card h3 {
    margin-top: 16px;
    font-size: 18px;
    letter-spacing: -0.01em;
}

.card p {
    margin-top: 8px;
    color: var(--fg-muted);
    font-size: 15px;
    line-height: 1.55;
}

/* Call to action */

.cta {
    padding: 104px 0 112px;
    text-align: center;
}

.cta-box {
    position: relative;
    padding: 72px 32px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background:
        radial-gradient(ellipse 60% 80% at 50% 0%, var(--glow), transparent 70%),
        var(--surface);
    overflow: hidden;
}

.cta-box img {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    border-radius: 18px;
    box-shadow: 0 10px 30px -8px var(--glow);
}

.cta h2 {
    font-size: clamp(30px, 4.2vw, 44px);
    letter-spacing: -0.03em;
}

.cta p {
    max-width: 560px;
    margin: 16px auto 0;
    color: var(--fg-muted);
    font-size: 18px;
}

/* Footer */

.site-footer {
    padding: 32px 0 48px;
    border-top: 1px solid var(--border);
    color: var(--fg-subtle);
    font-size: 14px;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.site-footer a {
    color: var(--fg-muted);
}

/* Install page */

.page-head {
    padding: 80px 0 48px;
    text-align: center;
}

.page-head h1 {
    font-size: clamp(36px, 5.4vw, 56px);
    letter-spacing: -0.035em;
}

.page-head p {
    max-width: 620px;
    margin: 20px auto 0;
    color: var(--fg-muted);
    font-size: 18px;
}

.downloads {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.download {
    display: flex;
    flex-direction: column;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--raised);
}

.download svg.os {
    width: 32px;
    height: 32px;
    fill: var(--fg);
}

.download h2 {
    margin-top: 16px;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.download p {
    flex: 1;
    margin-top: 6px;
    color: var(--fg-muted);
    font-size: 15px;
}

.download .btn {
    margin-top: 24px;
}

.download .alt {
    margin-top: 12px;
    font-size: 14px;
    color: var(--fg-subtle);
}

.channels {
    display: grid;
    gap: 16px;
    max-width: 880px;
    margin: 0 auto;
}

.channel {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--raised);
}

.channel h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    font-size: 20px;
    letter-spacing: -0.015em;
}

.channel h3 small {
    color: var(--fg-subtle);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
}

.channel p {
    margin-top: 8px;
    color: var(--fg-muted);
    font-size: 15px;
}

.channel .code {
    margin-top: 16px;
    border-radius: var(--r-lg);
    box-shadow: none;
}

.channel .code pre {
    font-size: 13px;
}

.channel .code pre .prompt {
    color: var(--fg-subtle);
    user-select: none;
}

.note {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    font-size: 14px;
}

.note strong {
    color: var(--fg);
}

/* Responsive */

@media (max-width: 980px) {
    .files,
    .feature {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .feature {
        gap: 16px;
    }

    .feature .shot {
        margin-top: 16px;
    }

    .features {
        gap: 88px;
    }

    .highlights ul {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .downloads {
        grid-template-columns: minmax(0, 1fr);
        max-width: 560px;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 16px;
    }

    .site-header .wrap {
        gap: 12px;
    }

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

    .theme-toggle {
        margin-left: 0;
    }

    .nav .nav-github span,
    .nav .nav-wide {
        display: none;
    }

    .hero {
        padding-top: 56px;
    }

    .actions .btn {
        flex: 1 1 100%;
    }

    .section,
    .cta {
        padding: 72px 0;
    }

    .section-head {
        margin-bottom: 40px;
    }

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

    .code pre {
        font-size: 12.5px;
        padding: 14px 16px;
    }

    .diff .add,
    .diff .del,
    .diff .ctx {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .cta-box {
        padding: 56px 20px;
    }

    .channel,
    .download {
        padding: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
    }
}
