/*
Theme Name: GENRECORD
Theme URI: https://genrecord.org
Author: Charles W. Stricklin
Author URI: https://genrecord.org
Description: Official theme for genrecord.org — the home of the GENRECORD open standard for sharing genealogical source records.
Version: 1.0
License: CC0 1.0 Universal
License URI: https://creativecommons.org/publicdomain/zero/1.0/
Text Domain: genrecord
*/


/* ============================================================================
   ROOT — Design Tokens
   WHY: Every color, font, and spacing value lives here. No hardcoded values
        in component rules. Change the palette once, change the whole site.
   ============================================================================ */
:root {
    /* Colors — a technical palette with archival warmth */
    --color-primary:        #0F172A;   /* Slate-950: nav, headings, authority */
    --color-accent:         #D97706;   /* Amber-600: CTAs, links, warmth */
    --color-accent-hover:   #B45309;   /* Amber-700: hover states */
    --color-background:     #FFFFFF;
    --color-surface:        #F8FAFC;   /* Slate-50: alternating section backgrounds */
    --color-text:           #1E293B;   /* Slate-800: body text */
    --color-text-muted:     #64748B;   /* Slate-500: captions, meta */
    --color-border:         #E2E8F0;   /* Slate-200: dividers, card borders */
    --color-nav-bg:         #0F172A;
    --color-nav-text:       #F1F5F9;
    --color-nav-hover:      #D97706;
    --color-footer-bg:      #0F172A;
    --color-footer-text:    #CBD5E1;   /* Slate-300 */
    --color-footer-link:    #D97706;
    --color-code-bg:        #1E293B;   /* Dark background for code blocks */
    --color-code-text:      #E2E8F0;
    --color-code-accent:    #FBBF24;   /* Amber-400: syntax highlighting */
    --color-code-comment:   #94A3B8;   /* Slate-400: comments in code */
    --color-hero-bg:        #0F172A;
    --color-hero-text:      #F1F5F9;
    --color-hero-accent:    #FBBF24;

    /* Typography */
    --font-body:            'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono:            'IBM Plex Mono', 'Menlo', 'Monaco', 'Consolas', monospace;

    --font-size-base:       17px;
    --font-size-sm:         14px;
    --font-size-xs:         12px;
    --font-size-lg:         20px;
    --font-size-xl:         24px;
    --font-size-2xl:        32px;
    --font-size-3xl:        42px;
    --font-size-hero:       56px;

    --font-weight-normal:   400;
    --font-weight-medium:   500;
    --font-weight-semibold: 600;
    --font-weight-bold:     700;
    --font-weight-black:    900;

    --line-height-body:     1.7;
    --line-height-heading:  1.2;
    --line-height-tight:    1.3;

    /* Layout */
    --content-width:        1120px;
    --content-narrow:       780px;
    --section-padding:      80px;
    --section-padding-sm:   48px;

    /* Misc */
    --radius:               6px;
    --radius-lg:            12px;
    --shadow-sm:            0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:            0 4px 12px rgba(0,0,0,0.10);
    --transition:           0.2s ease;
}


/* ============================================================================
   RESET & BASE
   ============================================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-body);
    color: var(--color-text);
    background-color: var(--color-background);
}

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

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


/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1, h2, h3, h4 {
    line-height: var(--line-height-heading);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); margin-bottom: 16px; }
h3 { font-size: var(--font-size-xl);  margin-bottom: 12px; }
h4 { font-size: var(--font-size-lg);  margin-bottom: 8px; }

p {
    margin-bottom: 1em;
}

code, pre {
    font-family: var(--font-mono);
}

code {
    background: var(--color-surface);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--color-primary);
}

pre {
    background: var(--color-code-bg);
    color: var(--color-code-text);
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    box-shadow: var(--shadow-md);
}
pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}


/* ============================================================================
   LAYOUT — Container
   ============================================================================ */
.container {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 24px;
}

.container--narrow {
    max-width: var(--content-narrow);
}


