/* ==========================================================================
   James O'Sullivan - shared stylesheet
   Dark technical system. Bands set their own palette via local custom
   properties, so a dark hero and a light reading body can sit on one page.
   ========================================================================== */

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

:root {
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --ink:        #0D0F12;
    --ink-raised: #131519;
    --ink-line:   #22262D;
    --ink-text:   #E8E9EC;
    --ink-muted:  #8B909A;
    --ink-dim:    #858B95;
    --ink-accent: #5DCAA5;

    --paper:        #FAFAF8;
    --paper-raised: #FFFFFF;
    --paper-line:   #E6E6E2;
    --paper-text:   #14161A;
    --paper-muted:  #5F646D;
    --paper-dim:    #6E747E;
    --paper-accent: #0F6E56;

    --nav-h: 60px;
    --radius: 8px;
    --ease: 0.22s ease;
}

/* --- Bands ---------------------------------------------------------------
   Every component below reads --bg / --fg / --accent and so on, which means
   the same markup renders correctly on either surface.
   ------------------------------------------------------------------------ */

.band-dark {
    --bg: var(--ink);
    --surface: var(--ink-raised);
    --line: var(--ink-line);
    --fg: var(--ink-text);
    --muted: var(--ink-muted);
    --dim: var(--ink-dim);
    --accent: var(--ink-accent);
    --on-accent: #04342C;
    background: var(--bg);
    color: var(--fg);
}

.band-light {
    --bg: var(--paper);
    --surface: var(--paper-raised);
    --line: var(--paper-line);
    --fg: var(--paper-text);
    --muted: var(--paper-muted);
    --dim: var(--paper-dim);
    --accent: var(--paper-accent);
    --on-accent: #FFFFFF;
    background: var(--bg);
    color: var(--fg);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--ink);
    color: var(--ink-text);
    line-height: 1.7;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 28px;
}

.mono { font-family: var(--mono); }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Navigation ---------------------------------------------------------- */

nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(13, 15, 18, 0.86);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--ease);
}

nav.scrolled { border-bottom-color: var(--ink-line); }

nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
}

nav .logo {
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--ink-accent);
    letter-spacing: -0.01em;
}

nav .logo span { color: var(--ink-dim); }

nav ul {
    list-style: none;
    display: flex;
    gap: 26px;
}

nav ul a {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-muted);
    transition: color var(--ease);
}

nav ul a:hover { color: var(--ink-accent); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 20px; height: 1.5px;
    background: var(--ink-text);
    margin: 5px 0;
    transition: var(--ease);
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
    padding: calc(var(--nav-h) + 3rem) 0 84px;
}

.hero-eyebrow {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 18px;
}

.hero-eyebrow a { color: var(--accent); transition: opacity var(--ease); }
.hero-eyebrow a:hover { opacity: 0.7; }
.hero-eyebrow .sep { color: var(--dim); margin: 0 8px; }
.hero-eyebrow .here { color: var(--dim); }

.hero h1 {
    font-size: 3.1rem;
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 18px;
}

.hero .tagline {
    font-size: 1.08rem;
    color: var(--muted);
    max-width: 660px;
    line-height: 1.72;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin-top: 28px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--dim);
}

.hero-meta a { color: var(--accent); transition: opacity var(--ease); }
.hero-meta a:hover { opacity: 0.7; }
.hero-meta .sep { opacity: 0.4; }

/* Logo plate sitting on the dark hero */
.hero-brand {
    display: inline-block;
    background: #FFFFFF;
    border-radius: 10px;
    padding: 16px 24px;
    margin-bottom: 26px;
}

.hero-brand img { height: 48px; width: auto; }

.hero-brand.is-shot {
    padding: 0;
    overflow: hidden;
    max-width: 440px;
}

.hero-brand.is-shot img { height: auto; width: 100%; }

/* --- Dither transition ---------------------------------------------------
   Chunky pixel dissolve from the dark hero into the light reading body.
   The tile's top row is solid, so it butts up against the hero seamlessly.
   ------------------------------------------------------------------------ */

.dither {
    height: 98px;
    background-color: var(--paper);
    background-repeat: repeat-x;
    background-position: top left;
    background-size: 1596px 98px;
}

