/* ============================================
   William N. Goetzmann — Academic Website
   Modern design with Yale blue, visual cards
   ============================================ */

:root {
    --yale-blue: #1a5276;
    --yale-blue-light: #2980b9;
    --yale-blue-pale: #eaf4fb;
    --accent: #27ae60;
    --accent-hover: #219a52;
    --highlight: #f39c12;
    --bg: #ffffff;
    --bg-alt: #f8fffe;
    --text: #1a1a1a;
    --text-secondary: #444444;
    --text-light: #6b7280;
    --white: #ffffff;
    --border: #e0e7ec;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
    --radius: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 600;
    line-height: 1.25;
}

a {
    color: var(--yale-blue-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Navigation ---- */

#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    transition: background var(--transition), box-shadow var(--transition);
}

#navbar.scrolled {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-name {
    font-family: 'EB Garamond', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--white);
    transition: color var(--transition);
}

#navbar.scrolled .nav-name {
    color: var(--yale-blue);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 24px;
}

.nav-links a {
    font-size: 0.825rem;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.01em;
    transition: color var(--transition);
}

#navbar.scrolled .nav-links a {
    color: var(--text-secondary);
}

.nav-links a:hover {
    color: var(--white);
}

#navbar.scrolled .nav-links a:hover {
    color: var(--yale-blue);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--white);
    transition: all var(--transition);
}

#navbar.scrolled .nav-toggle span {
    background: var(--text);
}

/* ---- Hero ---- */

#hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    background: linear-gradient(145deg, #1a5276 0%, #1f6f8b 40%, #2980b9 80%, #48a9a6 100%);
    position: relative;
    overflow: hidden;
}

#hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(72,169,166,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(243,156,18,0.1) 0%, transparent 40%);
}

.hero-content {
    position: relative;
    max-width: 800px;
    padding: 120px 24px 80px;
    margin: 0 auto;
    text-align: center;
}

.hero-label {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-bottom: 16px;
}

#hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: var(--white);
    margin-bottom: 12px;
    font-weight: 700;
}

.hero-subtitle {
    font-family: 'EB Garamond', serif;
    font-size: 1.25rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 24px;
    font-style: italic;
}

.hero-tagline {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.75);
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

