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

html {
    font-size: var(--text);
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;

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

body {
    margin: 0;
    background: var(--linen);
    color: var(--ink);
    font-family: var(--font);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

h1 {
    font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem);
    letter-spacing: -0.025em;
}

h2 {
    font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.15rem);
}

h3 {
    font-size: 1.05rem;
}

p {
    margin: 0;
}

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

:focus-visible {
    outline: 2px solid var(--fjord);
    outline-offset: 2px;
    border-radius: var(--radius-small);
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    padding: 0.5rem 1rem;
    background: var(--paper);
    border-radius: var(--radius-small);
    z-index: 10;

    &:focus {
        top: 1rem;
    }
}

.eyebrow {
    color: var(--bark);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.lead,
.section-lead {
    color: var(--ink-soft);
    font-size: 1.1rem;
    max-width: var(--measure);
}

.section-lead {
    margin-top: 1rem;
}

.meta {
    color: var(--quiet);
    font-size: 0.8rem;
}

/* Buttons: one primary action per screen region, everything else ghost. */
.button {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius-small);
    border: 1px solid transparent;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;

    &.primary {
        background: var(--bark-fill);
        color: var(--on-bark);

        &:hover {
            background: color-mix(in srgb, var(--bark-fill) 88%, black);
        }
    }

    &.ghost {
        color: var(--ink);
        border-color: var(--line-strong);

        &:hover {
            background: var(--sand);
        }
    }
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: var(--tone-soft);
    color: var(--tone);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Surfaces: the page is linen, panels and cards sit on it with a soft shadow. */
.panel,
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--head);
    border-bottom: 1px solid var(--line);
    box-shadow: inset 0 1px 0 var(--shine);
}

.panel-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.card {
    padding: 1.25rem 1.25rem 1.4rem;

    h3 {
        margin-bottom: 0.5rem;
    }

    p {
        color: var(--ink-soft);
        font-size: 0.95rem;
    }
}

/*
 * A kiwi peeking over the top edge of a card. It sits behind the card and is sunk into it, so the
 * card hides everything below the kiwi's shoulders. Size, tilt and how deep it sinks are tuned per
 * pose with the custom properties; the SVG scales cleanly to any of them.
 */
.peek {
    position: relative;
    isolation: isolate;
}

.peeking-kiwi {
    position: absolute;
    z-index: -1;
    bottom: 100%;
    inset-inline-end: var(--peek-inset, 2rem);
    width: var(--peek-size, 8rem);
    height: auto;
    translate: 0 var(--peek-sink, 45%);
    rotate: var(--peek-tilt, 5deg);
    pointer-events: none;

    &.from-start {
        inset-inline: var(--peek-inset, 2rem) auto;
        rotate: calc(-1 * var(--peek-tilt, 5deg));
    }

    /* A pose with props beside the kiwi is cropped to the kiwi itself. */
    &.cropped {
        aspect-ratio: 1;
        object-fit: cover;
        object-position: var(--peek-focus, left) top;
    }

    /* In one column the space above a card is the text before it, which the kiwi would cover. */
    @media (width < 48rem) {
        display: none;
    }
}

.notice {
    padding: 1rem 1.25rem;
    background: var(--tone-soft);
    border-left: 3px solid var(--tone);
    border-radius: var(--radius-small);

    h3 {
        margin-bottom: 0.35rem;
    }

    p {
        color: var(--ink-soft);
        max-width: var(--measure);
    }
}

.check-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;

    li {
        position: relative;
        padding-left: 1.6rem;
        color: var(--ink-soft);

        &::before {
            content: '';
            position: absolute;
            left: 0.15rem;
            top: 0.45em;
            width: 0.45rem;
            height: 0.8rem;
            border: solid var(--moss);
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }
    }
}

