/* ============================================
   ABRARUP - Main Stylesheet
   Mobile-first responsive design
   ============================================ */

/* Base Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for easy theming */
:root {
    --color-primary: #111111;
    --color-secondary: #666666;
    --color-muted: #888888;
    --color-light: #999999;
    --color-bg: #fafafa;
    --color-card: #ffffff;
    --color-section: #f8f8f8;
    --color-border: #dddddd;
    --color-accent: #2563eb;
    --color-success: #16a34a;
    --color-error: #dc2626;

    --font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

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

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 20px rgba(0, 0, 0, 0.08);

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Body - Mobile First */
body {
    background-color: var(--color-bg);
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-primary);
    padding: 24px 16px;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 48px);
}

/* Content Card - Mobile First */
.content {
    width: 100%;
    max-width: 640px;
    text-align: left;
    background: var(--color-card);
    padding: 28px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

#typewriter-content {
    opacity: 1;
}

/* Sections */
.section-tight {
    margin-bottom: 2em;
}

.section-tight:last-child {
    margin-bottom: 0;
}

.section-spaced {
    margin-bottom: 2em;
    padding: 1.25em;
    background: var(--color-section);
    border-radius: var(--radius-sm);
}

.section-spaced .header {
    font-weight: 700;
    margin-bottom: 0.6em;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-muted);
}

/* Typography */
.headline {
    font-size: 1.75em;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: #111111;
}

