/* Rockwell-Inspired Americana Editorial
   Paper base, serif headlines, warm accents.
   The feeling of a well-worn magazine on a kitchen table.
*/

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;600&display=swap');

/* ========================================
   Design Tokens (Style Guide)
   ======================================== */

:root {
    /* Surfaces */
    --bg: #F4E9D8;
    --bg-alt: #E6D8C2;
    --surface: #FAF4EA;
    --border: #CBB79F;
    --border-subtle: rgba(122, 75, 42, 0.15);

    /* Text */
    --text: #1F1B16;
    --text-muted: #635749;
    --accent: #1F1B16;

    /* Actions */
    --link: #2E4A67;
    --link-hover: #1D3550;
    --link-visited: #5A4067;
    --cta-primary: #A54038;
    --cta-primary-hover: #8E3630;

    /* Status */
    --status-success: #6E8B6B;
    --status-info: #7C9BB6;
    --status-warning: #C7A35A;
    --status-error: #B34A3C;

    /* Accents */
    --gold: #C7A35A;
    --navy: #2E4A67;
    --brick: #B34A3C;
    --sage: #6E8B6B;
    --umber: #7A4B2A;
    --dusty-blue: #7C9BB6;

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

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Shadows */
    --shadow-panel: 0 1px 3px rgba(31, 27, 22, 0.06), 0 4px 12px rgba(31, 27, 22, 0.04);
    --shadow-lift: 0 2px 6px rgba(31, 27, 22, 0.1), 0 8px 20px rgba(31, 27, 22, 0.07);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #2C1F14;
        --bg-alt: #3B2E22;
        --surface: #342719;
        --border: #5A4A3A;
        --border-subtle: rgba(200, 188, 171, 0.12);

        --text: #E6D7C3;
        --text-muted: #A89880;
        --accent: #E6D7C3;

        --link: #7C9BB6;
        --link-hover: #9BB5CB;
        --link-visited: #B294BB;
        --cta-primary: #D4836A;
        --cta-primary-hover: #E8A08A;

        --gold: #D4A647;
        --navy: #7C9BB6;
        --brick: #D4836A;
        --umber: #A88060;

        --shadow-panel: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
        --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.25), 0 8px 20px rgba(0, 0, 0, 0.2);
    }
}

/* ========================================
   Base & Reset
   ======================================== */

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

html {
    font-size: 16px;
    line-height: 1.7;
}

body {
    font-family: 'Libre Baskerville', Georgia, 'Palatino Linotype', serif;
    max-width: 680px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text);
    background: var(--bg);
    /* Subtle paper texture */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--cta-primary);
    color: var(--bg);
    padding: var(--space-sm) var(--space-md);
    z-index: 100;
    text-decoration: none;
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    border-radius: var(--radius-sm);
}

.skip-link:focus {
    top: 0;
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    line-height: 1.2;
    margin: 1.5em 0 0.5em;
    color: var(--accent);
}

h4, h5, h6 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    line-height: 1.3;
    margin: 1.25em 0 0.4em;
    color: var(--accent);
}

h1 {
    font-size: 2.5rem;
    margin-top: 0;
    letter-spacing: 0.01em;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.375rem;
}

h4 {
    font-size: 1.1rem;
}

p, ul, ol {
    margin-bottom: 1rem;
}

/* Body text uses serif for editorial warmth */
/* UI elements (nav, labels, dates) use sans */

a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: rgba(46, 74, 103, 0.3);
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:visited {
    color: var(--link-visited);
    text-decoration-color: rgba(90, 64, 103, 0.3);
}

a:hover {
    color: var(--link-hover);
    text-decoration-color: rgba(46, 74, 103, 0.8);
}

a:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ========================================
   Header & Navigation
   ======================================== */