/* Header */
.site-header {
    background: color-mix(in srgb, var(--frame) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    max-width: var(--page);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.brand-logo {
    width: 2.75rem;
    height: 2.75rem;
    margin-block: -0.4rem;
}

/* Reserves the header's height before the shared script renders it, so the page does not jump. */
kp-site-header {
    display: block;
    min-height: 3.6rem;
    position: sticky;
    top: 0;
    z-index: 5;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;

    a {
        color: var(--ink-soft);
        text-decoration: none;
        font-size: 0.9rem;
        font-weight: 500;

        &:hover {
            color: var(--bark);
        }

        &[aria-current] {
            color: var(--bark);
            font-weight: 600;
        }
    }

    @media (width < 48rem) {
        display: none;
    }
}

.nav-menu-button {
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    anchor-name: --persona-menu;

    &:hover,
    &[aria-current] {
        color: var(--bark);
    }

    &.compact-only {
        display: none;
        padding: 0.35rem 0.85rem;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius-small);
        anchor-name: --compact-menu;

        @media (width < 48rem) {
            display: inline-block;
        }
    }
}

/* Menus open as native popovers under the button that opened them. */
.menu {
    margin: 0;
    padding: 0.4rem;
    list-style: none;
    min-width: 15rem;
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position-area: bottom span-left;
    margin-top: 0.6rem;

    a {
        display: block;
        padding: 0.5rem 0.75rem;
        border-radius: var(--radius-small);
        color: var(--ink);
        text-decoration: none;

        &:hover {
            background: var(--sand);
        }

        &[aria-current] {
            background: var(--bark-soft);
            color: var(--bark);
        }
    }
}

.persona-menu {
    position-anchor: --persona-menu;
    position-area: bottom span-right;
}

.compact-menu {
    position-anchor: --compact-menu;
}

.persona-label {
    display: block;
    font-weight: 600;
}

.persona-summary {
    display: block;
    color: var(--quiet);
    font-size: 0.8rem;
}

.menu-heading {
    padding: 0.6rem 0.75rem 0.2rem;
    color: var(--bark);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;

    &:empty {
        padding: 0;
        margin: 0.35rem 0;
        border-top: 1px solid var(--line);
    }
}

/* Sections share one column width and rhythm. */
main > section {
    max-width: var(--page);
    margin: 0 auto;
    padding: 5rem 1.5rem;

    @media (width < 48rem) {
        padding-block: 3.5rem;
    }
}

main > section + section {
    border-top: 1px solid var(--line);
}

/* Hero */
.hero {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 3rem;
    align-items: center;

    @media (width < 60rem) {
        grid-template-columns: 1fr;
    }

    .lead {
        margin-top: 1.5rem;
    }
}

.hero-figure {
    margin: 0;
    padding: 0.85rem;
    background: var(--frame);
    border-radius: calc(var(--radius) + 6px);

    figcaption {
        margin-top: 0.75rem;
        text-align: center;
        color: var(--quiet);
        font-size: 0.8rem;
    }
}

.behaviour-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;

    li {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 0.75rem;
        align-items: start;
        padding: 0.6rem 0.85rem;
        border-left: 3px solid var(--tone);
        margin: 0.25rem 0.5rem;
        border-radius: var(--radius-small);

        &:hover {
            background: var(--sand);
        }
    }
}

.behaviour-id {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--quiet);
    padding-top: 0.1rem;
}

.behaviour-text {
    font-size: 0.9rem;
    line-height: 1.45;
}

.trace {
    display: grid;
    gap: 0.4rem;
    padding: 0.75rem 1rem 0.9rem;
    background: var(--code-bg);
    border-top: 1px solid var(--line);
}

.trace-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--quiet);
}

.trace-chain {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;

    li {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        color: var(--ink-soft);

        & + li::before {
            content: '→';
            color: var(--fjord);
        }
    }
}

/* Problem */
.problem h2 {
    max-width: 30ch;
}

.problem-grid,
.feature-grid,
.control-grid,
.roles {
    display: grid;
    gap: var(--gap);
    margin-top: 2.5rem;
}

