/* Double parking – modern design, 8px spacing scale, security-hardened */

:root {
    /* Spacing scale (8px base) */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */

    /* Type scale */
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;

    /* Colours */
    --bg: #e8eef4;
    --bg-gradient-start: #1e3a5f;
    --bg-gradient-end: #2d5a87;
    --surface: #fff;
    --surface-alpha: rgba(255, 255, 255, 0.96);
    --text: #1a1a1a;
    --text-muted: #475569;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-focus: #3b82f6;
    --secondary: #64748b;
    --secondary-hover: #475569;
    --error: #b91c1c;
    --notice-bg: #fef3c7;
    --border: #e2e8f0;

    /* Radii */
    --radius: 12px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.1);

    /* Touch target minimum (WCAG) */
    --touch-min: 48px;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--text-lg);
    line-height: 1.5;
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    background-image: linear-gradient(165deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 40%, #3d7ab5 100%);
    background-attachment: fixed;
    padding: var(--space-4);
    padding-left: max(var(--space-4), env(safe-area-inset-left));
    padding-right: max(var(--space-4), env(safe-area-inset-right));
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    padding-top: max(var(--space-4), env(safe-area-inset-top));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

main {
    max-width: 28rem;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Home hero */
.home .hero {
    text-align: center;
    margin-bottom: var(--space-8);
}

.home .hero-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto var(--space-4);
    color: rgba(255, 255, 255, 0.9);
}

.home .hero-icon svg {
    width: 100%;
    height: 100%;
}

.home h1 {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: var(--space-2);
}

.home .lead {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}

/* Action cards (home) */
.action-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.action-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: var(--touch-min);
    padding: var(--space-5) var(--space-6);
    text-align: left;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    -webkit-tap-highlight-color: transparent;
}

.action-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon svg {
    width: 100%;
    height: 100%;
}

.action-label {
    flex: 1;
}

/* Cards (forms, results) */
.card {
    background: var(--surface-alpha);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-6);
}

.card:last-of-type {
    margin-bottom: var(--space-4);
}

/* Headings */
h1 {
    font-size: var(--text-2xl);
    margin: 0 0 var(--space-2);
    font-weight: 700;
}

.form-page h1,
.success-page h1 {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.lead {
    margin: 0 0 var(--space-6);
    color: var(--text-muted);
    font-size: var(--text-base);
}

.form-page .lead,
.success-page .lead {
    color: rgba(255, 255, 255, 0.9);
}

.form-page .lead {
    margin-bottom: var(--space-4);
}

/* Buttons and links – touch-friendly */
.actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.actions a,
.actions button {
    display: block;
    width: 100%;
    min-height: var(--touch-min);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-lg);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    box-shadow: var(--shadow);
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid var(--primary-focus);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

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

/* Form fields */
.card label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text);
    font-size: var(--text-base);
}

.card label + input,
.card input + label {
    margin-top: 0;
}

.card input[type="text"],
.card input[type="tel"] {
    margin-bottom: var(--space-4);
}

.card input[type="hidden"] + .btn,
.card button[type="submit"] {
    margin-top: var(--space-2);
    margin-bottom: 0;
}

.card input:last-of-type {
    margin-bottom: 0;
}

input[type="text"],
input[type="tel"] {
    width: 100%;
    min-height: var(--touch-min);
    padding: var(--space-3) var(--space-4);
    font-size: 16px; /* prevents zoom on focus on iOS */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:hover {
    border-color: #cbd5e1;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

input:focus-visible {
    outline: none;
}

/* Messages */
.error {
    color: var(--error);
    margin-bottom: var(--space-4);
    font-weight: 500;
    font-size: var(--text-base);
}

.notice {
    padding: var(--space-4);
    background: var(--notice-bg);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    font-size: var(--text-base);
}

/* Lookup result */
.lookup-result {
    margin-top: var(--space-4);
}

.lookup-result h2 {
    font-size: var(--text-xl);
    margin: 0 0 var(--space-2);
    font-weight: 600;
}

.lookup-result .phone-masked {
    margin: 0 0 var(--space-4);
    font-size: var(--text-lg);
}

.lookup-result .actions {
    display: flex;
    gap: var(--space-3);
}

.lookup-result .actions .btn {
    flex: 1;
}

p + .card,
.error + .card,
.error + form {
    margin-top: var(--space-2);
}

/* Back link – touch-friendly */
a[href="/"] {
    display: inline-block;
    min-height: var(--touch-min);
    line-height: var(--touch-min);
    padding: 0 var(--space-2) 0 0;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: var(--text-base);
}

a[href="/"]:hover,
a[href="/"]:focus {
    text-decoration: underline;
}

a[href="/"]:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.success-page .card {
    margin-top: var(--space-4);
}

.success-page p + p {
    margin-top: var(--space-4);
}

/* Form / success page footer spacing */
.form-page > p:last-child,
.success-page > p:last-child {
    margin-top: var(--space-6);
}
