/* Mission Tracker site style (PLAN.md, "Site style"): dark, slightly
   technical, clean; one accent colour, teal.  Started from
   experiments/style/style.css. */

:root {
    --bg: #141922;
    --panel: #252d3d;
    --panel-hover: #2b3446;
    --line: #333d50;
    --text: #e6e9ef;
    --muted: #9aa3b2;
    --faint: #6e7787;
    --accent: #4fd1c5;            /* teal: the one colour that means "now" */
    --accent-soft: rgba(79, 209, 197, 0.14);
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0 0 2rem;
    background: var(--bg);
    background-image: radial-gradient(1200px 600px at 20% -10%, #1f2a40 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid rgba(230, 233, 239, 0.25);
}

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

/* Header */
nav.header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 2rem;
    padding: 0.9rem 2rem;
    background: rgba(20, 25, 34, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
}

nav.header a {
    border: none;
    color: var(--muted);
}

nav.header a:hover {
    color: var(--text);
}

nav.header a.home-link {
    color: var(--text);
    font-size: 1.7rem;          /* twice the header's other text */
    font-weight: 600;
    letter-spacing: -0.01em;
}

nav.header a.home-link::before {
    content: "";
    display: inline-block;
    position: relative;
    top: -3px;                  /* a quarter of its width above centre */
    width: 12px;
    height: 12px;
    margin-right: 0.8rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    vertical-align: middle;
}

nav.header .links {
    font-family: var(--mono);
    letter-spacing: 0.04em;
    color: var(--faint);
}

/* Page title and time */
.title {
    padding: 2.2rem 2rem 0.2rem;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.asof {
    display: table;             /* shrinks to fit, so it can be centred */
    margin: 3rem auto 2.5rem;
    padding: 0.55rem 1.2rem;
    font-family: var(--mono);
    font-size: 1.2rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(79, 209, 197, 0.35);
    border-radius: 999px;
}

/* Rows of cards */
.home {
    padding-right: 120px;
}

.grid {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 2rem 1.5rem;
    padding: 0 2rem;
}

/* A rule across the page under the last row, above the footer. */
.grid::after {
    content: "";
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    border-top: 1px solid var(--line);
}

.rowtitle {
    padding-top: 0.4rem;
    font-family: var(--mono);
    font-size: 1.08rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faint);
    border-top: 1px solid var(--line);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    align-items: start;         /* a card without an image stays short */
}

div.card {
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

div.card:hover {
    background: var(--panel-hover);
    border-color: #3a4659;
    transform: translateY(-1px);
}

div.card > a {
    display: block;
    border: none;
}

div.card img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #000;
    border-bottom: 1px solid var(--line);
}

div.card img.small {
    width: 100%;
    height: 150px;
}

div.card img.portrait {          /* people: head and shoulders */
    height: 240px;
    object-position: 50% 20%;
}

div.card .name {
    padding: 0.9rem 1rem 0.2rem;
    font-size: 1.05rem;
    font-weight: 600;
}

div.card .name a {
    border: none;
}

div.card .summary {
    padding: 0 1rem;
    font-size: 0.82rem;
    color: var(--muted);
}

div.card .summary:last-child {
    padding-bottom: 0.9rem;
    margin-top: 0.4rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text);
}

div.card .summary a {
    color: inherit;
}

.none {
    padding: 0.4rem 0;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--faint);
}

/* Footer: aligned with the cards (past the row-title column and gap). */
.acks {
    padding: 2rem 2rem 0 calc(2rem + 10rem + 1.5rem);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--faint);
    text-align: left;
}

.acks.fine {
    padding-top: 0.4rem;
    font-size: 0.68rem;
}

.acks a {
    color: var(--muted);
}

/* Time scrubber */
.timeline {
    position: fixed;
    top: 55%;
    right: 0;
    transform: translateY(-50%);
    width: 100px;
    height: 78vh;
    user-select: none;
    touch-action: none;
    cursor: ns-resize;
    z-index: 5;
    outline: none;
}

.timeline::before {                 /* a faint rail */
    content: "";
    position: absolute;
    top: 16px;
    bottom: 16px;
    right: 14px;
    width: 1px;
    background: var(--line);
}

