/* ============================================================
   justhtml.dev — Global Styles
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --color-bg: #0f0f0f;
    --color-surface: #1a1a1a;
    --color-surface-2: #242424;
    --color-border: #2e2e2e;
    --color-text: #e8e8e8;
    --color-text-muted: #888;
    --color-accent: #f97316;
    --color-accent-hover: #ea6c0a;
    --color-link: #f97316;
    --color-code-bg: #1e1e1e;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --max-width: 1100px;
    --max-width-narrow: 720px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

img { max-width: 100%; display: block; }

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-code-bg);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

pre code { background: none; padding: 0; font-size: 0.85rem; }

blockquote {
    border-left: 3px solid var(--color-accent);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--color-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-text-muted);
    font-style: italic;
}

blockquote p { margin: 0; }

/* --- Layout Utilities --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: var(--max-width-narrow);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--color-accent);
    color: #fff;
}
.btn-primary:hover { background: var(--color-accent-hover); }

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

.btn-full { width: 100%; text-align: center; }

/* --- Header --- */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.site-logo-img {
    height: 28px;
    width: auto;
    display: block;
}
.site-logo span { color: var(--color-accent); }
.site-logo:hover { text-decoration: none; }

/* --- Nav --- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.nav-links a {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
}
.nav-links a:hover { color: var(--color-text); text-decoration: none; }
.nav-links .btn { color: #fff; }

/* Nav user dropdown */
.nav-user-menu { position: relative; }

.nav-user-toggle {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 160px;
    list-style: none;
    padding: 0.25rem 0;
    z-index: 200;
}

.nav-user-dropdown li a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    font-size: 0.9rem;
}
.nav-user-dropdown li a:hover { background: var(--color-surface-2); text-decoration: none; }

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.2s;
}

/* --- Footer --- */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    margin-top: 4rem;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-copy { color: var(--color-text-muted); font-size: 0.85rem; }
.footer-copy a { color: var(--color-text-muted); }
.footer-copy a:hover { color: var(--color-text); }

.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--color-text-muted); font-size: 0.85rem; }
.footer-links a:hover { color: var(--color-text); }

/* --- Hero --- */
.hero {
    padding: 5rem 1.5rem;
    text-align: center;
    background: radial-gradient(ellipse at 50% 0%, rgba(249,115,22,0.08) 0%, transparent 70%);
}

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

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 540px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-ctas { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* --- Home Sections --- */
.what-is-this, .the-point, .showcase-preview, .cta-banner {
    padding: 3.5rem 0;
}

.what-is-this { border-top: 1px solid var(--color-border); }

.what-is-this h2, .the-point h2, .showcase-preview h2, .cta-banner h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.what-is-this p { color: var(--color-text-muted); max-width: 620px; }
.what-is-this p + p { margin-top: 0.75rem; }

.section-sub { color: var(--color-text-muted); margin-bottom: 2rem; }

/* Point cards */
.point-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.point-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.point-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-accent);
}

.point-card p { color: var(--color-text-muted); font-size: 0.95rem; }

/* CTA Banner */
.cta-banner {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    text-align: center;
    padding: 3.5rem 1.5rem;
}

.cta-banner p { color: var(--color-text-muted); margin-bottom: 1.5rem; }

/* Showcase preview grid */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

/* --- Content Pages (about, manifesto, etc.) --- */
.content-page {
    padding: 3rem 0 4rem;
}

/* .prose scopes all typographic rules to prose content pages only.
   Non-prose pages (404, etc.) use .content-page for layout only
   and are free to use their own classes without specificity conflicts. */
.content-page.prose h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.content-page.prose h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: var(--color-text);
}

.content-page.prose p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    line-height: 1.75;
}

.content-page.prose ul,
.content-page.prose ol {
    color: var(--color-text-muted);
    padding-left: 1.5rem;
    margin-bottom: 1rem;
    line-height: 1.75;
}

.content-page.prose li { margin-bottom: 0.35rem; }

.content-page.prose a { color: var(--color-link); }

