:root {
    --paper: #faf9f6;
    --ink: #1a1a18;
    --ink-soft: #55534d;
    --accent: #33422f;
    --rule: #ddd9d0;
    --wash: #f1efe9;
    --shadow: rgba(26, 26, 24, 0.07);
    color-scheme: light dark;
}

/* Dark mode: the same palette, inverted, when the device asks for it */
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #161614;
        --ink: #ecebe6;
        --ink-soft: #a9a69d;
        --accent: #a9c39f;
        --rule: #34332e;
        --wash: #23221f;
        --shadow: rgba(0, 0, 0, 0.45);
    }
}

/* More contrast when the device asks for it (light or dark) */
@media (prefers-contrast: more) {
    :root {
        --ink-soft: var(--ink);
        --rule: #8a877f;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: ui-serif, Georgia, "Times New Roman", serif;
    font-size: 112.5%;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Skip link: hidden until a keyboard user tabs to it */
.skip-link {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 20;
    padding: 0.5rem 0.9rem;
    background: var(--paper);
    border: 1px solid var(--rule);
    color: var(--ink);
    font-size: 0.9rem;
    transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 5rem 1.5rem 6rem;
}

header.site {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
header.site > :not(h1, .view-switch, .nav-toggle) { grid-column: 1 / -1; }
/* Pages switched off in the admin (pages.json) */
nav.site a[hidden], .sitemap li[hidden], [data-latest][hidden] { display: none !important; }

/* Link to the desktop theme (desktop.html) */
.view-switch {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--rule);
    border-radius: 3px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    text-decoration: none;
    color: var(--ink-soft);
}
.view-switch:hover { color: var(--ink); border-color: var(--ink-soft); }

/* Home page welcome line: same text style as the About blurb (p.intro),
   with its own divider on top */
p.welcome {
    margin: 0;
    padding: 1.1rem 0;
    border-top: 1px solid var(--rule);
    color: var(--ink-soft);
    font-size: 0.98rem;
}

/* "Now" ticker. Two identical lists each slide left by their own width,
   so the second lands where the first started and the loop is seamless.
   js/site.js sets --ticker-duration for a steady speed and runs the button. */
.ticker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    border-top: 1px solid var(--rule);
}
.ticker-viewport {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.ticker-track { display: flex; }
.ticker-items {
    display: flex;
    flex: 0 0 auto;
    min-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    white-space: nowrap;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    animation: ticker-scroll var(--ticker-duration, 30s) linear infinite;
}
.ticker-items li::after {
    content: "·";
    content: "·" / "";
    padding: 0 1.5em;
}
@keyframes ticker-scroll {
    to { transform: translateX(-100%); }
}
.ticker.is-paused .ticker-items,
.ticker:not(.is-resumed):has(:focus-visible) .ticker-items { animation-play-state: paused; }
@media (hover: hover) {
    .ticker:not(.is-resumed):hover .ticker-items { animation-play-state: paused; }
}
.ticker-toggle {
    flex: none;
    min-width: 5.5rem;
    min-height: 44px;
    padding: 0 0 0 0.5rem;
    border: 0;
    background: none;
    text-align: right;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    cursor: pointer;
}
.ticker-toggle:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
    .ticker-items {
        flex-wrap: wrap;
        flex-shrink: 1;
        min-width: 0;
        white-space: normal;
        animation: none;
    }
    .ticker-items[aria-hidden="true"],
    .ticker-toggle { display: none; }
    .ticker-items li:last-child::after { content: none; }
    .ticker { padding: 0.9rem 0; }
}
header.site h1 {
    font-size: 1.9rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    margin: 0 0 0.35rem;
}
header.site h1 a {
    color: inherit;
    text-decoration: none;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
}
header.site h1 a:hover { text-decoration-line: underline; }
header.site p.tagline {
    margin: 0 0 1.5rem;
    color: var(--ink-soft);
    font-style: italic;
    font-size: 1rem;
}

nav.site {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1.25rem;
}
nav.site a,
nav.site summary {
    font-size: 0.95rem;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid transparent;
}
nav.site a:hover,
nav.site a[aria-current="page"],
nav.site summary:hover,
nav.site summary.current { border-bottom-color: var(--ink); }

/* Portfolio dropdown (a <details> element; js/site.js closes it on outside click) */
nav.site details.menu { position: relative; }
nav.site summary {
    cursor: pointer;
    list-style: none;
}
nav.site summary::-webkit-details-marker { display: none; }
nav.site summary::after {
    content: "▾";
    margin-left: 0.3em;
    font-size: 0.75em;
    color: var(--ink-soft);
}
nav.site details[open] summary::after { content: "▴"; }
nav.site .menu-list {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: -0.9rem;
    z-index: 10;
    min-width: 10rem;
    padding: 0.4rem 0;
    background: var(--paper);
    border: 1px solid var(--rule);
    box-shadow: 0 8px 24px var(--shadow);
}
nav.site .menu-list a {
    display: block;
    padding: 0.35rem 0.9rem;
    border-bottom: 0;
}
nav.site .menu-list a:hover { background: var(--wash); }
nav.site .menu-list a[aria-current="page"] { color: var(--accent); }

/* Phone menu button (shown only on phones, and only with the "js" class:
   set by each page's head script, kept only if js/site.js runs). */
.nav-toggle { display: none; }

hr.rule {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 0 0 2.5rem;
}

h2.section-label {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: 400;
    margin: 0 0 1.75rem;
}

ul.index { list-style: none; margin: 0 0 5rem; padding: 0; }
ul.index li {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 1.25rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--rule);
}
ul.index li:first-child { padding-top: 0; }
/* Stacked lists (Film): date on its own line above the entry */
ul.index.stacked li { grid-template-columns: 1fr; gap: 0.5rem; }
ul.index.stacked time { padding-top: 0; }
ul.index time {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.75rem;
    color: var(--ink-soft);
    padding-top: 0.3rem;
}
ul.index .entry a {
    font-size: 1.15rem;
    text-decoration: none;
    color: var(--ink);
}
ul.index .entry a:hover { color: var(--accent); }
ul.index .excerpt {
    display: block;
    margin-top: 0.35rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

/* Embeds (list pages and home page cards): full width, no border.
   YouTube keeps 16:9; Spotify keeps its fixed height attribute. */
ul.index iframe,
.latest-item iframe {
    display: block;
    width: 100%;
    border: 0;
}
ul.index iframe[src*="youtube"],
.latest-item iframe[src*="youtube"] {
    height: auto;
    aspect-ratio: 16 / 9;
}
ul.index iframe[src*="spotify"],
.latest-item iframe[src*="spotify"] { border-radius: 12px; }

/* Home page "Latest" feature */
.latest { margin: 0 0 4.5rem; }
.latest-card {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--rule);
}
.latest-card:first-child { padding-top: 0; }
.latest-kind {
    margin: 0 0 0.3rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}
