/* Shared foundation for every page of jj-lombardo.
   White on black, nothing else: hairlines for structure, one grotesque for
   headings and labels, one for text. Page-specific layout lives in a small
   <style> block on each page. */

@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('assets/fonts/space-grotesk-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'Archivo';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('assets/fonts/archivo-latin.woff2') format('woff2');
}

:root {
    color-scheme: dark;
    --fg: #fff;
    --rule: rgba(255, 255, 255, 0.18);
    --rule-soft: rgba(255, 255, 255, 0.08);
    --sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --text: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --pad: clamp(20px, 3.2vw, 48px);
}

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

html {
    background: #000;
    scrollbar-color: #fff #000;
    scrollbar-width: thin;
    -webkit-text-size-adjust: 100%;
}

/* --- Scrollbars ----------------------------------------------------------- */
/* White on black, squared off like the rest of the page furniture. */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: #fff;
    border: 2px solid #000;
}

::-webkit-scrollbar-thumb:hover {
    background: #fff;
}

::-webkit-scrollbar-corner {
    background: #000;
}

::-webkit-scrollbar-button {
    display: none;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background: #000;
    color: var(--fg);
    font-family: var(--text);
    font-size: clamp(1rem, 0.94rem + 0.32vw, 1.14rem);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.leaving {
    opacity: 0;
    transition: opacity 300ms ease;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--rule);
    text-underline-offset: 4px;
    transition: text-decoration-color 160ms ease, text-decoration-thickness 160ms ease;
}

a:hover {
    text-decoration-color: var(--fg);
    text-decoration-thickness: 1.5px;
}

::selection {
    background: #fff;
    color: #000;
}

:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--sans);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
}

/* --- Shell ---------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(220px, 22vw, 320px);
    width: 100%;
    max-width: 1520px;
    min-height: 100vh;
}

.main {
    min-width: 0;
    padding: clamp(28px, 3.4vw, 52px) var(--pad) clamp(56px, 8vw, 104px);
}

/* --- Masthead ------------------------------------------------------------- */

.masthead {
    margin-bottom: clamp(22px, 3vw, 36px);
}

.kicker {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.34em;
    text-transform: uppercase;
}

.title {
    font-size: clamp(2.3rem, 7.2vw, 5.4rem);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: -0.04em;
    line-height: 0.88;
    /* the full name is long: when it has to break, break it evenly */
    text-wrap: balance;
    margin: 0.16em 0 0;
}

/* The author credit under the big name: a hairline, then the pen name. */
.byline {
    margin-top: clamp(16px, 2vw, 26px);
    padding-top: 0.8rem;
    border-top: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.byline span {
    color: var(--fg);
}

/* Interior pages carry the name small and set the page title below it. */
.brand {
    font-family: var(--sans);
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.brand a {
    text-decoration: none;
}

.brand a:hover {
    text-decoration: underline;
    text-underline-offset: 6px;
}

.page-head {
    margin-bottom: clamp(28px, 4vw, 48px);
}

.page-head h1 {
    font-size: clamp(1.8rem, 3.4vw, 2.75rem);
    letter-spacing: -0.025em;
    margin-top: 0.9rem;
    text-wrap: balance;
}

.lede {
    max-width: 42ch;
    margin-top: 1rem;
    line-height: 1.55;
}

.lede strong {
    font-weight: 600;
}

/* the one link in the opening line: underlined in full white */
.lede a {
    text-decoration-color: var(--fg);
    text-underline-offset: 4px;
}

/* --- Frames around artwork ------------------------------------------------ */

.frame {
    margin: 0;
    display: block;
}

.frame img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--rule);
    background: #000;
    /* artwork is not content: nothing to select or drag */
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

/* --- Blocks --------------------------------------------------------------- */

.block {
    margin-top: clamp(32px, 4.6vw, 60px);
}

.block-head {
    padding-top: 0.8rem;
    border-top: 1px solid var(--rule);
    margin-bottom: clamp(14px, 2vw, 24px);
}

.block-head h2 {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
}

.note {
    max-width: 42ch;
    margin-top: 0.9rem;
    line-height: 1.55;
}

/* --- Sidebar -------------------------------------------------------------- */

.side {
    border-left: 1px solid var(--rule);
    padding: clamp(24px, 3vw, 40px) clamp(16px, 1.8vw, 26px) 48px;
    font-size: 0.95em;
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 2.6vw, 32px);
}