.problem-grid,
.control-grid,
.roles {
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.feature-grid {
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}

/* The loop */
.loop-steps {
    counter-reset: step;
    list-style: none;
    margin: 2.5rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: var(--gap);

    li {
        counter-increment: step;
        position: relative;
        padding: 1rem 1.25rem 1.25rem;
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius);

        &::before {
            content: counter(step);
            display: inline-grid;
            place-items: center;
            width: 1.75rem;
            height: 1.75rem;
            margin-bottom: 0.6rem;
            border-radius: 50%;
            background: var(--bark-soft);
            color: var(--bark);
            font-weight: 700;
            font-size: 0.85rem;
            font-variant-numeric: tabular-nums;
        }

        h3 {
            margin-bottom: 0.35rem;
        }

        p {
            color: var(--ink-soft);
            font-size: 0.9rem;
        }
    }
}

.step-where {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--quiet);
}

.role {
    padding-top: 1rem;
    border-top: 2px solid var(--bark);

    h3 {
        margin-bottom: 0.35rem;
    }

    p {
        color: var(--ink-soft);
    }
}

/* Products */
.product .product-head {
    max-width: var(--measure);
}

/* Control */
.guarantees {
    margin-top: var(--gap);

    .check-list {
        padding: 1.25rem;
        grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
        gap: 0.75rem 2rem;
    }
}

/* Regulated */
.regulated {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
    align-items: center;

    @media (width < 60rem) {
        grid-template-columns: 1fr;
    }

    .regulated-text > p {
        margin: 1rem 0 1.5rem;
        color: var(--ink-soft);
    }
}

.chain {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;

    li {
        display: grid;
        grid-template-columns: 7rem 1fr;
        gap: 1rem;
        align-items: center;
        padding: 0.85rem 1rem;
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        position: relative;

        & + li {
            margin-top: 1.5rem;

            &::before {
                content: '';
                position: absolute;
                left: 50%;
                top: -1.5rem;
                height: 1.5rem;
                border-left: 2px dashed var(--fjord);
            }
        }
    }
}

.chain-step {
    font-weight: 600;
    color: var(--bark);
}

.chain-detail {
    font-size: 0.9rem;
    color: var(--ink-soft);
}

/* Comparison */
.table-scroll {
    margin-top: 2.5rem;
    overflow-x: auto;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.comparison {
    width: 100%;
    min-width: 44rem;
    border-collapse: collapse;
    font-size: 0.95rem;

    th,
    td {
        padding: 0.85rem 1.1rem;
        text-align: left;
        vertical-align: top;
        border-bottom: 1px solid var(--line);
    }

    thead th {
        background: var(--head);
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--ink-soft);
    }

    tbody th {
        font-weight: 600;
    }

    tbody tr:last-child > * {
        border-bottom: 0;
    }

    td {
        color: var(--ink-soft);
    }

    /* The KiwiPow column is where the reader should land. */
    td:last-child,
    thead th:last-child {
        background: var(--bark-soft);
        color: var(--ink);
    }
}

/* Getting started */
.start {
    text-align: center;

    .section-lead {
        margin-inline: auto;
    }

    .actions {
        justify-content: center;
    }
}

/* Footer */
.site-footer {
    background: var(--frame);
    border-top: 1px solid var(--line);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    max-width: var(--page);
    margin: 0 auto;
    padding: 2rem 1.5rem;

    .meta {
        flex-basis: 100%;
    }
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.9rem;

    a {
        color: var(--ink-soft);
        text-decoration: none;

        &:hover {
            color: var(--bark);
        }
    }
}

/* Persona cards on the homepage: each card is the link to its page. */
.persona-cards {
    list-style: none;
    margin: 2.5rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--gap);

    .card {
        display: block;
        height: 100%;
        color: inherit;
        text-decoration: none;
        transition: border-color 0.15s;

        &:hover {
            border-color: var(--bark);
        }

        h3::after {
            content: ' →';
            color: var(--bark);
        }
    }
}

/* Persona pages */
.page-hero {
    h1 {
        max-width: 24ch;
    }

    .lead {
        margin-top: 1.5rem;
    }
}

