/* ========================================
   Rhode-Inspired Design System
   ======================================== */

:root {
    /* Color Tokens */
    --bg: #EFEDE7;
    --paper: #F7F5F0;
    --ink: #2F2F2F;
    --muted: #666;
    --line: #E3E0DA;
    --accent: #6B6B6B;
    --accent-press: #4A4A4A;
    --ok: #1A7F5A;
    --low: #C89B3C;
    --med: #C15E19;
    --high: #B3332F;
    
    /* Typography */
    --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-base: 18px;
    --line-height-base: 1.7;
    
    /* Spacing */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 40px;
    --space-xl: 60px;
    --space-xxl: 80px;
    
    /* Layout */
    --max-width: 980px;
    
    /* Effects */
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Reset & Base Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Visually Hidden (Accessibility) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Header
   ======================================== */

.site-header {
    position: sticky;
    top: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-md) var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--ink);
    text-decoration: none;
    transition: opacity var(--transition);
}

.brand:hover {
    opacity: 0.7;
}

.header-nav {
    display: flex;
    gap: var(--space-md);
}

.header-nav a {
    font-size: 16px;
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}

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

/* ========================================
   Hero Section
   ======================================== */

.hero {
    background: var(--paper);
    padding: var(--space-xxl) var(--space-md);
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.hero-inner {
    max-width: 760px;
    margin: 0 auto;
}

.hero-title {
    font-size: 96px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--ink);
    margin-bottom: var(--space-md);
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--muted);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.hero-cta {
    margin-top: var(--space-sm);
}

/* ========================================
   Form Section
   ======================================== */

.form-section {
    padding: var(--space-xxl) var(--space-md);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
}

.form-wrapper {
    max-width: 680px;
    margin: 0 auto;
}

/* URL Import Section */
.url-import-section {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--line);
}

.url-input-group {
    display: flex;
    gap: var(--space-sm);
    align-items: stretch;
}

.url-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-base);
    font-size: 15px;
    color: var(--ink);
    transition: all var(--transition);
}

.url-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(107, 107, 107, 0.1);
}

.url-input::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

.form-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.01em;
}

.form-textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: var(--font-base);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    resize: vertical;
    transition: all var(--transition);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.form-textarea::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

.input-helper {
    margin-top: var(--space-xs);
    margin-bottom: var(--space-md);
    font-size: 14px;
    color: var(--muted);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-block;
    padding: 16px 40px;
    font-family: var(--font-base);
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all var(--transition);
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-press);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 12px 24px;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--accent);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    font-size: 16px;
}

/* ========================================
   Results Section
   ======================================== */

.results-section {
    padding: var(--space-xxl) var(--space-md);
    background: var(--paper);
    border-top: 1px solid var(--line);
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-summary {
    margin-bottom: var(--space-xl);
    text-align: center;
}

.product-name-display {
    background: white;
    padding: var(--space-md) var(--space-lg);
    border-radius: 12px;
    margin-bottom: var(--space-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-subtle);
}

.product-name-label {
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    font-weight: 500;
}

.product-name-value {
    font-size: 22px;
    color: var(--ink);
    font-weight: 500;
    line-height: 1.4;
}

.status-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-radius: 12px;
    background: white;
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-md);
}

.badge-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.badge-value {
    font-size: 32px;
    font-weight: 700;
}

.badge-ok .badge-value {
    color: var(--ok);
}

.badge-low .badge-value {
    color: var(--low);
}

.badge-med .badge-value {
    color: var(--med);
}

.badge-high .badge-value {
    color: var(--high);
}

.status-message {
    font-size: 18px;
    color: var(--muted);
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   Results Grid
   ======================================== */

.results-grid {
    display: grid;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.friendly-message {
    padding: var(--space-md) var(--space-lg);
    border-radius: 12px;
    margin-bottom: var(--space-lg);
    font-size: 17px;
    line-height: 1.6;
    text-align: center;
    box-shadow: var(--shadow-subtle);
}

.message-high {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.message-medium {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

.message-safe {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.ingredient-card {
    background: white;
    padding: var(--space-md);
    border-radius: 8px;
    border-left: 4px solid;
    box-shadow: var(--shadow-subtle);
    transition: all var(--transition);
}

.ingredient-card:hover {
    box-shadow: var(--shadow-card);
    transform: translateX(2px);
}

.border-ok {
    border-left-color: var(--ok);
}

.border-low {
    border-left-color: var(--low);
}

.border-med {
    border-left-color: var(--high);
    border-left-width: 6px;
    background: #FEE2E2;
}

.border-high {
    border-left-color: var(--high);
    border-left-width: 6px;
    background: #FEE2E2;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--space-xs);
}

.border-med .card-title,
.border-high .card-title {
    color: var(--high);
    font-weight: 700;
}

.card-meta {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: var(--space-sm);
    text-transform: lowercase;
}

.card-meta-item {
    display: inline-block;
}

.card-note {
    font-size: 16px;
    color: var(--ink);
    line-height: 1.6;
}

.results-disclaimer {
    padding: var(--space-md);
    background: var(--bg);
    border-radius: 8px;
    font-size: 15px;
    color: var(--muted);
    line-height: 1.6;
    text-align: center;
}

.severity-disclaimer {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 16px;
    text-align: center;
}

/* ========================================
   Error Messages
   ======================================== */

.error-message {
    max-width: 680px;
    margin: var(--space-md) auto;
    padding: var(--space-md);
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    color: #991B1B;
    font-size: 16px;
}

/* ========================================
   Footer
   ======================================== */

.site-footer {
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: var(--space-xxl) var(--space-md) var(--space-lg);
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.footer-columns {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.footer-brand {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--ink);
    margin-bottom: var(--space-sm);
}

.footer-mission {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.6;
}

.footer-heading {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
    margin-bottom: var(--space-sm);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-xs);
}

.footer-links a {
    font-size: 15px;
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}

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

.footer-legal {
    padding-top: var(--space-md);
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.footer-legal a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}

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

.legal-sep {
    margin: 0 var(--space-xs);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 900px) {
    :root {
        --font-size-base: 17px;
    }
    
    .hero-title {
        font-size: 72px;
    }
    
    .footer-columns {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }
    
    .footer-col:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    :root {
        --font-size-base: 16px;
        --space-md: 20px;
        --space-lg: 32px;
        --space-xl: 48px;
        --space-xxl: 64px;
    }
    
    .header-inner {
        padding: var(--space-sm) var(--space-md);
    }
    
    .header-nav {
        gap: var(--space-sm);
    }
    
    .header-nav a {
        font-size: 14px;
    }
    
    .hero {
        padding: var(--space-xl) var(--space-md);
    }
    
    .hero-title {
        font-size: 48px;
    }
    
    .hero-subtitle {
        font-size: 17px;
    }
    
    .form-section {
        padding: var(--space-xl) var(--space-md);
    }
    
    .results-section {
        padding: var(--space-xl) var(--space-md);
    }
    
    .btn-primary {
        width: 100%;
    }
    
    .url-input-group {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
    }
    
    .footer-columns {
        grid-template-columns: 1fr;
    }
    
    .footer-col:first-child {
        grid-column: auto;
    }
}

@media (min-width: 601px) {
    .btn-primary {
        width: 280px;
    }
}

/* ========================================
   Loading States
   ======================================== */

[aria-busy="true"] {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
