/* ============================================================================
   roboticsguy.space - Main Stylesheet
   Mobile-first responsive design with support for 320px → 1440px
   ============================================================================ */

/* === Root Variables === */
:root {
    --primary-color: #1a1a1a;
    --accent-color: #4a90e2;
    --text-color: #333;
    --text-muted: #666;
    --text-subtle: #999;
    --background-color: #fff;
    --bg-light: #f9f9f9;
    --bg-lighter: #f5f5f5;
    --border-color: #ddd;
    --border-light: #eee;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* === CSS Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
    font-size: 16px;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
}

h3 {
    font-size: 1.2rem;
}

p {
    margin-bottom: var(--spacing-md);
}

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

a:hover {
    text-decoration: underline;
}

a:focus {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
    border-radius: 2px;
}

a:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

/* === Skip Link === */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

/* === Header === */
header {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    background-color: var(--background-color);
    position: relative;
    z-index: 100;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* === Main & Layout === */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* === Hero Section === */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--background-color) 100%);
}

.hero h1 {
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
}

.hero .subheadline {
    font-size: clamp(1rem, 2vw, 1.25rem);
    max-width: 600px;
    margin: 0 auto var(--spacing-lg);
    color: var(--text-muted);
    line-height: 1.6;
}

/* === Counter Display === */
.counter-display {
    margin: var(--spacing-2xl) 0 var(--spacing-sm);
    padding: var(--spacing-lg);
    background: var(--background-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 400px;
}

#counter-display {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    color: var(--accent-color);
    display: block;
}

.counter-label {
    font-size: 1rem;
    color: var(--text-subtle);
    margin-top: var(--spacing-xs);
}

/* === Buttons === */
.cta-button,
button {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    margin: var(--spacing-sm) var(--spacing-xs);
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.cta-button:hover,
button:hover {
    background-color: #2e5bb8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    text-decoration: none;
}

.cta-button:active,
button:active {
    transform: translateY(0);
}

.cta-button:focus,
button:focus {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

.cta-button:focus-visible,
button:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

.cta-button:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--text-subtle);
}

/* === Sections === */
section {
    width: 100%;
}

section[style*="padding"] {
    background: var(--background-color);
}

/* Trust Signal Section */
section:nth-of-type(2) {
    padding: var(--spacing-2xl) var(--spacing-md);
    background: var(--bg-light);
}

section:nth-of-type(2) h2 {
    margin-bottom: var(--spacing-lg);
    color: var(--primary-color);
}

section:nth-of-type(2) > div {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

section:nth-of-type(2) > div > div {
    padding: var(--spacing-md);
}

section:nth-of-type(2) .counter-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: var(--spacing-xs);
}

section:nth-of-type(2) h3 {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
}

section:nth-of-type(2) p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Navigation Hub Section */
section:nth-of-type(3) {
    padding: var(--spacing-2xl) var(--spacing-md);
    background: var(--background-color);
}

section:nth-of-type(3) h2 {
    margin-bottom: var(--spacing-lg);
    color: var(--primary-color);
}

section:nth-of-type(3) > div {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

section:nth-of-type(3) a {
    display: block;
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-color);
    transition: all var(--transition-normal);
}

section:nth-of-type(3) a:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
    text-decoration: none;
    transform: translateY(-2px);
}

section:nth-of-type(3) h3 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
}