.tick-row {
    position: absolute;
    right: 14px;
    width: 100%;
    height: 1px;
    pointer-events: none;
}

.tick {
    position: absolute;
    right: 0;
    width: 8px;
    height: 1px;
    background: rgba(138, 147, 163, 0.35);
    transform-origin: right center;
}

.tick.major {
    width: 16px;
    background: rgba(138, 147, 163, 0.8);
}

.year-label {
    position: absolute;
    right: 24px;
    top: -0.55em;
    font-family: var(--mono);
    font-size: 0.66rem;
    color: var(--faint);
}

.marker {
    position: absolute;
    right: 8px;
    width: 30px;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
    pointer-events: none;
}

.date-pill {
    position: fixed;
    right: 108px;
    transform: translateY(-50%);
    padding: 0.35rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text);
    background: rgba(28, 34, 48, 0.94);
    border: 1px solid #2f3a4b;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 6;
}

.date-pill.visible {
    opacity: 1;
}

/* Wide screens: some space either side (the scrubber stays at the edge). */
@media (min-width: 1100px) {
    nav.header {
        padding-left: 10%;
        padding-right: 10%;
    }
    .home {
        padding-left: 10%;
        padding-right: max(10%, 120px);
    }
    .grid, .acks {
        padding-right: 0;
    }
    .grid {
        padding-left: 0;
    }
    /* The scrubber sits in the right margin, just outside the cards'
       right edge, rather than at the window edge. */
    .timeline {
        right: calc(max(10%, 120px) - 110px);
    }
    .date-pill {
        right: calc(max(10%, 120px) - 2px);
    }
    .acks {
        padding-left: calc(10rem + 1.5rem);
    }
}

@media (max-width: 700px) {
    .home {
        padding-right: 56px;
    }
    nav.header {
        padding: 0.8rem 1rem;
    }
    .grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0 1rem;
    }
    .rowtitle {
        margin-top: 1.2rem;
    }
    .acks {
        padding-left: 1rem;     /* one column: cards start at the edge */
    }
    .asof {
        margin: 1.5rem auto 1rem;
    }
    nav.header a.home-link {
        font-size: 1.3rem;
    }
    .timeline {
        width: 50px;
    }
    .year-label {
        font-size: 0.58rem;
        right: 20px;
    }
    .date-pill {
        right: 56px;
    }
}

/* ------------------------------------------------------------------------
   Pages other than home: a container with the same margins, sections,
   panels and tables. */

.page {
    padding: 0 2rem;
}

.page .asof {
    margin-top: 2.5rem;
}

footer.foot {
    margin: 2.5rem 2rem 0;
    border-top: 1px solid var(--line);
}

footer.foot .acks {
    padding-left: 0;
    padding-right: 0;
}

footer.foot .acks:first-child {
    padding-top: 1.5rem;
}

.title {
    margin: 0;
    padding: 2rem 0 0.5rem;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 2.2rem 0 0.7rem;
    font-family: var(--mono);
    font-size: 1.08rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

a.button, a.toggle {
    padding: 0.2rem 0.65rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--accent);
    border: 1px solid rgba(79, 209, 197, 0.45);
    border-radius: 999px;
}

.asof a.button {
    margin-left: 0.8rem;
}

a.button:hover, a.toggle:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Tables live in panels, which scroll sideways on narrow screens. */
.panel {
    overflow-x: auto;
    scrollbar-color: var(--line) var(--panel);      /* not a white bar */
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.panel th {
    padding: 0.65rem 0.9rem;
    text-align: left;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: normal;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.panel td {
    padding: 0.55rem 0.9rem;
    vertical-align: top;
    border-bottom: 1px solid rgba(51, 61, 80, 0.6);
}

.panel tbody tr:last-child td {
    border-bottom: none;
}

.panel tbody tr:hover td {
    background: var(--panel-hover);
}

table.history td:first-child {
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--muted);
}

table.ports td:nth-child(3), table.ports td:nth-child(6),
table.ports td:nth-child(7) {
    white-space: nowrap;
}

table.ports td:first-child {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--text);
}