.latest-item time {
    display: block;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.75rem;
    color: var(--ink-soft);
}
.latest-item .entry { margin-top: 0.75rem; }
.latest-item .entry > a {
    font-size: 1.3rem;
    text-decoration: none;
    color: var(--ink);
}
.latest-item .entry > a:hover { color: var(--accent); }
.latest-item .excerpt {
    display: block;
    margin: 0.5rem 0 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
}
.latest-more {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

p.intro {
    color: var(--ink-soft);
    font-size: 0.98rem;
}

article.post h2.post-title {
    font-size: 1.6rem;
    font-weight: 400;
    margin: 0 0 0.4rem;
}
article.post .meta {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.75rem;
    color: var(--ink-soft);
    margin-bottom: 2.25rem;
    display: block;
}
article.post p { margin: 0 0 1.4rem; }
article.post.verse p { text-align: center; margin-bottom: 0.9rem; }
article.post.verse .post-title,
article.post.verse .meta { text-align: center; }
article.post p.lede::first-letter {
    font-size: 3.2rem;
    line-height: 0.8;
    float: left;
    padding: 0.1rem 0.5rem 0 0;
    color: var(--accent);
}
article.post blockquote {
    margin: 2rem 0;
    padding-left: 1.25rem;
    border-left: 2px solid var(--rule);
    color: var(--ink-soft);
    font-style: italic;
}
article.post pre {
    background: var(--wash);
    padding: 1rem 1.1rem;
    overflow-x: auto;
    font-size: 0.85rem;
    border-radius: 3px;
}
article.post code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85em;
}
/* Extra elements that Markdown blog posts can produce */
article.post h2:not(.post-title),
article.post h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 2.25rem 0 0.75rem;
}
article.post ul,
article.post ol { margin: 0 0 1.4rem; padding-left: 1.4rem; }
article.post li { margin-bottom: 0.4rem; }
article.post img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2rem auto;
}
/* Blog: cover image (top) and photo attachments (bottom) */
article.post .post-cover { margin: 1.5rem auto 2rem; }
article.post .post-photos { display: grid; gap: 1.5rem; margin: 2.5rem 0 0; }
article.post .post-photos figure { margin: 0; }
article.post .post-photos img { margin: 0 auto; }
article.post .post-photos figcaption { margin-top: 0.5rem; font-size: 0.9rem; color: var(--ink-soft); text-align: center; }
article.post hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 2.5rem 0;
}
.post-back { margin: 3rem 0 0; font-size: 0.9rem; }

