/* =============================================================================
   profiles.dev - Shared Styles
   ============================================================================= */

/* =============================================================================
   RESET AND BASE STYLES
   ============================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =============================================================================
   CSS CUSTOM PROPERTIES
   ============================================================================= */
:root {
    /* Layout variables */
    --search-width-default: 240px;
    --search-width-focus: 300px;
    --search-width-mobile: 160px;
    --search-width-mobile-focus: 200px;

    /* Spacing system */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;
    --space-4xl: 64px;
    --space-5xl: 80px;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    --transition-slow: 0.6s;

    /* Dark mode by default */
    --bg: #0d1117;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --accent-contrast: #1158c7;
    --border: #30363d;
    --card-bg: #161b22;
    --shadow: rgb(0 0 0 / 30%);
    --success: #238636;
    --warning: #d29922;
    --danger: #da3633;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #fff;
        --text: #1a1a1a;
        --text-secondary: #666;
        --accent: #0969da;
        --accent-hover: #0860ca;
        --accent-contrast: #0550ae;
        --border: #e1e4e8;
        --card-bg: #f6f8fa;
        --shadow: rgb(0 0 0 / 10%);
        --success: #1a7f37;
        --warning: #bf8700;
        --danger: #cf222e;
    }
}

/* =============================================================================
   TYPOGRAPHY AND BODY STYLES
   ============================================================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    font-display: swap;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    font-size: 16px;
}

h1 {
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    margin: 48px 0 24px;
    letter-spacing: -0.01em;
    color: var(--text);
}

h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--text);
}

h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--text);
}

p {
    margin-bottom: 16px;
    line-height: 1.6;
    color: var(--text);
}

/* =============================================================================
   LAYOUT COMPONENTS
   ============================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* =============================================================================
   HEADER AND NAVIGATION
   ============================================================================= */
header {
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: var(--space-sm) var(--space-md) var(--space-sm) 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    width: var(--search-width-default);
    transition: border-color var(--transition-fast), width var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    width: var(--search-width-focus);
}

.search-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    pointer-events: none;
    opacity: 0.6;
}

.login-btn, .back-link {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.2s, background 0.2s;
}

.login-btn:hover, .back-link:hover {
    border-color: var(--accent);
    background: var(--card-bg);
}

/* =============================================================================
   BUTTONS AND LINKS
   ============================================================================= */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent-contrast);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 16px;
    transition: background var(--transition-fast), transform var(--transition-fast);
    margin: 8px 8px 8px 0;
}

.btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.btn.secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.cta {
    display: inline-block;
    padding: var(--space-lg) var(--space-2xl);
    background: var(--accent-contrast);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 18px;
    transition: background var(--transition-fast), transform var(--transition-fast);
    will-change: transform;
    transform: translateZ(0);
}

.cta:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.cta:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
    text-decoration-thickness: 2px;
}

/* =============================================================================
   CARDS AND CONTAINERS
   ============================================================================= */
.step-card, .profile-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin: 24px 0;
    position: relative;
}

.profile-card {
    text-decoration: none;
    color: var(--text);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    will-change: transform;
    transform: translateZ(0);
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.step-number {
    position: absolute;
    top: -12px;
    left: 24px;
    background: var(--accent);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

/* =============================================================================
   CODE AND TECHNICAL CONTENT
   ============================================================================= */
code {
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', 'Source Code Pro', 'Courier New', monospace;
    font-size: 0.875em;
    color: var(--text);
    border: 1px solid var(--border);
}

pre {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', 'Source Code Pro', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* =============================================================================
   CALLOUTS AND ALERTS
   ============================================================================= */
.callout {
    border-left: 4px solid var(--accent);
    background: var(--card-bg);
    padding: 16px 20px;
    margin: 24px 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

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

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

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

.callout h4 {
    margin: 0 0 8px;
    font-size: 16px;
}

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

/* =============================================================================
   LISTS
   ============================================================================= */
ul, ol {
    margin: 16px 0;
    padding-left: 24px;
}

li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* =============================================================================
   FOOTER
   ============================================================================= */
footer {
    padding: 48px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

footer .container a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color var(--transition-fast), text-decoration-thickness var(--transition-fast);
    position: relative;
    padding-right: 1.2em;
}

/* External link indicator */
footer .container a::after {
    content: "↗";
    position: absolute;
    right: 0;
    top: -0.1em;
    font-size: 0.8em;
    opacity: 0.7;
}

footer .container a:hover {
    text-decoration-thickness: 2px;
    color: var(--accent-hover);
}

footer .container a:hover::after {
    opacity: 1;
}

footer .container a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* =============================================================================
   ACCESSIBILITY UTILITIES
   ============================================================================= */

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip link visible on focus */
.sr-only:focus {
    position: absolute;
    width: auto;
    height: auto;
    padding: 8px 16px;
    margin: 8px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

/* =============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================= */
@media (width <= 768px) {
    .search-input {
        width: var(--search-width-mobile);
    }

    .search-input:focus {
        width: var(--search-width-mobile-focus);
    }

    .btn {
        display: block;
        text-align: center;
        margin: 8px 0;
        padding: 12px 24px;
        font-size: 16px;
    }

    .cta {
        padding: 12px 24px;
        font-size: 16px;
    }

    .step-card {
        padding: 16px;
        margin: 16px 0;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
        top: -10px;
        left: 16px;
    }

    pre {
        padding: 12px;
        font-size: 13px;
    }
}

@media (width <= 540px) {
    .header-content {
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .search-bar {
        flex: 1;
    }

    .search-input {
        width: 100%;
    }

    .search-input:focus {
        width: 100%;
    }
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.text-center {
    text-align: center;
    margin: 48px 0;
}

.lead {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.5;
}

/* Quick Start Link Styles */
.quick-start-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border: 1px solid var(--accent);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
    display: inline-block;
}

.quick-start-link:hover {
    background: var(--accent);
    color: white;
}