header {
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

nav {
    margin-top: var(--space-md);
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 480px) {
    nav ul {
        gap: var(--space-xs) var(--space-sm);
    }
}

/* Tab-style navigation: printed label feel */
nav a {
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: color 0.16s ease, background-color 0.16s ease;
}

nav a:visited {
    color: var(--text-muted);
}

nav a:hover {
    color: var(--navy);
    background: var(--bg-alt);
    text-decoration: none;
}

nav a[aria-current="page"] {
    color: var(--navy);
    background: var(--bg-alt);
    border-bottom: 2px solid var(--brick);
    padding-bottom: 2px;
}

/* ========================================
   Main Content
   ======================================== */

main {
    margin-bottom: var(--space-3xl);
    min-height: calc(100vh - 12rem);
}

section {
    margin-bottom: var(--space-2xl);
}

hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border), transparent);
    margin: var(--space-2xl) 0;
}

/* ========================================
   Lists
   ======================================== */

ul, ol {
    padding-left: 2rem;
}

ul ul, ol ol {
    margin-bottom: 0;
}

dt {
    font-weight: bold;
    margin-top: 0.5rem;
}

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

/* ========================================
   Panel / Card Component (Signature Motif)
   ======================================== */

.panel {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-panel);
}

/* ========================================
   Work/Resume Styles
   ======================================== */

.job, .education-item {
    margin-bottom: var(--space-lg);
    padding: var(--space-md) var(--space-md) var(--space-md) var(--space-lg);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
    border-left: 3px solid transparent;
}

.job:hover, .education-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-left-color: var(--brick);
}

/* Organic spacing variations */
.job:nth-child(odd) {
    margin-bottom: var(--space-xl);
}

.job:nth-child(even) {
    margin-bottom: var(--space-lg);
}

.job-role, .org-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.job-org {
    font-style: italic;
    color: var(--text-muted);
}

.job-date, .year {
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin: var(--space-sm) 0;
}

.skill-tags span {
    background: var(--bg);
    padding: var(--space-xs) 0.6rem;
    border-radius: var(--radius-sm);
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    cursor: default;
}

.skill-tags span:hover {
    transform: translateY(-2px);
    background: var(--border);
}

/* ========================================
   Photo Gallery
   ======================================== */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.photo-card {
    border: 1px solid var(--border);
    padding: var(--space-xs);
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-panel);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
}

.photo-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    transition: opacity 0.2s ease;
    filter: saturate(0.92) contrast(1.02) sepia(0.03);
}

.photo-card:hover img {
    opacity: 0.93;
}

/* ========================================
   Footer
   ======================================== */

