/*
 * ScreenCraft website styles.
 * Tokens mirror the app's design system (DesignSystem.swift, asset-catalog
 * colors, DesignSystem+Shadows.swift). Light appearance only.
 */

:root {
    /* Surfaces (paper* asset colors, light appearance) */
    --paper-manila: #E6DBC3;
    --paper-cream: #F4EDDB;
    --paper-white: #FBF8EF;
    --paper-shadow: #D8C9A6;
    --edge-on-cream: #E2D6BB;
    --edge-sunken: #C2B189;

    /* Ink */
    --ink: #2C2722;
    --ink-soft: #5B5249;
    --ink-faint: #8A7E6F;
    --ink-invert: #FBF8EF;

    /* Construction hues */
    --green: #57A14F;
    --green-deep: #3C7E3C;
    --green-soft: #A9C79F;
    --green-soft-edge: #7EA478;
    --yellow: #F2BE38;
    --yellow-deep: #D9A93B;
    --red: #D54B3B;
    --teal: #2E9AAE;
    --blue: #3F6FB2;
    --purple: #7A55AC;
    --orange: #E67E33;

    /* Spacing (4 pt grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Radii + borders */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 32px;
    --radius-pill: 999px;
    --border-thin: 1.5px;
    --border-med: 2.5px;

    /* Shadows, two layers: hard contact edge + soft warm cast.
       SwiftUI shadow radius r ≈ CSS blur 2r. */
    --shadow-flat:
        1px 1px 0 rgba(44, 39, 34, 0.08),
        1px 2px 4px rgba(40, 28, 18, 0.22);
    --shadow-paper:
        1px 2px 0 rgba(44, 39, 34, 0.10),
        2px 4px 8px rgba(40, 28, 18, 0.30);
    --shadow-lifted:
        2px 3px 0 rgba(44, 39, 34, 0.10),
        4px 6px 10px rgba(40, 28, 18, 0.34);

    --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont,
        "Segoe UI", system-ui, sans-serif;

    --content-width: 1040px;
    --prose-width: 720px;
}

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

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

body {
    margin: 0;
    background-color: var(--paper-manila);
    color: var(--ink);
    font-family: var(--font-rounded);
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Paper grain (GrainOverlay: multiply, 10%) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.10;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * {
    position: relative;
    z-index: 1;
}

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

a {
    color: var(--green-deep);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

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

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

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 var(--space-3);
    letter-spacing: -0.01em;
}

h1 { font-size: clamp(40px, 7vw, 64px); }
h2 { font-size: clamp(28px, 4vw, 38px); }
h3 { font-size: 21px; }

p { margin: 0 0 var(--space-4); }

.wrap {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--space-5);
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -100px;
    z-index: 10;
}

.skip-link:focus {
    top: var(--space-4);
}

/* ---------- Header ---------- */

.site-header {
    padding: var(--space-5) 0;
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 21px;
}

.brand img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-flat);
}

.site-nav {
    display: flex;
    gap: var(--space-5);
    font-weight: 600;
    font-size: 15px;
}

.site-nav a {
    color: var(--ink-soft);
    text-decoration: none;
}

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

/* ---------- Paper card (PaperCard) ---------- */

.card {
    background: var(--paper-white);
    border: var(--border-med) solid var(--edge-on-cream);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-lifted);
}

.card--cream {
    background: var(--paper-cream);
    box-shadow: var(--shadow-paper);
}

.card--green {
    background: var(--green);
    border-color: var(--green-deep);
    color: var(--ink-invert);
    box-shadow: var(--shadow-paper);
}

.card--green a { color: var(--ink-invert); }

/* ---------- Pill chip / eyebrow ---------- */

.eyebrow {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: var(--space-2);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--paper-white);
    border: var(--border-med) solid var(--edge-on-cream);
    box-shadow: var(--shadow-flat);
    font-weight: 700;
    font-size: 15px;
    color: var(--ink-soft);
}

