/* Emily Speed — public site. Palette and type follow the design mockup; the name is set in Josefin Sans. */

:root {
    --bg: #ffffff;
    --ink: #38352e;
    --muted: #6e675d;
    --accent: #b67a54;
    --accent-dark: #8f5b3b;
    --panel: #ffffff;
    --gutter: 40px;
    --font: "Stack Sans Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* The name "Emily Speed" only. */
.site-name,
.home-name {
    font-family: "Josefin Sans", "Stack Sans Text", system-ui, sans-serif;
    font-weight: 700;
    text-transform: uppercase;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-weight: 300;
    font-size: 17px;
    line-height: 1.6;
}

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Header & nav (inner pages) ---- */

.site-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: var(--gutter) var(--gutter) 24px;
}

.site-name {
    flex: 1 1 auto;
    color: var(--accent);
    font-size: 36px;
    letter-spacing: 0.04em;
    text-decoration: none;
    line-height: 1;
}

.site-nav ul,
.home-nav ul { list-style: none; margin: 0; padding: 0; }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 6px 28px; }

.site-nav a,
.home-nav a {
    color: var(--accent);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 400;
    font-size: 15px;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

/* ---- Front page ---- */

.home-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 60px 60px 0;
}

.home-name { margin: 0; font-size: clamp(34px, 8vw, 52px); line-height: 1; letter-spacing: 0.03em; white-space: nowrap; }
.home-name a { color: var(--accent); text-decoration: none; }

.home-content { display: flex; gap: 50px; padding-top: 100px; align-items: flex-start; }
.home-nav { flex: 0 0 180px; }
.home-nav li { margin-bottom: 6px; }
.home-nav a { font-size: 20px; }
.home-image { flex: 1 1 auto; }
.home-image img { display: block; max-height: 70vh; width: auto; }

/* ---- Generic page ---- */

.page { flex: 1; padding: 0 var(--gutter) var(--gutter); max-width: 1200px; width: 100%; }

.page-title {
    margin: 8px 0 24px;
    font-size: 22px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.prose { max-width: 70ch; }
.prose p, .prose div { margin: 0 0 1em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-size: 1.05em; font-weight: 600; margin: 1.6em 0 0.6em; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.5em; font-size: 0.95em; }
.prose td, .prose th { text-align: left; vertical-align: top; padding: 4px 16px 4px 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.prose td:first-child { white-space: nowrap; color: var(--muted); }
.prose blockquote { margin: 0 0 1em; padding-left: 1em; border-left: 3px solid var(--accent); }

/* ---- Sectioned pages (CV, links) ---- */

.entry-section { margin-top: 2em; }
.prose .entry-section h2 {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.8em;
}
.cv-list, .link-list { list-style: none; margin: 0; padding: 0; }
.cv-list li, .link-list li { padding: 4px 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.link-desc { display: block; font-size: 0.92em; color: var(--muted); }

/* ---- Section grid ---- */

.work-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 32px 24px;
}

.work-grid a { display: block; text-decoration: none; color: var(--ink); }
.work-grid-image {
    display: block;
    aspect-ratio: 4 / 5;
    background: var(--panel);
    overflow: hidden;
}
.work-grid-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.work-grid a:hover img { transform: scale(1.04); }
.work-grid-title { display: block; margin-top: 8px; font-size: 15px; line-height: 1.35; }
.work-grid a:hover .work-grid-title { color: var(--accent-dark); }

/* ---- Work page ---- */

.work-layout {
    flex: 1;
    display: flex;
    gap: 40px;
    padding: 0 var(--gutter) var(--gutter);
}

.work-list {
    flex: 0 0 250px;
    position: sticky;
    top: 24px;
    align-self: flex-start;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 14px 12px 14px 16px;
    /* A faint tint of the text colour over the page background. */
    background: var(--bg);
    background: color-mix(in srgb, var(--ink) 4%, var(--bg));
    border-radius: 3px;
    /* Thin scrollbar in the text colours. */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--accent-dark) 45%, transparent) transparent;
}
.work-list::-webkit-scrollbar { width: 6px; }
.work-list::-webkit-scrollbar-track { background: transparent; }
.work-list::-webkit-scrollbar-thumb {
    background: var(--muted);
    background: color-mix(in srgb, var(--accent-dark) 45%, transparent);
    border-radius: 3px;
}
.work-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.work-list summary {
    list-style: none;
    cursor: pointer;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
    margin-bottom: 8px;
}
.work-list summary::-webkit-details-marker { display: none; }
.work-list ul { list-style: none; margin: 0; padding: 0; }
.work-list li { margin-bottom: 7px; line-height: 1.15; }
.work-list a { color: var(--ink); text-decoration: none; font-size: 15px; }
.work-list a:hover { color: var(--accent-dark); }
.work-list a[aria-current="page"] { color: var(--accent-dark); font-weight: 500; }