.policy-date { color: var(--color-text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* Framework guide */
.framework-guide h2:first-of-type { margin-top: 1.5rem; }

/* Showcase page */
.showcase-page { padding: 2.5rem 0 4rem; }

.showcase-header { margin-bottom: 2rem; }
.showcase-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.showcase-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.showcase-sort-form { display: flex; align-items: center; gap: 0.5rem; }

.showcase-sort-form label { color: var(--color-text-muted); font-size: 0.9rem; }

select {
    background: var(--color-surface-2);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
}

/* --- Auth Layout --- */
.auth-body {
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.auth-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.02em;
}
.auth-logo span { color: var(--color-accent); }
.auth-logo:hover { text-decoration: none; }

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 2rem;
    width: 100%;
}

.auth-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-sub { color: var(--color-text-muted); margin-bottom: 1.5rem; }

.auth-footer-credit { color: var(--color-text-muted); font-size: 0.8rem; }
.auth-footer-credit a { color: var(--color-text-muted); }

/* Forms */
.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

input[type="email"], input[type="text"], input[type="url"], textarea {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.15s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.auth-legal {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

.auth-note { color: var(--color-text-muted); font-size: 0.9rem; margin-top: 0.75rem; }

/* Form utilities */
.form-optional { font-weight: 400; color: var(--color-text-muted); font-size: 0.85em; }

.form-error {
    color: #ef4444;
    font-size: 0.875rem;
    padding: 0.6rem 0.85rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* Danger button */
.btn-danger {
    background: #ef4444;
    color: #fff;
}
.btn-danger:hover { background: #dc2626; }

/* Nav logout button — styled to match dropdown links */
.nav-logout-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}
.nav-logout-btn:hover { background: var(--color-surface-2); }

/* Manifesto */
.manifesto em { color: var(--color-text); font-style: italic; }

/* --- Page Body (form/utility pages) --- */
.page-body { padding-top: 2.5rem; padding-bottom: 4rem; }

.page-heading {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.page-heading--lg { margin-bottom: 2rem; }

.page-subtitle {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* --- Showcase Entry --- */
.entry-title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.entry-og-desc {
    color: var(--color-text-muted);
    margin-bottom: 2.25rem;
    font-size: 0.9rem;
    font-style: italic;
}

.entry-user-desc {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.entry-user-desc p {
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 2;
}

.entry-controls-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.entry-controls-refresh { display: inline-flex; }
.entry-delete-warning { margin-bottom: 1rem; }
.entry-report-wrap { margin-bottom: 2rem; }
.entry-report-actions { margin-top: 0.75rem; }

/* --- Gallery --- */
.gallery-empty { color: var(--color-text-muted); padding: 3rem 0; }
.gallery-header-sub { color: var(--color-text-muted); margin-top: 0.5rem; }

/* --- Comment Forms --- */
.comment-form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

/* --- Profile Edit --- */
.profile-form-actions { display: flex; gap: 0.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.btn-add-link { margin-top: 0.75rem; }
.profile-footer-link { margin-top: 2rem; font-size: 0.85rem; }

/* --- Settings --- */
.settings-email-note { margin-bottom: 0.5rem; }
.settings-danger-desc { color: var(--color-text-muted); margin-bottom: 1.25rem; }
.settings-confirm-group { max-width: 280px; margin-bottom: 1rem; }

/* --- Submit --- */
.submit-actions { margin-top: 1.5rem; }

/* --- Nav --- */
.nav-logout-form { margin: 0; }

/* --- 404 Error Page --- */
.error-page { text-align: center; padding-top: 4rem; padding-bottom: 4rem; }
.error-code { font-size: clamp(3rem, 10vw, 6rem); font-weight: 800; letter-spacing: -0.04em; margin-bottom: 0.25rem; }
.error-message { font-size: 2.25rem; color: var(--color-text-muted); margin-bottom: 2rem; }

/* --- Responsive --- */
@media (max-width: 640px) {
    .header-inner { gap: 1rem; }
    .nav-links { display: none; }
    .nav-toggle { display: flex; }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 1rem 1.5rem;
        gap: 1rem;
    }

    .footer-inner { flex-direction: column; text-align: center; }
    .showcase-controls { flex-direction: column; align-items: flex-start; }
}