/* Five hand-seeded patterns. Each is 1596px of non-repeating blocks, so the
   run of pixels never reads as a tiled motif at normal viewport widths.
   a, c and e dissolve downward (dark above). b and d dissolve upward. */
.dither.pat-a { background-image: url("dither-a.svg"); }
.dither.pat-b { background-image: url("dither-b.svg"); }
.dither.pat-c { background-image: url("dither-c.svg"); }
.dither.pat-d { background-image: url("dither-d.svg"); }
.dither.pat-e { background-image: url("dither-e.svg"); }

/* Divider: dissolve up into a solid bar, then back down. */
.divider { background: var(--ink); }
.divider .dither:first-child { margin-bottom: 22px; }

/* --- Sections ------------------------------------------------------------ */

section { padding: 84px 0; }

/* Tighten up wherever one band meets another, so the dissolve does the
   separating rather than a large gap. 2rem each side of a transition. */
.hero:has(+ section),
.hero:has(+ .dither),
section:has(+ .dither),
section:has(+ .divider) { padding-bottom: 2rem; }

/* Project page heroes (the ones that dissolve straight into a light body)
   sit tighter under the nav than the homepage. */
.hero:has(+ .dither) { padding-top: 5rem; }

.hero + section,
.dither + section,
.divider + section { padding-top: 2rem; }

.section-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-bottom: 30px;
}

.prose { max-width: 720px; }

/* Section content with a portrait alongside it. The photo stretches to the
   full height of the text beside it, with a floor for short sections. */
.split {
    display: flex;
    align-items: stretch;
    gap: 48px;
}

.split-body {
    flex: 1 1 auto;
    min-width: 0;
}

.split-photo {
    flex: 0 0 300px;
    min-height: 340px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.split-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 18%;
}

/* Prose that runs the full container so floated photos can sit in the
   right-hand space and the text wraps against them. */
/* flow-root makes this box contain its floats. Without it the section's
   height ignores the photos and the last one spills over the dither band. */
.prose-wrapped {
    max-width: none;
    display: flow-root;
}

.side-photo {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    line-height: 0;
    margin-bottom: 18px;
    /* clear: both keeps left and right photos from ever sitting level with
       each other, which would squeeze the text between them to a sliver. */
    clear: both;
}

.side-photo img { width: 100%; height: auto; }

.side-photo.to-right { float: right; margin-left: 32px; }
.side-photo.to-left  { float: left;  margin-right: 32px; }

/* Reusable size scale. Mix them within a section so the photos never look
   like a uniform column. */
.side-photo.size-xs { width: 260px; }
.side-photo.size-sm { width: 300px; }
.side-photo.size-md { width: 340px; }
.side-photo.size-lg { width: 400px; }
.side-photo.size-xl { width: 440px; }

.prose p {
    color: var(--muted);
    margin-bottom: 24px;
}

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

.prose h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--fg);
    margin: 8px 0 14px;
}

.prose strong { color: var(--fg); font-weight: 500; }

.prose ul {
    list-style: none;
    margin: 0 0 24px;
}

.prose ul li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 10px;
    color: var(--muted);
}

.prose ol {
    list-style: none;
    counter-reset: step;
    margin: 0 0 24px;
}

.prose ol li {
    position: relative;
    padding-left: 34px;
    margin-bottom: 10px;
    color: var(--muted);
    counter-increment: step;
}

.prose ol li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
}

.prose ul li::before {
    content: "";
    position: absolute;
    left: 0; top: 0.72em;
    width: 6px; height: 6px;
    background: var(--accent);
}

/* :not(.btn) matters here. Without it this rule outranks .btn-primary and
   paints accent-coloured text onto an accent-coloured button. */
.prose a:not(.btn) {
    color: var(--accent);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    transition: border-color var(--ease);
}

.prose a:not(.btn):hover { border-bottom-color: var(--accent); }

.note {
    border-left: 2px solid var(--accent);
    background: var(--surface);
    padding: 20px 24px;
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 0.96rem;
}

.band-light .note { border: 1px solid var(--line); border-left: 2px solid var(--accent); }

/* --- Project grid -------------------------------------------------------- */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 6px;
}