table.history tr.highlight td {
    background: var(--accent-soft);
}

table.history tr.highlight td:first-child {
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

table.planned td {
    font-style: italic;
    color: var(--muted);
}

.src, .step {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--muted);
}

a.src {
    border-bottom-style: dotted;
}

.notice, .list {
    padding: 0.8rem 0;
    color: var(--muted);
}

/* Entity pages: image beside the name and facts. */
.hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5rem 2.5rem;
    padding-top: 2rem;
}

.hero img.entity {
    display: block;
    width: 380px;
    max-width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #000;
}

.hero-text {
    flex: 1 1 320px;
}

.hero .kind {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero .title {
    padding: 0.2rem 0 1rem;
}

table.facts {
    border-collapse: collapse;
    font-size: 0.9rem;
}

table.facts th, table.facts td {
    padding: 0.3rem 1.5rem 0.3rem 0;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(51, 61, 80, 0.5);
}

table.facts th {
    font-weight: normal;
    color: var(--muted);
    white-space: nowrap;
}

/* Wide screens: the same side space as the home page. */
@media (min-width: 1100px) {
    .page {
        padding-left: 10%;
        padding-right: 10%;
    }
    footer.foot {
        margin-left: 10%;
        margin-right: 10%;
    }
}

@media (max-width: 700px) {
    .page {
        padding: 0 1rem;
    }
    footer.foot {
        margin: 2rem 1rem 0;
    }
    .title {
        font-size: 1.6rem;
    }
}

/* ------------------------------------------------------------------------
   Index pages, the Dragon page and error pages. */

.page > .cards {
    margin-top: 0.5rem;
}

/* /vehicles: each family's image beside its list. */
.family-group {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 2rem;
    padding-top: 1rem;
}

.family-group img.family {
    width: 220px;
    height: 150px;
    margin-top: 2.6rem;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #000;
}

.family-list {
    flex: 1 1 360px;
}

/* Every family's table has the same columns. */
table.vehicles {
    table-layout: fixed;
    min-width: 520px;
}

table.vehicles th:nth-child(1) { width: 62%; }
table.vehicles th:nth-child(2) { width: 24%; }

table.vehicles td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* /missions: station filters as chips. */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0 0.5rem;
}

.chip {
    padding: 0.25rem 0.8rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
}

a.chip:hover {
    color: var(--text);
    border-color: #3a4659;
}

.chip.current {
    font-weight: normal;
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(79, 209, 197, 0.45);
}

table.missions td:nth-child(3), table.missions td:nth-child(4) {
    white-space: nowrap;
}

/* The same columns in every year's table. */
table.missions {
    table-layout: fixed;
    min-width: 760px;           /* on phones the panel scrolls instead */
}

table.missions th:nth-child(1) { width: 22%; }
table.missions th:nth-child(2) { width: 24%; }
table.missions th:nth-child(3) { width: 16%; }
table.missions th:nth-child(4) { width: 22%; }

table.missions td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ... and in each of the Dragon page's tables. */
table.fleet {
    table-layout: fixed;
    min-width: 960px;
}

/* (column widths: the <colgroup> in dragon.tpl) */

/* The Dragon page keeps the SpaceX logo, smaller. */
.logo {
    display: block;
    width: 220px;
    max-width: 50%;
    padding-top: 2rem;
    opacity: 0.9;
}

table.fleet td:first-child {
    font-family: var(--mono);
}

/* Error pages. */
.kind {
    padding-top: 2.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero .kind {
    padding-top: 0;
}

.notice a {
    color: var(--text);
}

/* /events: the same columns in every day's table. */
table.events {
    table-layout: fixed;
    min-width: 860px;
}

table.events th:nth-child(1) { width: 15%; }
table.events th:nth-child(2) { width: 11%; }
table.events th:nth-child(3) { width: 16%; }
table.events th:nth-child(4) { width: 18%; }
table.events th:nth-child(5) { width: 20%; }
table.events th:nth-child(7) { width: 6%; }

.chip.feed {
    margin-left: auto;          /* at the right of the window chips */
}