section:nth-of-type(3) p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* === Footer === */
footer {
    padding: var(--spacing-xl) var(--spacing-md);
    background: var(--bg-lighter);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

footer p {
    margin-bottom: var(--spacing-sm);
}

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

footer a:hover {
    text-decoration: underline;
}

footer strong {
    color: var(--primary-color);
}

/* === Utility Classes === */
.center {
    text-align: center;
}

.muted {
    color: var(--text-muted);
}

.subtle {
    color: var(--text-subtle);
}

.error {
    color: #e74c3c;
}

.success {
    color: #27ae60;
}

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

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
    body {
        font-size: 15px;
    }

    header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .logo {
        font-size: 1rem;
    }

    .hero {
        padding: var(--spacing-lg) var(--spacing-md);
        min-height: auto;
    }

    .cta-button,
    button {
        width: 100%;
        max-width: 300px;
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .counter-display {
        max-width: 100%;
        margin: var(--spacing-lg) 0 var(--spacing-sm);
    }

    section:nth-of-type(2),
    section:nth-of-type(3) {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    section:nth-of-type(2) > div,
    section:nth-of-type(3) > div {
        gap: var(--spacing-md);
    }

    footer {
        padding: var(--spacing-lg) var(--spacing-md);
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero {
        padding: var(--spacing-2xl) var(--spacing-lg);
    }

    .cta-button,
    button {
        padding: var(--spacing-md) var(--spacing-lg);
        max-width: none;
    }

    section:nth-of-type(2),
    section:nth-of-type(3) {
        padding: var(--spacing-2xl) var(--spacing-lg);
    }

    footer {
        padding: var(--spacing-xl) var(--spacing-lg);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .hero {
        padding: var(--spacing-2xl) var(--spacing-lg);
        min-height: 100vh;
    }

    .cta-button,
    button {
        padding: var(--spacing-md) var(--spacing-xl);
    }

    .counter-display {
        max-width: 450px;
    }

    section:nth-of-type(2),
    section:nth-of-type(3) {
        padding: var(--spacing-2xl) var(--spacing-lg);
    }

    section:nth-of-type(2) > div,
    section:nth-of-type(3) > div {
        gap: var(--spacing-2xl);
    }

    footer {
        padding: var(--spacing-2xl) var(--spacing-lg);
    }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    section:nth-of-type(2) > div,
    section:nth-of-type(3) > div {
        gap: var(--spacing-2xl);
    }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================================
   FORM STYLES - Hair Regrowth Multi-Step Form
   ============================================================================ */

/* Form container */
form {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

form h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: #1a1a1a;
    font-weight: 600;
}

form > p {
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.95rem;
}

/* Progress bar */
.progress-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    align-items: center;
}

.progress-segment {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.progress-segment.active {
    background: #4a90e2;
}

#step-label {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Form step visibility */
.form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.visible {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Form fields (labels, inputs, selects) */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #1a1a1a;
}

label small,
.form-step > small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #999;
    font-weight: normal;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    min-height: 44px;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

input[type="text"].error,
input[type="number"].error,
select.error,
textarea.error {
    border-color: #e74c3c;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="number"]:invalid {
    border-color: #e74c3c;
}

/* Fieldsets and legends */
fieldset {
    border: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

legend {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
}

/* Pill buttons (multi-select for gender, pattern, etc.) */
.pill-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.pill {
    padding: 0.75rem 1.25rem;
    border: 2px solid #ddd;
    background: #fff;
    color: #333;
    border-radius: 24px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pill:hover {
    border-color: #4a90e2;
    background: #f0f5ff;
}

.pill:focus {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

.pill:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}

.pill.selected {
    background: #4a90e2;
    color: #fff;
    border-color: #4a90e2;
}

.pill:active {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

/* Checkbox group styling */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.75rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
}

/* Navigation buttons */
.form-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

button[id="prev-button"],
button[id="next-button"] {
    padding: 1rem 2rem;
    font-size: 1rem;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    font-weight: 600;
}

.btn-primary {
    background: #4a90e2;
    color: #fff;
    flex: 1;
    min-width: 150px;
}

.btn-primary:hover:not(:disabled) {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    flex: 1;
    min-width: 150px;
}

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error messages */
#step-errors {
    display: none;
    background: #ffe6e6;
    border-left: 4px solid #e74c3c;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    color: #c0392b;
}

#step-errors p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}

#step-errors p:first-child {
    margin-top: 0;
}

#step-errors p:last-child {
    margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    form {
        padding: 1rem 1rem;
        margin: 0.5rem 0;
        border-radius: 0;
    }

    form h2 {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .pill-buttons {
        gap: 0.4rem;
    }

    /* Pills wrap naturally — never force full width */
    .pill {
        flex: 0 1 auto;
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
        min-height: 40px;
    }

    /* Nav buttons: side by side, Next gets more space */
    .form-nav {
        flex-direction: row;
        gap: 0.5rem;
    }

    #prev-button {
        flex: 0 0 auto;
        padding: 0.75rem 1rem;
        min-width: unset;
    }

    #next-button {
        flex: 1;
    }

    label small,
    .form-step > small {
        font-size: 0.8rem;
    }
}

/* === Print Styles === */
@media print {
    header,
    footer {
        display: none;
    }

    body {
        background: white;
    }
}