.stat {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

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

.spacer {
    height: 0.6em;
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: color var(--transition-normal);
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: var(--color-primary);
    transform: scaleX(1);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

a:hover {
    color: #444444;
}

a:hover::after {
    transform: scaleX(0.5);
}

a:active {
    transform: scale(0.98);
}

/* Selection */
::selection {
    background: var(--color-accent);
    color: #ffffff;
}


/* Footer */
.copyright {
    color: var(--color-light);
    font-size: 0.85em;
}

.legal-links {
    margin-top: 0.6em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em 1em;
}

.legal-links a {
    color: var(--color-light);
    font-size: 0.8em;
    font-weight: 400;
    padding: 4px 0;
}

.legal-links a::after {
    display: none;
}

.legal-links a:hover {
    color: var(--color-primary);
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-slow);
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    width: 100%;
    max-width: 480px;
    margin: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform var(--transition-slow);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover,
.modal-close:focus {
    background: var(--color-section);
    color: var(--color-primary);
}

.modal-close:active {
    transform: scale(0.95);
}

.modal h2 {
    font-size: 1.35em;
    font-weight: 700;
    margin-bottom: 0.4em;
    letter-spacing: -0.02em;
    padding-right: 36px;
}

.modal p {
    color: var(--color-secondary);
    margin-bottom: 1.25em;
    font-size: 0.9em;
    line-height: 1.5;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-group {
    margin-bottom: 1em;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 0.35em;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 12px;
    font-family: var(--font-family);
    font-size: 16px; /* Prevents iOS zoom */
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-card);
    color: var(--color-primary);
    transition: border-color var(--transition-fast),
                background var(--transition-fast),
                box-shadow var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #aaa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-card);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

/* Validation States */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: var(--color-error);
    background: #fef2f2;
}

.form-group input.error:focus,
.form-group select.error:focus,
.form-group textarea.error:focus {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.form-group input.valid,
.form-group select.valid,
.form-group textarea.valid {
    border-color: var(--color-success);
}

.form-group .error-message {
    display: none;
    color: var(--color-error);
    font-size: 0.75em;
    margin-top: 0.35em;
    font-weight: 500;
}

.form-group .error-message.show {
    display: block;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 40px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* hCaptcha */
.h-captcha {
    margin-bottom: 1em;
    display: flex;
    justify-content: center;
}

.captcha-error {
    color: var(--color-error);
    font-size: 0.75em;
    margin-top: -0.5em;
    margin-bottom: 1em;
    font-weight: 500;
    display: none;
}

.captcha-error.show {
    display: block;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition-fast),
                transform var(--transition-fast),
                box-shadow var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.submit-btn:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.2);
}

.submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Success Message */
.success-message {
    display: none;
    text-align: center;
    padding: 32px 16px;
}

.success-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.success-message svg {
    width: 56px;
    height: 56px;
    margin-bottom: 0.75em;
    color: var(--color-success);
}

.success-message h3 {
    font-size: 1.2em;
    margin-bottom: 0.4em;
}

.success-message p {
    color: var(--color-secondary);
    margin-bottom: 0;
    font-size: 0.9em;
}

.contact-form.hide {
    display: none;
}

/* ============================================
   TABLET BREAKPOINT (600px+)
   ============================================ */

@media (min-width: 600px) {
    body {
        font-size: 17px;
        padding: 60px 24px;
    }

    .content {
        padding: 40px 36px;
        border-radius: var(--radius-lg);
    }

    .headline {
        font-size: 2em;
    }

    .stat {
        font-size: 1.25em;
    }

    .section-tight {
        margin-bottom: 2.5em;
    }

    .section-spaced {
        margin-bottom: 2.5em;
        padding: 1.5em;
    }

    .modal-overlay {
        padding: 24px;
        align-items: center;
    }

    .modal {
        padding: 36px 32px;
    }

    .modal h2 {
        font-size: 1.5em;
    }

    .form-row {
        flex-direction: row;
        gap: 1em;
    }

    .form-row .form-group {
        flex: 1;
    }

    .form-group {
        margin-bottom: 1.25em;
    }
}

/* ============================================
   DESKTOP BREAKPOINT (900px+)
   ============================================ */

@media (min-width: 900px) {
    body {
        font-size: 18px;
        padding: 100px 24px;
    }

    .content {
        padding: 48px;
    }

    .headline {
        font-size: 2.2em;
    }

    .modal {
        padding: 40px;
    }
}

/* ============================================
   SMALL PHONES (375px and below)
   ============================================ */

@media (max-width: 375px) {
    body {
        padding: 16px 12px;
        font-size: 15px;
    }

    .content {
        padding: 20px 16px;
    }

    .headline {
        font-size: 1.5em;
    }

    .stat {
        font-size: 1.05em;
    }

    .section-spaced {
        padding: 1em;
    }

    .modal {
        padding: 20px 16px;
    }

    .modal h2 {
        font-size: 1.2em;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 10px;
    }

    .h-captcha > div {
        transform: scale(0.85);
    }
}

/* ============================================
   LANDSCAPE MODE ON PHONES
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .modal-overlay {
        align-items: flex-start;
        padding: 12px;
    }

    .modal {
        margin-top: 12px;
        margin-bottom: 12px;
        padding: 20px;
    }

    .success-message {
        padding: 20px 16px;
    }

    .success-message svg {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .modal-close {
        width: 44px;
        height: 44px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 16px 14px;
    }

    .submit-btn {
        padding: 18px 24px;
        min-height: 54px;
    }

    /* Disable hover effects on touch */
    a:hover::after {
        transform: scaleX(1);
    }

    a:active::after {
        transform: scaleX(0.5);
    }

    /* Better active states */
    a:active {
        opacity: 0.7;
    }

    .submit-btn:active:not(:disabled) {
        opacity: 0.8;
    }
}

/* ============================================
   ACCESSIBILITY & REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   DARK MODE SUPPORT (optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Uncomment below to enable dark mode */
    /*
    :root {
        --color-primary: #ffffff;
        --color-secondary: #aaaaaa;
        --color-muted: #888888;
        --color-light: #666666;
        --color-bg: #111111;
        --color-card: #1a1a1a;
        --color-section: #222222;
        --color-border: #333333;
    }

    .headline {
        color: #ffffff;
    }

    .modal-overlay {
        background: rgba(0, 0, 0, 0.8);
    }

    .submit-btn {
        background: #ffffff;
        color: #111111;
    }
    */
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
        padding: 20px;
    }

    .content {
        box-shadow: none;
        padding: 0;
    }

    .modal-overlay {
        display: none !important;
    }

    a::after {
        display: none;
    }
}