footer.site {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* Footer site map: three short columns of links */
footer.site .sitemap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}
footer.site .sitemap h2 {
    margin: 0 0 0.6rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
footer.site .sitemap ul { list-style: none; margin: 0; padding: 0; }
footer.site .sitemap li { margin: 0.3rem 0; }
footer.site .sitemap a { color: var(--ink); text-decoration: none; }
footer.site .sitemap a:hover { text-decoration: underline; }
footer.site p { margin: 0; }

/* Services list (services.html) */
ul.services { list-style: none; margin: 2rem 0; padding: 0; }
ul.services li { padding: 1.1rem 0; border-top: 1px solid var(--rule); }
ul.services li:last-child { border-bottom: 1px solid var(--rule); }
ul.services h4 { margin: 0 0 0.3rem; font-size: 1.05rem; }
ul.services p { margin: 0; color: var(--ink-soft); }
.services-heading {
    margin: 2.5rem 0 0;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.services-heading + ul.services { margin-top: 0.75rem; }
/* Rates: the price sits to the right of the service name */
ul.services.rates li { display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; }
ul.services.rates li > p:not(.price) { grid-column: 1 / -1; }
ul.services.rates p.price { grid-row: 1; grid-column: 2; color: var(--ink); font-weight: 700; white-space: nowrap; }
/* Tools and equipment: small labels that wrap */
ul.tools { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 2rem; padding: 0; }
ul.tools li { padding: 0.3rem 0.65rem; border: 1px solid var(--rule); border-radius: 3px; font-size: 0.9rem; }

/* Admin page (admin/index.html) */
.admin-title { font-size: 1.9rem; font-weight: 400; margin: 0 0 2rem; }
ul.admin-links { list-style: none; margin: 0 0 2rem; padding: 0; }
ul.admin-links li { padding: 1.1rem 0; border-top: 1px solid var(--rule); }
ul.admin-links li:last-child { border-bottom: 1px solid var(--rule); }
ul.admin-links a { font-size: 1.2rem; }
ul.admin-links p { margin: 0.3rem 0 0; color: var(--ink-soft); }
.admin-note { color: var(--ink-soft); font-size: 0.9rem; }

/* Admin changelog (admin/changelog.html) */
.cl-back { margin: 0 0 1.5rem; font-size: 0.9rem; }
.cl-back a { color: var(--ink-soft); }
.cl-search { margin: 1.5rem 0 0.75rem; }
.cl-search label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.cl-search input {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--rule);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}
.cl-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cl-status { margin: 0 0 1.5rem; color: var(--ink-soft); font-size: 0.9rem; }
.cl-day { border-top: 1px solid var(--rule); }
.cl-day:last-child { border-bottom: 1px solid var(--rule); }
.cl-day summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    cursor: pointer;
    list-style: none;
}
.cl-day summary::-webkit-details-marker { display: none; }
.cl-day summary h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.cl-day summary h2::before { content: "▸ "; color: var(--ink-soft); font-weight: 400; }
.cl-day[open] summary h2::before { content: "▾ "; }
.cl-count {
    flex: none;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.cl-entry { padding: 0 0 1.25rem; }
.cl-entry h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.cl-entry ul { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.cl-entry li { margin: 0.3rem 0; }
.cl-entry p { margin: 0 0 0.5rem; }
.cl-entry code { font-size: 0.9em; }

/* Contact page email link */
p.contact-email { font-size: 1.25rem; margin: 1.5rem 0; overflow-wrap: anywhere; }

@media (max-width: 480px) {
    body { font-size: 106.25%; }
    .wrap { padding: 3rem 1.25rem 4rem; }
    ul.index li { grid-template-columns: 1fr; gap: 0.35rem; }
    ul.index time { padding-top: 0; }
    hr.rule { margin-bottom: 2.25rem; }
    footer.site .sitemap { gap: 1rem; }
    /* Six nav links: tighter gaps keep them on one line on most phones */
    nav.site { column-gap: 0.7rem; }
    /* The Desktop view link is only in the footer site map on phones */
    .view-switch { display: none; }

    /* Collapsible menu: the Menu button sits beside the name, and the links
       open as a stacked list below the tagline. */
    .js .nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        grid-row: 1;
        grid-column: 2;
        min-height: 44px;
        padding: 0 0.75rem;
        border: 1px solid var(--rule);
        border-radius: 3px;
        background: none;
        font-family: ui-monospace, "SF Mono", Menlo, monospace;
        font-size: 0.7rem;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--ink);
        cursor: pointer;
    }
    .js .nav-toggle-icon { font-size: 1rem; letter-spacing: 0; }
    .js nav.site { display: none; }
    .js nav.site.is-open {
        display: block;
        margin-bottom: 0.5rem;
        border-top: 1px solid var(--rule);
    }
    .js nav.site.is-open a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--rule);
        font-size: 1.05rem;
    }
    .js nav.site.is-open a[aria-current="page"] { color: var(--accent); font-weight: 700; border-bottom-color: var(--rule); }
}

/* Windows high-contrast (forced colors): keep the current page marked */
@media (forced-colors: active) {
    nav.site a[aria-current="page"],
    nav.site summary.current { text-decoration: underline; }
    .view-switch, nav.site .menu-list { border-color: CanvasText; }
}

/* Printing: just the content */
@media print {
    .skip-link, .view-switch, .nav-toggle, nav.site, .sitemap, .ticker, .latest-more { display: none; }
    body { background: #fff; color: #000; }
    .wrap { max-width: none; padding: 0; }
    a { color: inherit; }
    iframe { display: none; }
}