.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color var(--ease), transform var(--ease);
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* The whole tile is the hit area. The anchor stays a real link for keyboard
   and screen reader users; its ::after simply stretches over the card. */
.project-card:has(.card-link) { cursor: pointer; }

.card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 12px;
}

.project-card:hover .card-link.btn-primary {
    background: transparent;
    color: var(--accent);
}

.card-link:focus-visible::after {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}

.card-link:focus-visible { outline: none; }

.project-card-image {
    height: 148px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 28px;
    border-bottom: 1px solid var(--line);
}

.project-card-image img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

.project-card-image.is-shot { padding: 0; }

.project-card-image.is-shot img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.project-card-image.is-empty {
    background: var(--surface);
    border-bottom-color: var(--line);
}

.project-card-image .placeholder-text {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--dim);
}

.project-card-body {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-status {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}

.card-status.is-past { color: var(--dim); }

.project-card-body h3 {
    font-size: 1.12rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.project-card-body p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.65;
    margin-bottom: 18px;
}

.project-card-links { margin-top: auto; }

/* --- Buttons ------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 10px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    color: var(--fg);
    cursor: pointer;
    transition: border-color var(--ease), color var(--ease), background var(--ease);
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 40px;
    transition: color var(--ease), gap var(--ease);
}

.back-link:hover { color: var(--accent); gap: 12px; }

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

footer {
    border-top: 1px solid var(--ink-line);
    background: var(--ink);
    color: var(--ink-dim);
    padding: 40px 0;
    font-family: var(--mono);
    font-size: 0.78rem;
}

footer .container {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 26px;
    align-items: center;
    justify-content: space-between;
}

footer nav { position: static; background: none; border: none; backdrop-filter: none; }

footer .footer-links { display: flex; flex-wrap: wrap; gap: 22px; }

footer a { color: var(--ink-muted); transition: color var(--ease); }
footer a:hover { color: var(--ink-accent); }

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

/* Narrower screens keep the photos as part-width floats so they stay
   decorative and the text still breaks around them. They never go full
   width, which would turn the section into a photo album. */
@media (max-width: 900px) {
    .split { flex-direction: column; align-items: flex-start; gap: 26px; }

    .split-photo {
        flex: none;
        width: 210px;
        min-height: 0;
        position: static;
    }

    .split-photo img { position: static; height: auto; }

    .side-photo.to-right { margin-left: 24px; }
    .side-photo.to-left  { margin-right: 24px; }

    .side-photo.size-xs { width: 34%; }
    .side-photo.size-sm { width: 40%; }
    .side-photo.size-md { width: 44%; }
    .side-photo.size-lg { width: 48%; }
    .side-photo.size-xl { width: 52%; }
}

@media (max-width: 560px) {
    .side-photo { margin-bottom: 14px; }
    .side-photo.to-right { margin-left: 16px; }
    .side-photo.to-left  { margin-right: 16px; }

    .side-photo.size-xs { width: 30%; }
    .side-photo.size-sm { width: 34%; }
    .side-photo.size-md { width: 38%; }
    .side-photo.size-lg { width: 42%; }
    .side-photo.size-xl { width: 44%; }

    /* Short measures beside a float leave ragged gaps without this. */
    .prose-wrapped p { hyphens: auto; -webkit-hyphens: auto; text-wrap: pretty; }
}

@media (max-width: 820px) {
    .hero { padding: calc(var(--nav-h) + 2rem) 0 60px; }
    .hero h1 { font-size: 2.2rem; }
    .hero .tagline { font-size: 1rem; }

    section { padding: 56px 0; }
    .section-title { font-size: 1.45rem; }

    .projects-grid { grid-template-columns: 1fr; }

    .dither { height: 70px; background-size: 1140px 70px; }
    .divider .dither:first-child { margin-bottom: 16px; }

    nav ul { display: none; }

    nav ul.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--nav-h);
        left: 0; right: 0;
        background: var(--ink);
        border-bottom: 1px solid var(--ink-line);
        padding: 18px 28px 22px;
        gap: 14px;
    }

    .nav-toggle { display: block; }

    footer .container { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    body { font-size: 16px; }
    .container { padding: 0 18px; }
    .hero h1 { font-size: 1.85rem; }
    .hero-brand { padding: 13px 18px; }
    .hero-brand img { height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
