/* Recalletta - Base Styles
   Foundation styles loaded on all pages:
   - CSS Variables
   - Reset & Typography
   - Navigation & Footer
   - Buttons & Forms
   - Alerts & Tables
   - Utilities
   - Markdown Content
   - Public Pages (Homepage, About, Docs, CLI, Auth)
   - Responsive Base
*/

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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --error: #ef4444;
    --surface: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: #0a1629;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0 0.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-brand img {
    height: 36px;
    width: auto;
}

.navbar-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.navbar-menu a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.navbar-menu a:hover {
    color: var(--text);
}

.navbar-menu a.active {
    color: var(--primary);
    font-weight: 500;
}

/* Main */
main {
    flex: 1;
}

/* Hero */
.hero {
    text-align: center;
    padding: 1rem 0 1rem;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-weight: 700;
    color: var(--text);
}

.hero .lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

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

.btn-secondary:hover {
    background: var(--bg-card);
}

.btn-link {
    background: none;
    color: var(--text-muted);
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
}

.btn-link:hover {
    color: var(--text);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn.disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Features */
.features {
    margin-top: 1rem;
}

.features h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.feature {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.feature h3 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* How it works */
.how-it-works {
    margin-top: 4rem;
    padding: 3rem 0;
    border-top: 1px solid var(--border);
}

.how-it-works h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.steps-vertical {
    max-width: 550px;
    margin: 0 auto;
}

.step-v {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.step-label {
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    min-width: 1.5rem;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.step-content strong {
    font-size: 1rem;
    color: var(--text);
}

.step-content code {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.step-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Code block */
.code-example {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 600px;
}

.code-example code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Demo GIF */
.demo-gif {
    margin: 0.5rem auto 2rem;
    max-width: 900px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.demo-gif img {
    display: block;
    width: 100%;
    height: auto;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--success);
    color: #86efac;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-error h2,
.alert-error p {
    color: var(--text);
}

.alert-warning {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.alert-warning p {
    color: var(--text);
}

.alert-info {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.alert-info p {
    color: var(--text);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

.table th, .table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-dark);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Utilities */
.inline-form { display: inline; }
.text-center { text-align: center; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-1-5 { margin-bottom: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--error); }

/* Hidden utility (CSP-compliant) */
.hidden {
    display: none !important;
}

/* Global Link Styling */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Markdown Content Styling */
.markdown-content {
    line-height: 1.7;
    font-size: 0.95rem;
}

.markdown-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    margin-top: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.markdown-content h1:first-child {
    margin-top: 0;
}

.markdown-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.markdown-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-content p {
    margin-bottom: 1rem;
    color: var(--text);
}

.markdown-content em {
    color: var(--text-muted);
    font-style: italic;
}

.markdown-content strong {
    font-weight: 600;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-content code {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85rem;
}

.markdown-content pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-content pre code {
    background: none;
    border: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    margin-top: 1rem;
    color: var(--text);
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 0 6px 6px 0;
}

.markdown-content blockquote p {
    margin-bottom: 0;
}

.markdown-content a {
    color: var(--primary);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: left;
}

.markdown-content th {
    background: var(--bg-card);
    font-weight: 600;
}

.markdown-content dl {
    margin-bottom: 1rem;
}

.markdown-content dt {
    font-weight: 600;
    margin-top: 0.5rem;
}

.markdown-content dd {
    margin-left: 2rem;
    margin-bottom: 0.5rem;
}

/* Page Sections (About, Docs, etc.) */
.page-hero {
    padding: 2rem 0;
}

.page-hero h1 {
    margin-bottom: 0.5rem;
}

.page-hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
}

.page-section {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
}

.page-section h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.page-section p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: var(--text);
}

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

/* Mobile Menu Toggle */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
}

.navbar-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    margin: 5px 0;
    transition: all 0.3s;
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Status pages */
.status-page {
    text-align: center;
    padding: 3rem 0;
}

.status-page h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.status-page p {
    margin: 0 auto;
    max-width: 480px;
}

/* ========================================
   Homepage Expanded Sections
   ======================================== */

/* Hero tagline */
.hero-tagline {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Problem Section */
.problem-section {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 700px;
    margin: 0 auto;
    border-top: 1px solid var(--border);
}

.problem-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.section-lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.section-text {
    color: var(--text);
    font-size: 1.1rem;
    font-style: italic;
}

/* Three Pillars Section */
.pillars-section {
    padding: 3rem 1rem;
    border-top: 1px solid var(--border);
}

.pillars-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    color: var(--text);
}

.pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.pillar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
}

.pillar:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.pillar-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.pillar h3 {
    font-size: 1.15rem;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.pillar p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Closed Loop Section */
.loop-section {
    padding: 3rem 1rem;
    border-top: 1px solid var(--border);
}

.loop-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    color: var(--text);
}

.loop-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.loop-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    width: 100%;
}

.loop-num {
    background: var(--primary);
    color: white;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.loop-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.loop-content strong {
    color: var(--text);
    font-size: 0.95rem;
}

.loop-content span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.loop-arrow {
    color: var(--text-muted);
    font-size: 1.25rem;
    opacity: 0.6;
}

.loop-return {
    font-size: 1.5rem;
    color: var(--primary);
    opacity: 1;
    margin-top: 0.5rem;
}

.loop-caption {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Features Expanded Section */
.features-expanded {
    padding: 3rem 1rem;
    border-top: 1px solid var(--border);
}

.features-expanded h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    color: var(--text);
}

.feature-grid-expanded {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0;
}

.feature-bullet {
    color: var(--success);
    font-size: 1.1rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.feature-item strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.feature-item p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.5;
}

/* Quick Start Section */
.quickstart-section {
    padding: 3rem 1rem;
    border-top: 1px solid var(--border);
}

.quickstart-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text);
}

/* Philosophy Section */
.philosophy-section {
    padding: 4rem 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.origin-quote {
    font-size: 1.4rem;
    font-style: italic;
    color: var(--text);
    margin-bottom: 2rem;
    line-height: 1.5;
    border: none;
    padding: 0;
    background: none;
    quotes: """ """ "'" "'";
}

.origin-quote::before {
    content: open-quote;
    color: var(--primary);
}

.origin-quote::after {
    content: close-quote;
    color: var(--primary);
}

.philosophy-text {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.philosophy-final {
    color: var(--text);
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 2rem;
    margin-bottom: 0;
}

/* Privacy Section */
.privacy-section {
    padding: 3rem 1rem;
    border-top: 1px solid var(--border);
    max-width: 700px;
    margin: 0 auto;
}

.privacy-section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* ========================================
   Responsive - Base
   ======================================== */

@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .feature-grid { grid-template-columns: 1fr; }

    .navbar-toggle {
        display: block;
    }

    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #0a1629;
        border-top: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
    }

    .navbar-menu.open {
        display: flex;
    }

    .navbar-menu a,
    .navbar-menu .btn-link {
        display: block;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border);
    }

    .navbar-menu a:last-child,
    .navbar-menu form:last-child .btn-link {
        border-bottom: none;
    }

    .navbar .container {
        position: relative;
    }

    /* Mobile: full-width cards, minimal container padding */
    .container {
        padding: 0 0.5rem;
    }

    .container > h1,
    .container > p,
    .container > .alert {
        padding: 0 0.5rem;
    }

    /* Hide time portion on mobile */
    .time-part {
        display: none;
    }
}