.pains {
    margin: 2.5rem 0 0;
    display: grid;
    gap: var(--gap);

    > div {
        display: grid;
        grid-template-columns: 1fr 1fr;
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        overflow: hidden;

        @media (width < 48rem) {
            grid-template-columns: 1fr;
        }
    }

    dt,
    dd {
        margin: 0;
        padding: 1.1rem 1.25rem;
    }

    dt {
        color: var(--ink-soft);
        background: var(--sand);

        &::before {
            content: 'Today';
            display: block;
            margin-bottom: 0.3rem;
            color: var(--quiet);
            font-size: 0.7rem;
            font-weight: 600;
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }
    }

    dd::before {
        content: 'With KiwiPow';
        display: block;
        margin-bottom: 0.3rem;
        color: var(--bark);
        font-size: 0.7rem;
        font-weight: 600;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }
}

.where-you-work {
    margin-top: 2.5rem;
}

/* Pricing */
.plans {
    list-style: none;
    margin: 2.5rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: var(--gap);
}

.plan {
    display: flex;
    flex-direction: column;
    height: 100%;

    .panel-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        padding: 1rem 1.25rem;
    }

    .plan-body {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        flex: 1;
        padding: 1.25rem;
    }

    .plan-for {
        color: var(--ink-soft);
        font-size: 0.95rem;
    }

    .check-list {
        flex: 1;
        font-size: 0.95rem;
    }
}

.plan-name {
    font-size: 1.2rem;
}

.price {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;

    &.pending {
        font-size: 1rem;
        color: var(--quiet);
        font-weight: 500;
    }
}

.faq {
    margin-top: 2.5rem;
    display: grid;
    gap: 0.75rem;
    max-width: var(--measure);

    details {
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius);
        padding: 0.85rem 1.1rem;
    }

    summary {
        cursor: pointer;
        font-weight: 600;
    }

    details p {
        margin-top: 0.6rem;
        color: var(--ink-soft);
    }
}

/* Header call to action: the one primary action on every page. */
.nav-links .nav-signup,
.compact-menu .nav-signup {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-small);
    background: var(--bark-fill);
    color: var(--on-bark);
    font-weight: 600;

    &:hover,
    &[aria-current] {
        color: var(--on-bark);
        background: color-mix(in srgb, var(--bark-fill) 88%, black);
    }
}

/* Signup */
.signup-layout {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 3rem;
    align-items: start;

    @media (width < 60rem) {
        grid-template-columns: 1fr;
    }

    .check-list {
        margin-top: 1.5rem;
    }
}

kp-signup-form {
    display: block;
    padding: 1.5rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.signup-form {
    display: grid;
    gap: 1.1rem;

    input[type='email'],
    input[type='text'],
    select {
        width: 100%;
        padding: 0.55rem 0.7rem;
        font: inherit;
        color: var(--ink);
        background: var(--linen);
        border: 1px solid var(--line-strong);
        border-radius: var(--radius-small);
        transition: border-color 0.12s;

        &:focus {
            border-color: var(--fjord);
        }
    }

    .button {
        justify-self: start;
        cursor: pointer;
        font: inherit;
        font-weight: 600;

        &:disabled {
            opacity: 0.6;
            cursor: progress;
        }
    }
}

.field {
    display: grid;
    gap: 0.35rem;

    label,
    .field-label {
        font-weight: 600;
        font-size: 0.9rem;
    }
}

.optional-answers {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 1rem 1.1rem 1.1rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);

    legend {
        padding: 0 0.4rem;
        color: var(--bark);
        font-size: 0.8rem;
        font-weight: 600;
    }
}

.tool-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.35rem 1rem;
}

.field .tool-choice,
.field .other-tools {
    font-weight: 400;
}

.tool-choice,
.consent {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;

    input {
        margin-top: 0.3rem;
        accent-color: var(--bark-fill);
    }
}

.consent {
    color: var(--ink-soft);
}

.other-tools {
    margin-top: 0.5rem;
}

.field-problem {
    color: var(--lingon);
    font-size: 0.85rem;

    &:empty {
        display: none;
    }
}

.offer-preview {
    padding: 0.75rem 1rem;
    background: var(--bark-soft);
    border-radius: var(--radius-small);
    font-weight: 600;
}

/* Kept out of sight and out of the tab order; only bots fill it in. */
.trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.plan .price small {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--quiet);
}

.price-note {
    margin-top: 1.5rem;
    color: var(--quiet);
    font-size: 0.9rem;
    max-width: var(--measure);
}