/* ============================================================================
   NAV
   WHY: Fixed top nav with the GENRECORD wordmark. Minimal — this is a spec
        site, not an app. Desktop links, hamburger on mobile.
   ============================================================================ */
.site-nav {
    background: var(--color-nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-nav__logo {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: var(--font-weight-bold);
    color: var(--color-nav-text);
    text-decoration: none;
    letter-spacing: -0.5px;
}
.site-nav__logo:hover {
    color: var(--color-nav-hover);
}

.site-nav__links {
    display: flex;
    list-style: none;
    gap: 32px;
    align-items: center;
}

.site-nav__links a {
    color: var(--color-nav-text);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    transition: color var(--transition);
}
.site-nav__links a:hover {
    color: var(--color-nav-hover);
}

/* GitHub link in nav gets a subtle pill style */
.site-nav__github {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.08);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-nav-text);
    transition: background var(--transition), color var(--transition);
}
.site-nav__github:hover {
    background: rgba(255,255,255,0.16);
    color: var(--color-nav-hover);
}
.site-nav__github svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Hamburger — hidden on desktop */
.site-nav__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--color-nav-text);
}
.site-nav__toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}


/* ============================================================================
   HERO — Front page only
   WHY: Bold, dark, immediate clarity. Visitor knows what GENRECORD is within
        3 seconds of landing. Two CTAs: spec and GitHub.
   ============================================================================ */
.hero {
    background: var(--color-hero-bg);
    color: var(--color-hero-text);
    padding: 100px 0 80px;
    text-align: center;
}

.hero__badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--color-hero-accent);
    border: 1px solid rgba(251,191,36,0.3);
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 24px;
}

.hero__title {
    font-family: var(--font-mono);
    font-size: var(--font-size-hero);
    font-weight: var(--font-weight-black);
    color: var(--color-hero-text);
    letter-spacing: -2px;
    margin-bottom: 16px;
}

.hero__subtitle {
    font-size: var(--font-size-lg);
    color: #94A3B8;
    max-width: 640px;
    margin: 0 auto 40px;
    line-height: var(--line-height-body);
}

.hero__cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}


/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
}

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

.btn--outline {
    background: transparent;
    color: var(--color-hero-text);
    border: 2px solid rgba(255,255,255,0.25);
}
.btn--outline:hover {
    border-color: rgba(255,255,255,0.5);
    color: #FFFFFF;
}

.btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}


/* ============================================================================
   SECTIONS — Alternating backgrounds for visual rhythm
   ============================================================================ */
.section {
    padding: var(--section-padding) 0;
}

.section--surface {
    background: var(--color-surface);
}

.section__header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 48px;
}

.section__header p {
    color: var(--color-text-muted);
    font-size: var(--font-size-lg);
    margin-top: 12px;
}


/* ============================================================================
   GENRECORD FORMAT EXAMPLE — Syntax-highlighted code block
   WHY: The format IS the product. Showing a real .genrecord file with
        highlighted header keys, separator, and CSV data is worth more than
        any amount of explanation.
   ============================================================================ */
.format-example {
    max-width: 900px;
    margin: 0 auto;
}

.format-example pre {
    font-size: 15px;
    line-height: 1.7;
    padding: 32px 36px;
}

/* Header lines — keys highlighted in amber */
.gr-header {
    color: var(--color-code-accent);
}

/* Header values */
.gr-value {
    color: var(--color-code-text);
}

/* The --- separator */
.gr-separator {
    color: var(--color-code-comment);
    display: block;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 4px;
    margin-top: 4px;
}

/* Column headers in the data block */
.gr-columns {
    color: #7DD3FC;  /* sky-300: distinct from header keys */
}

/* Data rows */
.gr-data {
    color: var(--color-code-text);
    opacity: 0.85;
}

/* Comment/annotation */
.gr-comment {
    color: var(--color-code-comment);
    font-style: italic;
}