.side-label {
    margin-bottom: 0.75rem;
    font-family: var(--sans);
    font-size: 0.64rem;
    font-weight: 500;
    letter-spacing: 0.32em;
    text-transform: uppercase;
}

.side nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.12rem;
}

/* Group headings inside the page nav: design, then writing. */
.side-group {
    margin: 0.95rem 0 0.3rem;
    font-family: var(--sans);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.side nav a {
    display: block;
    padding: 0.1rem 0;
    font-family: var(--sans);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.side nav a:hover,
.side nav a[aria-current='page'] {
    text-decoration: underline;
    text-decoration-color: var(--fg);
    text-underline-offset: 4px;
}

.side-entries {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.side-entries a {
    display: block;
    text-decoration: none;
}

.side-entries a:hover .entry-name {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.side-entries time {
    display: block;
    font-family: var(--sans);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.entry-name {
    font-family: var(--sans);
    font-size: 0.86rem;
}

/* The one-line status note under "Now". */
.side-note {
    font-size: 0.92em;
    line-height: 1.5;
    text-wrap: pretty;
}

.sep {
    border: 0;
    border-top: 1px solid var(--rule-soft);
    margin: 0;
}

/* The colophon: the name, the name the work carries, and the feed. */
.side-foot {
    margin-top: auto;
    padding-top: 0.6rem;
    font-family: var(--sans);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.side-foot p + p {
    margin-top: 0.4rem;
}

.foot-name {
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.foot-author {
    color: rgba(255, 255, 255, 0.6);
}

/* The sidebar is a control panel: it stays put while the column scrolls. */
@media (min-width: 861px) {
    .side {
        position: sticky;
        top: 0;
        align-self: start;
        height: 100vh;
        overflow-y: auto;
    }
}

/* --- Prose ---------------------------------------------------------------- */

.prose {
    max-width: 36em;
}

.prose p {
    line-height: 1.7;
    margin-bottom: 1.15em;
}

.prose p:last-child {
    margin-bottom: 0;
}

/* --- Way out -------------------------------------------------------------- */

.back {
    display: inline-block;
    margin-top: clamp(36px, 4.5vw, 56px);
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-decoration: none;
}

.back:hover {
    text-decoration: underline;
    text-underline-offset: 5px;
}

/* --- Load bar ------------------------------------------------------------- */
/* A white hairline sweeps across the top of the page on every load, so a
   refresh or a page change reads as a deliberate arrival. CSS only, so it
   costs no script and needs nothing added to the HTML. */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #fff;
    transform-origin: 0 50%;
    animation: loadbar 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    pointer-events: none;
    z-index: 1200;
}

@keyframes loadbar {
    0% {
        transform: scaleX(0);
        opacity: 1;
    }
    70% {
        transform: scaleX(1);
        opacity: 1;
    }
    100% {
        transform: scaleX(1);
        opacity: 0;
    }
}

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

@media (max-width: 860px) {
    .shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .side {
        border-left: 0;
        border-top: 1px solid var(--rule);
        padding: clamp(22px, 5vw, 34px) var(--pad) 40px;
    }
}

/* --- Large screens: laptops stepped up, then televisions ---------------- */

/* Big displays get a bigger page rather than a small column in the middle. */
@media (min-width: 1800px) {
    html {
        font-size: 18px;
    }

    .shell {
        max-width: 2200px;
        grid-template-columns: minmax(0, 1fr) clamp(300px, 18vw, 400px);
    }

    /* Seen from across a room, the small labels grow with everything else. */
    .kicker,
    .block-head h2,
    .side-label {
        font-size: 0.74rem;
    }

    .side-group {
        font-size: 0.66rem;
    }

    .side nav a {
        font-size: 0.92rem;
    }

    .side-entries time {
        font-size: 0.68rem;
    }

    .entry-name {
        font-size: 0.95rem;
    }

    .side-foot {
        font-size: 0.8rem;
    }
}

@media (min-width: 2560px) {
    html {
        font-size: 21px;
    }

    .shell {
        max-width: 2900px;
        grid-template-columns: minmax(0, 1fr) clamp(380px, 18vw, 470px);
    }
}

/* 4K televisions: still one readable column, just built at TV scale. */
@media (min-width: 3200px) {
    html {
        font-size: 24px;
    }

    .shell {
        max-width: 3200px;
        grid-template-columns: minmax(0, 1fr) clamp(420px, 17vw, 560px);
    }

    .title {
        font-size: clamp(2.5rem, 6vw, 7.5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.leaving,
    a {
        transition: none;
    }

    body::before {
        display: none;
    }
}