.chip .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--yellow);
    border: var(--border-thin) solid var(--yellow-deep);
}

/* ---------- Paper button (PaperButton) ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 12px 22px;
    border-radius: var(--radius-pill);
    border: var(--border-med) solid var(--green-deep);
    background: var(--green);
    color: var(--ink-invert);
    font: inherit;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-paper);
    transition: transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.button:hover { color: var(--ink-invert); }

.button:active { transform: translateY(3px); }

.button--neutral {
    background: var(--paper-white);
    border-color: var(--edge-on-cream);
    color: var(--ink);
}

.button--neutral:hover { color: var(--ink); }

.button--sm {
    padding: 8px 16px;
    font-size: 15px;
}

.button[disabled] {
    opacity: 0.5;
    cursor: default;
}

/* ---------- Hero ---------- */

.hero {
    padding: var(--space-10) 0 var(--space-12);
}

.hero .wrap {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: var(--space-10);
    align-items: center;
}

.hero-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    box-shadow: var(--shadow-lifted);
    margin-bottom: var(--space-6);
}

.hero .subtitle {
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 600;
    color: var(--green-deep);
    margin-bottom: var(--space-4);
}

.hero .lede {
    font-size: 19px;
    color: var(--ink-soft);
    max-width: 30em;
    margin-bottom: var(--space-6);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

/* ---------- Phone bezel around the hero screenshot ----------
   The screenshot (simctl --mask=alpha) has rounded screen corners with a
   feathered alpha edge, radius ~146 px at 920 px wide. The image is clipped
   at a slightly larger radius so the feather never shows over the dark
   bezel, and the bezel radius is screen radius + padding so the band stays
   an even width around the corner. */

.phone {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    padding: 12px;
    border-radius: 60px;
    background: var(--ink);
    box-shadow: var(--shadow-lifted);
}

.phone img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 48px;
}

/* ---------- Sections ---------- */

.section {
    padding: var(--space-12) 0;
}

.section-head {
    max-width: 640px;
    margin-bottom: var(--space-8);
}

.section-head p {
    color: var(--ink-soft);
    font-size: 19px;
}

.grid {
    display: grid;
    gap: var(--space-5);
}

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

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: var(--space-4);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink-invert);
    box-shadow: var(--shadow-flat);
}

.step-number--green { background: var(--green); border: var(--border-med) solid var(--green-deep); }
.step-number--red { background: var(--red); border: var(--border-med) solid #A8372A; }
.step-number--orange { background: var(--orange); border: var(--border-med) solid #B35F22; }
.step-number--yellow { background: var(--yellow); border: var(--border-med) solid var(--yellow-deep); color: var(--ink); }

.card p:last-child { margin-bottom: 0; }

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

/* Feature lists */

.feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.feature-list li {
    position: relative;
    padding: var(--space-2) 0 var(--space-2) 32px;
}

.feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 13px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--green-soft);
    border: var(--border-thin) solid var(--green-soft-edge);
}

.feature-list li::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 17px;
    width: 5px;
    height: 9px;
    border: solid var(--green-deep);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.feature-list strong { display: block; }

.feature-list span { color: var(--ink-soft); font-size: 15px; }

.card--green .feature-list li::before {
    background: var(--paper-white);
    border-color: var(--green-deep);
}

.card--green .feature-list span { color: var(--ink-invert); opacity: 0.9; }

.plan-tag {
    display: inline-block;
    padding: 2px 12px;
    border-radius: var(--radius-pill);
    background: var(--yellow);
    border: var(--border-thin) solid var(--yellow-deep);
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: var(--space-3);
}

/* Privacy promise */

.promise {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-6);
    align-items: center;
}

.promise-badge {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper-white);
    border: var(--border-med) solid var(--green-deep);
    box-shadow: var(--shadow-flat);
}

.promise-badge svg { width: 34px; height: 34px; }