/* ============================================================================
   FEATURE CARDS — "Design Principles" and similar grid sections
   ============================================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 40px;
}

.card {
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card__icon {
    font-size: 28px;
    margin-bottom: 16px;
    display: block;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    background: rgba(217,119,6,0.08);
    border-radius: var(--radius);
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-weight: var(--font-weight-bold);
}

.card__title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin-bottom: 8px;
}

.card__text {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}


/* ============================================================================
   RECORD TYPE TABLE
   ============================================================================ */
.type-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 32px;
}

.type-table th,
.type-table td {
    text-align: left;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}

.type-table th {
    background: var(--color-primary);
    color: #FFFFFF;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.type-table th:first-child {
    border-radius: var(--radius) 0 0 0;
}
.type-table th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.type-table td:first-child {
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    white-space: nowrap;
}

.type-table td:last-child {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.type-table tr:hover td {
    background: var(--color-surface);
}


/* ============================================================================
   CTA BANNER — Bottom of front page
   ============================================================================ */
.cta-banner {
    background: var(--color-primary);
    color: var(--color-hero-text);
    padding: 64px 0;
    text-align: center;
}

.cta-banner h2 {
    color: var(--color-hero-text);
    font-size: var(--font-size-2xl);
    margin-bottom: 12px;
}

.cta-banner p {
    color: #94A3B8;
    font-size: var(--font-size-lg);
    margin-bottom: 32px;
}

.cta-banner .hero__cta {
    justify-content: center;
}


/* ============================================================================
   FOOTER
   ============================================================================ */
.site-footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 48px 0 32px;
    font-size: var(--font-size-sm);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.site-footer__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-footer__logo {
    font-family: var(--font-mono);
    font-weight: var(--font-weight-bold);
    color: var(--color-footer-text);
    text-decoration: none;
}

.site-footer__cc0 {
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

.site-footer__links {
    display: flex;
    gap: 24px;
    list-style: none;
}

.site-footer__links a {
    color: var(--color-footer-text);
    text-decoration: none;
    transition: color var(--transition);
}
.site-footer__links a:hover {
    color: var(--color-footer-link);
}


/* ============================================================================
   PAGE — Generic page template
   ============================================================================ */
.page-content {
    padding: var(--section-padding) 0;
}

.page-content h1 {
    margin-bottom: 24px;
}

.page-content h2 {
    margin-top: 40px;
}

.page-content ul,
.page-content ol {
    margin-bottom: 1em;
    padding-left: 24px;
}

.page-content li {
    margin-bottom: 6px;
}

.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.page-content table th,
.page-content table td {
    text-align: left;
    padding: 10px 16px;
    border: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
}

.page-content table th {
    background: var(--color-surface);
    font-weight: var(--font-weight-semibold);
}


/* ============================================================================
   RESPONSIVE — Desktop-first, breakpoints at 1024, 768, 480
   ============================================================================ */
@media (max-width: 1024px) {
    :root {
        --font-size-hero: 44px;
        --font-size-3xl:  36px;
        --section-padding: 60px;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --font-size-hero: 36px;
        --font-size-3xl:  30px;
        --font-size-2xl:  26px;
        --section-padding: 48px;
    }

    /* Mobile nav */
    .site-nav__links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--color-nav-bg);
        flex-direction: column;
        gap: 0;
        padding: 8px 0 16px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    .site-nav__links.is-open {
        display: flex;
    }
    .site-nav__links li {
        width: 100%;
    }
    .site-nav__links a,
    .site-nav__links .site-nav__github {
        display: block;
        padding: 12px 24px;
        border-radius: 0;
        background: none;
    }
    .site-nav__toggle {
        display: block;
    }

    .hero {
        padding: 60px 0;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .type-table {
        font-size: var(--font-size-xs);
    }
    .type-table th,
    .type-table td {
        padding: 10px 12px;
    }

    .site-footer .container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-hero: 28px;
        --font-size-3xl:  24px;
        --section-padding: 36px;
    }

    .hero__cta {
        flex-direction: column;
        align-items: center;
    }
    .btn {
        width: 100%;
        justify-content: center;
        max-width: 300px;
    }

    .format-example pre {
        font-size: 12px;
        padding: 20px 16px;
    }
}
