/* Book landing page — Generative AI for Connected and Autonomous Vehicles */
/* Clean, Wiley-leaning look: sans-serif, white, navy anchor + green accent. */

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy: #003366;
    --blue: #0066cc;
    --green: #0c8242;      /* subtle Wiley-leaning accent */
    --ink: #2a2a2a;
    --muted: #5a6472;
    --line: #e2e6ea;
    --bg-soft: #f6f8fa;
}

body {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.65;
    color: var(--ink);
    background-color: #ffffff;
    padding: 0;
}

/* Header */
header {
    background-color: var(--navy);
    color: #ffffff;
    padding: 2.25rem 0 2rem;
    border-bottom: 1px solid var(--green);
}

.header-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
}

header h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 0.6rem;
}

header .author {
    color: #e8edf2;
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

header .isbn {
    color: #aebccd;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

/* Navigation */
nav {
    background-color: #ffffff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 2rem;
}

nav li:before { content: none; }

nav a {
    display: block;
    padding: 0.95rem 1.25rem;
    color: var(--navy);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}

nav a:hover,
nav a.active {
    border-bottom-color: var(--green);
    color: var(--green);
}

/* Main container */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 2rem 1rem;
}

/* Typography */
h2 {
    color: var(--navy);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

p {
    color: var(--ink);
    margin-bottom: 1rem;
    font-size: 1.02rem;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

/* Sections */
section { margin-bottom: 2.75rem; }

.intro p { font-size: 1.08rem; }

/* Labs — quietly set apart with a faint fill and a hairline border */
.feature {
    background-color: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 2rem 2rem 1.75rem;
}

.feature h2 { margin-top: 0; }

/* Labs: facts strip */
.lab-facts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin: 1.25rem 0;
}

.lab-facts div {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.35;
}

.lab-facts strong {
    display: block;
    color: var(--navy);
    font-size: 1.05rem;
    margin-bottom: 0.1rem;
}

/* Labs: "what you'll build" list */
.lab-build-intro { margin-bottom: 0.6rem; }

ul.lab-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1.25rem;
    margin: 0 0 0.5rem;
    padding: 0;
}

ul.lab-list li {
    font-size: 0.88rem;
    color: var(--ink);
    line-height: 1.4;
    padding: 0.1rem 0;
}

ul.lab-list .tag {
    display: inline-block;
    min-width: 2.9rem;
    margin-right: 0.5rem;
    padding: 0.05rem 0.4rem;
    background: var(--navy);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    border-radius: 2px;
    vertical-align: middle;
}

.note {
    color: var(--muted);
    font-size: 0.92rem;
    font-style: italic;
    margin-bottom: 1.25rem;
}

/* Code block */
pre.code {
    background-color: #0f1b2d;
    color: #e6edf3;
    border-radius: 3px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 0.5rem 0 1rem;
    font-size: 0.88rem;
    line-height: 1.5;
}

pre.code code {
    font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
    color: inherit;
    background: none;
}

code {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 0.9em;
    background-color: #eef1f4;
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

/* Buttons */
.cta-row { margin: 1.25rem 0 0.5rem; }

.btn {
    display: inline-block;
    padding: 0.65rem 1.35rem;
    border-radius: 2px;
    font-weight: 600;
    font-size: 0.96rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: 1px solid transparent;
}

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

.btn-primary { background-color: var(--navy); color: #ffffff; }
.btn-primary:hover { background-color: #00284f; color: #ffffff; }

.btn-github { background-color: var(--green); color: #ffffff; }
.btn-github:hover { background-color: #0a6e38; color: #ffffff; }

.btn-outline { background-color: #ffffff; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background-color: var(--navy); color: #ffffff; }

/* Courses / reading flow */
h3.sub {
    color: var(--navy);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2rem 0 0.9rem;
}

/* Book structure table: Layer (merged) -> Part -> Chapters */
.table-wrap { overflow-x: auto; margin: 0.5rem 0 1rem; }

table.structure {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

table.structure th {
    text-align: left;
    background: var(--navy);
    color: #ffffff;
    font-weight: 600;
    padding: 0.45rem 0.7rem;
}

table.structure td {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    vertical-align: top;
    color: var(--ink);
    line-height: 1.55;
}

.structure .layer-cell {
    font-weight: 700;
    color: var(--navy);
    width: 9rem;
}

.structure .part-cell { width: 10rem; }
.structure .part-cell strong { display: block; color: var(--navy); }
.structure .part-cell span { color: var(--muted); font-size: 0.82rem; }

/* Layer tints on the merged layer cell, matching the book's figure */
.layer-gen .layer-cell        { background: #ebf2fa; }
.layer-interface .layer-cell  { background: #ebf8f0; }
.layer-agentic .layer-cell    { background: #faf2eb; }
.layer-validation .layer-cell { background: #f5ebf5; }

/* Reading pathways */
.pathways {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 0.5rem 0 1rem;
}

.pathway {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 1rem 1.1rem;
}

.pathway h4 {
    color: var(--navy);
    font-size: 1rem;
    margin-bottom: 0.4rem;
}

.pathway p { font-size: 0.9rem; color: var(--muted); margin-bottom: 0; }

/* Sample course schedule tables */
.schedules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.schedule-block h4 {
    color: var(--navy);
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

table.schedule {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

table.schedule th {
    text-align: left;
    background: var(--navy);
    color: #fff;
    padding: 0.35rem 0.55rem;
    font-weight: 600;
}

table.schedule td {
    padding: 0.3rem 0.55rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    vertical-align: top;
}

table.schedule tbody tr:nth-child(even) { background: var(--bg-soft); }

table.schedule td:first-child,
table.schedule th:first-child { width: 2em; color: var(--muted); }

table.schedule td:last-child,
table.schedule th:last-child { width: 3.5em; white-space: nowrap; }

/* Footer */
footer {
    background-color: var(--bg-soft);
    border-top: 1px solid var(--line);
    margin-top: 2rem;
    padding: 1.75rem 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container,
    .container,
    nav ul {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    header h1 { font-size: 1.6rem; }

    nav ul { flex-direction: column; }

    nav a {
        border-bottom: 1px solid var(--line);
        border-left: 3px solid transparent;
    }

    nav a:hover,
    nav a.active {
        border-left-color: var(--green);
        border-bottom-color: var(--line);
    }

    .feature { padding: 1.5rem 1.25rem; }

    .btn { display: block; text-align: center; }

    .pathways,
    .schedules,
    ul.lab-list {
        grid-template-columns: 1fr;
    }

    .lab-facts { grid-template-columns: 1fr 1fr; }

    /* Let the structure table fit a phone: shrink type, drop fixed widths */
    table.structure { font-size: 0.8rem; }
    .structure .layer-cell,
    .structure .part-cell { width: auto; }
    table.structure td { padding: 0.45rem 0.5rem; }
}