.work { flex: 1 1 auto; min-width: 0; }
.work-title { margin: 0; font-size: 28px; font-weight: 500; line-height: 1.2; }
.work-materials { margin: 6px 0 0; color: var(--muted); font-style: italic; }
.work-header { margin-bottom: 20px; }
.work-description { margin-top: 28px; }

/* ---- Carousel ---- */

.carousel { position: relative; }

.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    background: var(--panel);
}
.carousel-track::-webkit-scrollbar { display: none; }

.carousel-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: min(70vh, 720px);
    padding: 12px;
}
.carousel-slide img,
.carousel-slide video {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    width: auto;
    height: auto;
    object-fit: contain;
}
.carousel-slide img { cursor: zoom-in; }
.carousel-slide iframe { width: 100%; height: 100%; border: 0; }
.carousel-slide figcaption { flex: none; font-size: 14px; color: var(--muted); padding-top: 8px; text-align: center; }

.carousel-btn,
.lightbox-btn,
.lightbox-close {
    position: absolute;
    border: 0;
    background: rgba(255,255,255,.75);
    color: var(--ink);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0 0 4px;
    transition: background .2s;
}
.carousel-btn:hover, .lightbox-btn:hover, .lightbox-close:hover { background: #fff; }
.carousel-btn[disabled], .lightbox-btn[disabled] { opacity: .3; cursor: default; }
.carousel-btn { top: calc(min(70vh, 720px) / 2 - 22px); }
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

.carousel-thumbs {
    list-style: none;
    margin: 12px 0 0;
    padding: 0 0 4px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}
.carousel-thumbs button {
    display: block;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    background: var(--panel);
    cursor: pointer;
    opacity: .6;
    transition: opacity .2s;
}
.carousel-thumbs button:hover { opacity: 1; }
.carousel-thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.carousel-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-video {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--muted);
    font-size: 24px;
    /* A faint tint behind the play icon, so it reads as a thumbnail, not a button. */
    background: var(--bg);
    background: color-mix(in srgb, var(--ink) 8%, var(--bg));
}

/* ---- Lightbox ---- */

.lightbox {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(20, 22, 24, .96);
    color: #eee;
    overflow: hidden;
}
.lightbox::backdrop { background: rgba(20, 22, 24, .96); }
.lightbox[open] { display: flex; flex-direction: column; }

.lightbox-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}
.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transform-origin: 0 0;
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox.zoomed .lightbox-stage img { cursor: grab; }
.lightbox-caption { margin: 0; padding: 8px 60px 16px; text-align: center; font-size: 14px; min-height: 1.5em; }
.lightbox-close { top: 16px; right: 16px; font-size: 28px; }
.lightbox-btn { top: 50%; transform: translateY(-50%); }
.lightbox-btn.prev { left: 16px; }
.lightbox-btn.next { right: 16px; }

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

.site-footer { padding: 24px var(--gutter); font-size: 13px; color: var(--muted); }

/* ---- Small screens ---- */

@media (max-width: 700px) {
    :root { --gutter: 20px; }

    .site-header { flex-direction: column; align-items: flex-start; gap: 16px; padding-top: 24px; }
    .site-name { font-size: 30px; }
    .site-nav ul { gap: 6px 18px; }

    .home-main { padding: 32px 20px 0; }
    .home-content { flex-direction: column; gap: 28px; padding-top: 56px; }
    .home-nav { flex: none; }
    .home-image img { max-height: none; width: 100%; }

    .work-grid { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; }

    .work-layout { flex-direction: column; gap: 16px; }
    .work-list {
        position: static;
        max-height: none;
        flex: none;
        width: 100%;
        padding: 10px 14px;
    }
    .work-list summary::after { content: " ▾"; }
    .work-list[open] summary::after { content: " ▴"; }

    .carousel-slide { height: 60vh; padding: 0; }
    .carousel-btn { top: calc(30vh - 22px); width: 36px; height: 36px; font-size: 24px; }
    .carousel-thumbs button { width: 56px; height: 56px; }
    .lightbox-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .carousel-track { scroll-behavior: auto; }
    .work-grid-image img { transition: none; }
}