footer {
    border-top: 1px solid transparent;
    background-image: linear-gradient(to right, transparent, var(--border), transparent);
    background-size: 100% 1px;
    background-repeat: no-repeat;
    background-position: top;
    padding-top: var(--space-lg);
    margin-top: var(--space-3xl);
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

/* ========================================
   Utility Classes
   ======================================== */

.contact-list {
    list-style: none;
    padding: 0;
}

.contact-list li {
    margin-bottom: var(--space-sm);
    padding-left: 1.5rem;
    position: relative;
}

.contact-list li::before {
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.contact-list li:first-child::before {
    content: '@';
}

.contact-list li:nth-child(2)::before {
    content: '\2302';
}

.text-center {
    text-align: center;
}

.intro {
    font-size: 1.1rem;
    margin: 1rem 0 2rem;
}

/* ========================================
   Home Directory Listing
   ======================================== */

.site-directory {
    display: flex;
    flex-direction: column;
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: var(--space-sm) 0 var(--space-xl);
    padding: var(--space-md);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel);
}

.site-directory a {
    display: flex;
    gap: 1.5rem;
    padding: var(--space-sm) var(--space-md);
    text-decoration: none;
    color: var(--text);
    transition: background 0.16s ease, border-radius 0.16s ease;
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0;
    border-radius: var(--radius-sm);
}

.site-directory a:visited {
    color: var(--text);
}

.site-directory a:hover {
    background: var(--border);
    color: var(--text);
}

.dir-name {
    color: var(--navy);
    min-width: 12ch;
    flex-shrink: 0;
    font-weight: 600;
}

.site-directory a:visited .dir-name {
    color: var(--navy);
}

.dir-desc {
    color: var(--text-muted);
}

/* ========================================
   Terminal Quote (Editorial Pullquote)
   ======================================== */

.terminal-quote {
    font-family: 'Source Sans 3', monospace;
    background: var(--bg-alt);
    border-left: 3px solid var(--brick);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    font-size: 0.95rem;
    color: var(--text);
    box-shadow: var(--shadow-panel);
}

.terminal-quote::before {
    content: '$ ';
    color: var(--brick);
    font-weight: 600;
}

/* ========================================
   ASCII Art Dividers
   ======================================== */

.ascii-divider {
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    color: var(--border);
    font-size: 0.75rem;
    line-height: 1.2;
    margin: var(--space-2xl) 0;
    user-select: none;
}

/* ========================================
   Year Badge
   ======================================== */

.year {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    border: 1px solid var(--border);
}

/* ========================================
   Recipe/Playground Styles
   ======================================== */

.artifact-embed {
    margin: var(--space-lg) 0;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
}

.artifact-embed h3 {
    padding: var(--space-md) var(--space-lg) 0;
}

.artifact-embed iframe {
    display: block;
    border: none;
    width: 100%;
    height: 800px;
}

.artifact-embed .artifact-link {
    padding: var(--space-sm) var(--space-lg) var(--space-md);
    margin: 0;
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.recipe-post {
    margin-bottom: var(--space-3xl);
}

.recipe-subtitle {
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.recipe-date {
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: var(--space-lg);
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0 var(--space-lg);
    font-size: 0.95rem;
    background: var(--bg-alt);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.settings-table tr {
    border-bottom: 1px solid var(--border-subtle);
}

.settings-table tr:last-child {
    border-bottom: none;
}

.settings-table td {
    padding: var(--space-sm) var(--space-md);
}

.settings-table td:first-child {
    font-weight: 500;
    width: 45%;
}

.settings-table td:last-child {
    font-family: 'Source Sans 3', monospace;
    color: var(--text-muted);
}

/* ========================================
   Alerts & Status (Panel-style)
   ======================================== */

.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin: var(--space-md) 0;
    font-size: 0.95rem;
}

.alert-success {
    border-left: 3px solid var(--status-success);
    background: rgba(110, 139, 107, 0.08);
}

.alert-info {
    border-left: 3px solid var(--status-info);
    background: rgba(124, 155, 182, 0.08);
}

.alert-warning {
    border-left: 3px solid var(--status-warning);
    background: rgba(199, 163, 90, 0.08);
}

.alert-error {
    border-left: 3px solid var(--status-error);
    background: rgba(179, 74, 60, 0.08);
}

/* ========================================
   Buttons (for future use)
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 12px var(--space-md);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.16s ease;
    min-height: 44px;
}

.btn:focus-visible {
    outline: 2px solid rgba(46, 74, 103, 0.5);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--cta-primary);
    color: var(--bg);
}

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

.btn-primary:visited {
    color: var(--bg);
}

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

.btn-secondary:hover {
    background: rgba(46, 74, 103, 0.08);
}

.btn-secondary:visited {
    color: var(--navy);
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    body {
        max-width: 100%;
        color: #000;
        background: #fff;
        background-image: none;
        font-family: 'Libre Baskerville', Georgia, serif;
    }

    main {
        min-height: 0;
    }

    a {
        color: #000;
        text-decoration: underline;
        text-decoration-color: #000;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #555;
    }

    nav a[href]::after,
    .photo-card[href]::after {
        content: none;
    }

    nav {
        display: none;
    }

    .ascii-divider {
        display: none;
    }

    .job, .education-item, .photo-card, .site-directory, .settings-table {
        box-shadow: none;
        border-radius: 0;
    }
}