.hero-roles {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-roles span {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- Sections ---- */

.section {
    padding: 100px 0;
}

.section-alt {
    background: var(--bg-alt);
}

.section-title {
    font-size: 2.2rem;
    color: var(--yale-blue);
    margin-bottom: 12px;
    text-align: center;
}

.section-intro {
    text-align: center;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto 48px;
    font-size: 1.05rem;
}

/* ---- About ---- */

.about-grid {
    max-width: 750px;
    margin: 32px auto 0;
}

.about-text p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.about-links {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.about-resources {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.about-resources h3 {
    font-size: 1.1rem;
    color: var(--yale-blue);
    margin-bottom: 8px;
}

.about-resources > p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.about-resources ul {
    list-style: none;
    margin: 0;
}

.about-resources li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.about-resources li:last-child {
    border-bottom: none;
}

.about-resources li a {
    font-weight: 500;
}

.about-resources small {
    color: var(--text-light);
    font-size: 0.82rem;
}

.about-resources small a {
    color: var(--text-light);
    font-weight: 400;
}

.about-resources small a:hover {
    color: var(--accent);
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    background: var(--accent);
    color: var(--white);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.btn:hover {
    background: var(--accent-hover);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--yale-blue);
    border: 1.5px solid var(--yale-blue);
}

.btn-outline:hover {
    background: var(--yale-blue);
    color: var(--white);
}

/* ---- Visual Project Cards ---- */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.visual-card {
    background: var(--card-bg, linear-gradient(135deg, #1a1a2e, #16213e));
    border-radius: var(--radius);
    overflow: hidden;
    border: none;
    color: var(--white);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(20px);
    cursor: default;
}

a.visual-card {
    cursor: pointer;
}

.visual-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.visual-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.card-visual {
    padding: 20px 20px 0;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-illustration {
    width: 100%;
    height: 100%;
}

.card-body {
    padding: 20px 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-badge {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
}

.visual-card h3 {
    font-size: 1.2rem;
    color: var(--white);
    margin-bottom: 8px;
    line-height: 1.3;
}

.visual-card p {
    color: rgba(255,255,255,0.75);
    font-size: 0.875rem;
    line-height: 1.6;
    flex: 1;
}

.visual-card em {
    color: rgba(255,255,255,0.7);
}

.card-action {
    display: inline-block;
    margin-top: 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    transition: color var(--transition);
}

a.visual-card:hover .card-action {
    color: var(--white);
}

.paper-link {
    color: rgba(255,255,255,0.5);
}

/* ---- Books with Cover Images ---- */

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 40px;
}

.book-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(20px);
}

.book-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.book-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.book-cover {
    width: 100%;
    height: 320px;
    object-fit: cover;
    object-position: top;
    background: linear-gradient(135deg, var(--yale-blue), var(--yale-blue-light));
}

.book-cover-placeholder {
    width: 100%;
    height: 320px;
    background: linear-gradient(135deg, var(--yale-blue) 0%, #1a3a6a 50%, var(--yale-blue-light) 100%);
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'EB Garamond', serif;
    font-size: 1.4rem;
    font-weight: 600;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.book-info {
    padding: 20px 24px 24px;
}

.book-card h3 {
    font-size: 1.1rem;
    color: var(--yale-blue);
    margin-bottom: 4px;
    line-height: 1.3;
}

.book-meta {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.book-info p:last-child {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ---- Textbook / Chapters ---- */

.textbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-top: 40px;
}

.chapter-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    opacity: 0;
    transform: translateY(20px);
}

.chapter-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.chapter-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--yale-blue-light);
}

.chapter-num {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--yale-blue), var(--yale-blue-light));
    color: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'EB Garamond', serif;
    font-size: 1.2rem;
    font-weight: 700;
}

.chapter-review .chapter-num {
    background: linear-gradient(135deg, var(--highlight), #e67e22);
}

.chapter-info h3 {
    font-size: 1.05rem;
    color: var(--yale-blue);
    margin-bottom: 4px;
    line-height: 1.3;
}

.chapter-card:hover h3 {
    color: var(--yale-blue-light);
}

.chapter-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- Data Grid ---- */

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 40px;
}

.data-card {
    display: block;
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(20px);
}

.data-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.data-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--yale-blue-light);
    color: var(--text);
}

.data-card h3 {
    font-size: 1.05rem;
    color: var(--yale-blue);
    margin-bottom: 6px;
}

.data-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ---- Teaching ---- */

.teaching-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.teaching-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    border: 1px solid var(--border);
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(20px);
}

.teaching-card.visible {
    opacity: 1;
    transform: translateY(0);
}

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

.teaching-card h3 {
    font-size: 1.15rem;
    color: var(--yale-blue);
    margin-bottom: 4px;
}

.teaching-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: 500;
}

.teaching-card p:last-of-type {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.project-link {
    display: inline-block;
    margin-top: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--yale-blue-light);
}

.project-link:hover {
    color: var(--accent);
}

/* ---- Contact ---- */

.contact-content {
    max-width: 600px;
    margin: 32px auto 0;
    text-align: center;
}

.contact-info {
    margin-bottom: 24px;
}

.contact-info p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
}

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

.contact-links a {
    padding: 8px 20px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.contact-links a:hover {
    border-color: var(--yale-blue);
    color: var(--yale-blue);
    background: var(--yale-blue-pale);
}

/* ---- Footer ---- */

footer {
    padding: 32px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

footer p {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 16px 24px;
        gap: 12px;
        box-shadow: var(--shadow-md);
        display: none;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        color: var(--text-secondary) !important;
        font-size: 1rem;
    }

    .hero-content {
        padding: 100px 24px 60px;
    }

    .hero-roles {
        flex-direction: column;
        gap: 8px;
    }

    .section {
        padding: 60px 0;
    }

    .project-grid,
    .books-grid,
    .data-grid,
    .teaching-grid,
    .textbook-grid {
        grid-template-columns: 1fr;
    }

    .about-links {
        flex-direction: column;
    }

    .btn {
        text-align: center;
    }

    .card-visual {
        height: 120px;
    }
}

@media (max-width: 480px) {
    #hero h1 {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .book-cover,
    .book-cover-placeholder {
        height: 260px;
    }
}

/* ---- Animations ---- */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content > * {
    animation: fadeInUp 0.8s ease forwards;
}

.hero-content > *:nth-child(1) { animation-delay: 0.1s; }
.hero-content > *:nth-child(2) { animation-delay: 0.2s; }
.hero-content > *:nth-child(3) { animation-delay: 0.3s; }
.hero-content > *:nth-child(4) { animation-delay: 0.4s; }
.hero-content > *:nth-child(5) { animation-delay: 0.5s; }