.promise h2 { margin-bottom: var(--space-2); }

.promise p { font-size: 19px; }

/* ---------- Contact form ---------- */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.field { display: flex; flex-direction: column; gap: var(--space-2); }

.field--full { grid-column: 1 / -1; }

.field label {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink-soft);
}

.field input,
.field textarea {
    font: inherit;
    color: var(--ink);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: var(--border-med) solid var(--edge-sunken);
    background: var(--paper-cream);
    box-shadow: inset 0 4px 6px -4px rgba(40, 28, 18, 0.28);
}

.field textarea { min-height: 140px; resize: vertical; }

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--green-deep);
    background: var(--paper-white);
}

.honeypot { display: none; }

.captcha { min-height: 65px; }

.captcha[hidden] { display: none; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-5);
}

.form-status {
    margin: 0;
    font-weight: 600;
}

.form-status.is-success { color: var(--green-deep); }
.form-status.is-error { color: var(--red); }

.form-note {
    font-size: 14px;
    color: var(--ink-faint);
    margin: var(--space-4) 0 0;
}

/* ---------- Legal pages ---------- */

.legal {
    padding: var(--space-6) 0 var(--space-12);
}

.legal .card {
    max-width: var(--prose-width);
    margin: 0 auto;
    padding: var(--space-10) var(--space-8);
}

.legal h1 { font-size: clamp(34px, 5vw, 46px); }

.legal .updated {
    color: var(--ink-faint);
    font-weight: 600;
    margin-bottom: var(--space-8);
}

.legal h2 {
    font-size: 24px;
    margin-top: var(--space-10);
}

.legal h3 {
    font-size: 18px;
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
}

.legal ul { padding-left: 1.3em; margin: 0 0 var(--space-4); }

.legal li { margin-bottom: var(--space-2); }

.legal .summary {
    background: var(--paper-cream);
    border: var(--border-med) solid var(--edge-on-cream);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.legal .summary ul { margin-bottom: 0; }

.legal .caps { text-transform: uppercase; font-size: 15px; }

.table-scroll { overflow-x: auto; margin-bottom: var(--space-4); }

.legal table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.legal th,
.legal td {
    text-align: left;
    vertical-align: top;
    padding: var(--space-3);
    border-bottom: var(--border-thin) solid var(--edge-on-cream);
}

.legal th { color: var(--ink-soft); font-weight: 700; }

/* ---------- Footer ---------- */

.site-footer {
    padding: var(--space-10) 0 var(--space-12);
    color: var(--ink-soft);
    font-size: 15px;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-4);
    border-top: var(--border-med) solid var(--paper-shadow);
    padding-top: var(--space-6);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
}

.footer-links a,
.link-button {
    color: var(--ink-soft);
    font-weight: 600;
    text-decoration: none;
}

.footer-links a:hover,
.link-button:hover {
    color: var(--ink);
}

.link-button {
    font: inherit;
    font-weight: 600;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* ---------- Consent banner ---------- */

.consent {
    position: fixed;
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
    z-index: 20;
    max-width: 560px;
    margin: 0 auto;
}

.consent[hidden] { display: none; }

.consent .card { padding: var(--space-5); }

.consent p { font-size: 15px; color: var(--ink-soft); margin-bottom: var(--space-4); }

.consent .consent-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    .hero .wrap { grid-template-columns: 1fr; }
    .hero { padding-top: var(--space-6); }
    .phone { max-width: 260px; padding: 10px; border-radius: 49px; }
    .phone img { border-radius: 39px; }
    .grid--3,
    .grid--2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .promise { grid-template-columns: 1fr; }
    .legal .card { padding: var(--space-8) var(--space-5); }
    .site-nav { gap: var(--space-4); }
}

@media (max-width: 520px) {
    .grid--4 { grid-template-columns: 1fr; }
    .site-nav .nav-optional { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .button { transition: none; }
    .button:active { transform: none; }
}
