/* Bradford Font */
@font-face {
    font-family: 'Bradford';
    src: url('../fonts/BradfordLLSub-Book.woff2') format('woff2'),
         url('../fonts/BradfordLLSub-Book.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Bradford';
    src: url('../fonts/BradfordLLWeb-Book.woff2') format('woff2'),
         url('../fonts/BradfordLLWeb-Book.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* Define CSS Variables for Typography and Colors */
:root {
    /* Font Families */
    --font-family-primary: 'Bradford', sans-serif;
    
    /* Font Sizes */
    --font-size-base: 16px;

    /* Font Weights */
    --font-weight-normal: 400;

    /* Line Heights */
    --line-height-base: 1.6;
    --line-height-heading: 1.2;

    /* Motion tokens — the whole site speaks one motion language.
       --beat/--dur-beat: the hero's 5-beat reveal rhythm (see .section-dots).
       --ease-settle: strong deceleration; motion ends earlier than the eye
       expects, which is what "quiet" feels like.
       --ease-fade: plain fades (opacity-only transitions). */
    --beat: 0.4s;
    --dur-beat: 0.7s;
    --ease-fade: ease;
    --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-reveal: 0.65s;
    --reveal-rise: 14px;

    /* Colors */
    --color-primary: #333;
    --color-secondary: #fff;
    --color-text-dark: #000;
    --color-text-light: #fff;
}

/* Reset and General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    max-width: 100vw;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    color: var(--color-primary);
    line-height: var(--line-height-base);
    scroll-behavior: smooth;
    overflow-x: clip;
    overflow-y: hidden;
    overscroll-behavior: none;
    position: relative;
    /* Deterministic double-tap (highlight-clear) and snappier taps; pinch-zoom stays available */
    touch-action: manipulation;
    font-kerning: normal;
    font-feature-settings: 'kern' 1, 'liga' 1;
}

/* Page entrance fade */
body {
    opacity: 0;
    transition: opacity 0.6s ease;
}
body.loaded {
    opacity: 1;
}

/* Cross-document view transitions — pure progressive enhancement.
   Supporting browsers cross-fade same-origin navigations (notably the
   language switch); others ignore this entirely (the JS exit fade in
   script.js covers them). Turned off under reduced motion. */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

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

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

/* Scroll Snap Setup */
main {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: scroll;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-top: 0;
    padding-bottom: 0;
    overscroll-behavior: none;
}

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

/* Disable scroll snap for desktops (≥992px) */
@media (min-width: 992px) {
    main {
        scroll-snap-type: none;
        overflow-y: auto;
    }
}

/* Each Section as a Snap Point.
   min-height (not height) so content that outgrows a short viewport
   (320px reflow, 400% zoom, landscape phones) extends the section
   instead of being clipped — snap still lands on each section start. */
.section {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin: 0;
}

/* Apply to specific content containers */
.about-content,
.services-content {
    max-width: min(800px, 100%);
    margin: 0 auto;
    padding: 0 20px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Adjust Headings and Paragraphs with Responsive Scaling */
.section h2 {
    font-family: var(--font-family-primary);
    font-size: clamp(1.75rem, 4vw, 3rem);
    line-height: var(--line-height-heading);
    margin-bottom: 0.5em;
    text-align: left;
    text-wrap: balance;
}

.service-item h3 {
    font-family: var(--font-family-primary);
    font-size: clamp(1.25rem, 3vw, 2rem);
    line-height: var(--line-height-heading);
    margin-bottom: 0.75em;
}

p {
    font-size: clamp(0.875rem, 2.5vw, 1.25rem);
    margin-bottom: 1em;
    text-align: left;
    text-wrap: pretty;
}

/* Navigation Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    z-index: 2000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    box-sizing: border-box;
    background-color: transparent;
    transition: background-color 0.3s ease;
}

.language-switcher {
    display: flex;
    align-items: center;
}

.lang-btn {
    display: inline-block;
    background: none;
    border: none;
    font-size: 1em;
    margin-left: 10px;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    font-family: var(--font-family-primary);
    padding: 5px 10px;
    border-radius: 3px;
    transition: color 0.5s ease, background-color 0.5s ease, transform 0.2s ease;
}

.lang-btn:hover,
.lang-btn.active {
    transform: scale(1.05);
}

/* Smooth navbar color transitions */
.navbar .lang-btn {
    transition: color 0.5s ease, background-color 0.5s ease, transform 0.2s ease;
}

/* Dark navbar (light backgrounds) - black text */
.navbar.dark .lang-btn {
    color: var(--color-text-dark);
}

.navbar.dark .lang-btn:hover,
.navbar.dark .lang-btn.active {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Light navbar (dark backgrounds) - white text */
.navbar:not(.dark) .lang-btn {
    color: var(--color-text-light);
}

.navbar:not(.dark) .lang-btn:hover,
.navbar:not(.dark) .lang-btn.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
#home {
    position: relative;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--color-text-light);
    z-index: 2;
    max-width: min(800px, 100%);
    padding: 0 20px;
}

.hero-content h1 {
    font-family: var(--font-family-primary);
    font-size: clamp(2rem, 8vw, 4rem);
    margin-bottom: 20px;
}

.hero-content p {
    font-size: clamp(0.75rem, 1.6vw, 0.85rem);
    margin-bottom: 30px;
    font-weight: var(--font-weight-normal);
    max-width: 600px;
    text-align: center;
    letter-spacing: 0.35em;
    /* Compensate the trailing letter-space so the caps sit optically centered */
    padding-left: 0.35em;
    text-transform: uppercase;
    opacity: 0;
    /* Beat 2 in the reveal sequence — one beat after the name */
    transition: opacity var(--dur-beat) var(--ease-fade) var(--beat);
}

.hero-content p.subtitle-visible {
    opacity: 1;
}

/* About Section */
#about {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    padding: 60px 20px;
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.about-content p {
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    line-height: var(--line-height-base);
}

/* Services Section */
.services-section {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    padding: 60px 20px;
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.services-content p,
.services-content blockquote {
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    line-height: var(--line-height-base);
}

/* ============================================================
   Philosophy — a book-like epigraph.
   Composition: a whisper kicker whose hairline runs the width of
   the text block, a large airy quote anchored to the same left
   edge, and a small tracked-caps signature set to the right —
   a quiet diagonal (top-left → bottom-right) over the photograph.
   ============================================================ */
#services7 .services-content {
    width: 100%;
    max-width: min(46rem, 100%);
    padding: 0;
    font-synthesis: none;
}

#services7 h2 {
    display: flex;
    align-items: center;
    gap: clamp(0.9rem, 1.6vw, 1.4rem);
    width: 100%;
    margin: 0 0 clamp(2.5rem, 5vw, 4rem);
    color: rgba(244, 242, 238, 0.62);
    font-family: var(--font-family-primary);
    font-size: clamp(0.72rem, 0.68rem + 0.18vw, 0.84rem);
    font-style: normal;
    font-weight: var(--font-weight-normal);
    line-height: 1.2;
    letter-spacing: 0.26em;
    text-align: left;
    text-transform: uppercase;
    text-wrap: nowrap;
}

/* The kicker's rule runs to the edge of the text block and dissolves. */
#services7 h2::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(to right, currentColor 0%, transparent 100%);
    opacity: 0.5;
}

#services7 .philosophy-figure {
    margin: 0;
    width: 100%;
}

#services7 blockquote {
    width: 100%;
    max-width: 44ch;
    font-style: normal;
    font-weight: var(--font-weight-normal);
    font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2.15rem);
    line-height: 1.42;
    letter-spacing: -0.01em;
    margin: 0;
    padding: 0;
    quotes: none;
    font-family: inherit;
    color: #f6f4f0;
    text-shadow: 0 1px 3px rgba(2, 10, 14, 0.3);
    text-wrap: pretty;
    position: relative;
    orphans: 3;
    widows: 3;
}

/* Guillemets set as marks, not text. The opening one hangs fully in
   the margin — every line of the quote shares a flush left edge in
   every browser (no text-indent approximation, no Safari-only
   hanging-punctuation). The closing one follows the final word.
   Both slightly dimmed so they frame the words rather than compete. */
#services7 blockquote::before {
    content: '«';
    position: absolute;
    top: 0;
    left: -0.72em;
    color: rgba(244, 242, 238, 0.72);
    text-shadow: none;
}

#services7 blockquote::after {
    content: '»';
    color: rgba(244, 242, 238, 0.72);
    margin-left: 0.08em;
}

/* French typographic convention: narrow no-break space inside the marks */
#services7 blockquote:lang(fr)::after {
    content: '\202F»';
    margin-left: 0;
}

/* Signature — answers the kicker from the opposite corner. */
#services7 .philosophy-signature {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(0.9rem, 1.6vw, 1.4rem);
    margin-top: clamp(2rem, 4.5vw, 3.25rem);
    color: rgba(244, 242, 238, 0.6);
    font-size: clamp(0.7rem, 0.66rem + 0.18vw, 0.8rem);
    line-height: 1.2;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    white-space: nowrap;
}

#services7 .philosophy-signature-rule {
    display: block;
    width: clamp(2rem, 4vw, 3.25rem);
    height: 1px;
    background: linear-gradient(to left, currentColor 0%, transparent 100%);
    opacity: 0.55;
}

/* Hairline draw-ins — the rules draw toward the words at both corners
   (kicker left→right, signature right→left), giving the diagonal
   composition a temporal echo. Only when JS has added .reveal, so the
   no-JS page keeps its static hairlines. The gradients dissolve to
   transparent, so scaling them never shows a stretched edge. */
#services7 h2.reveal::after {
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.9s var(--ease-settle) 0.15s;
}

#services7 h2.reveal.in-view::after {
    transform: scaleX(1);
}

#services7 .philosophy-signature.reveal .philosophy-signature-rule {
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.9s var(--ease-settle) 0.2s;
}

#services7 .philosophy-signature.reveal.in-view .philosophy-signature-rule {
    transform: scaleX(1);
}

/* Philosophy epigraph — masked line-by-line reveal (built by JS on
   desktop only; see initPhilosophyLineReveal). Each visual line rises
   out of its own overflow mask like letterpress being pulled; the
   wrappers are removed after the animation so the DOM returns to
   clean text. The tiny padding/negative-margin pair extends each
   line's clip window so ascenders/descenders never shear. */
#services7 blockquote.pq-masked .pq-line {
    display: block;
    overflow: hidden;
    padding: 0.06em 0 0.1em;
    margin: -0.06em 0 -0.1em;
}

#services7 blockquote.pq-masked .pq-line-inner {
    display: block;
    transform: translateY(115%);
    transition: transform 0.8s var(--ease-settle);
}

#services7 blockquote.pq-masked.pq-play .pq-line-inner {
    transform: translateY(0);
}

/* While masked, the closing guillemet travels inside the last line
   (as .pq-mark) and the real ::after stands down; the hanging opening
   mark fades in as the first line surfaces. */
#services7 blockquote.pq-masked::after {
    content: none;
}

#services7 blockquote .pq-mark {
    color: rgba(244, 242, 238, 0.72);
    margin-left: 0.08em;
}

#services7 blockquote:lang(fr) .pq-mark {
    margin-left: 0;
}

#services7 blockquote.pq-masked::before {
    opacity: 0;
}

#services7 blockquote.pq-masked.pq-play::before {
    opacity: 1;
    transition: opacity 0.6s var(--ease-fade) 0.1s;
}

/* Background image fade-in for lazy-loaded sections via pseudo-element */
#services1,
#services3,
#services5,
#services7 {
    position: relative;
}

#services1::before,
#services3::before,
#services5::before,
#services7::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#services1.bg-loaded::before,
#services3.bg-loaded::before,
#services5.bg-loaded::before,
#services7.bg-loaded::before {
    opacity: 1;
}

/* Ensure section content sits above the pseudo-element */
#services1 > *,
#services3 > *,
#services5 > *,
#services7 > * {
    position: relative;
    z-index: 1;
}

#bio {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    padding: 60px 20px;
    min-height: 100vh;
    display: grid;
    place-items: center;
}

#bio a {
    text-underline-offset: 3px;
}

#services1 {
    color: var(--color-text-light);
    padding: 60px 20px;
    min-height: 100vh;
    display: grid;
    place-items: center;
}

#services1.bg-loaded::before {
    background-image: url('../images/litigation.jpg');
    background-image: image-set(
        url('../images/litigation.avif') type('image/avif'),
        url('../images/litigation.webp') type('image/webp'),
        url('../images/litigation.jpg') type('image/jpeg')
    );
}

#services3 {
    color: var(--color-text-light);
    padding: 60px 20px;
    min-height: 100vh;
    display: grid;
    place-items: center;
}

#services3.bg-loaded::before {
    background-image: url('../images/criminal.jpg');
    background-image: image-set(
        url('../images/criminal.avif') type('image/avif'),
        url('../images/criminal.webp') type('image/webp'),
        url('../images/criminal.jpg') type('image/jpeg')
    );
}

/* Services 5 — Advisory (dark, ai.jpg background) */
#services5 {
    color: var(--color-text-light);
    padding: 60px 20px;
    min-height: 100vh;
    display: grid;
    place-items: center;
}

#services5.bg-loaded::before {
    background-image: url('../images/ai.jpg');
    background-image: image-set(
        url('../images/ai.avif') type('image/avif'),
        url('../images/ai.webp') type('image/webp'),
        url('../images/ai.jpg') type('image/jpeg')
    );
}

/* Services 6 — AI (light, no background) */
#services6 {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    padding: 60px 20px;
    display: grid;
    place-items: center;
    min-height: 100vh;
}

/* Services 7 — Philosophy (dark, bio.jpg background) */
#services7 {
    color: #f4f2ee;
    padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 5vw, 4rem);
    min-height: 100vh;
    display: grid;
    place-items: center;
}

/* A quiet vignette between the photograph and the text: the center
   stays open, the edges settle, and the quote reads effortlessly.
   (The seasonal neuro layer overrides this ::after with its own scrim.) */
#services7::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(130% 100% at 50% 42%,
        rgba(6, 12, 17, 0.18) 0%,
        rgba(6, 12, 17, 0.52) 100%);
}

#services7.bg-loaded::before {
    background-image: url('../images/bio.jpg');
    background-image: image-set(
        url('../images/bio.avif') type('image/avif'),
        url('../images/bio.webp') type('image/webp'),
        url('../images/bio.jpg') type('image/jpeg')
    );
}

/* (Desktop section refinements moved to the unified desktop block below) */

/* Contact Section */
/* Portrait Section — override flex centering from .section */
.portrait-section {
    display: block;
    padding: 0;
    overflow: hidden;
    position: relative;
}

.portrait-contact {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: clamp(32px, 6vh, 64px) clamp(24px, 5vw, 56px);
    background: linear-gradient(to top,
        rgba(0, 0, 0, 0.62) 0%,
        rgba(0, 0, 0, 0.32) 45%,
        transparent 100%
    );
}

.portrait-contact-inner {
    font-family: var(--font-family-primary);
    font-size: clamp(0.72rem, 1.1vw, 0.8rem);
    line-height: 2.6;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.04em;
    font-style: normal;
}

.portrait-contact-inner a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.5s ease;
}

.portrait-contact-inner a:hover {
    color: #fff;
}

.portrait-contact-inner a:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.6);
    outline-offset: 3px;
}

.portrait-contact-inner p {
    margin: 0;
}

/* READ OFFLINE link — fades in below the hero subtitle after
   the hero has settled. Styled as a secondary line, not a button:
   same tracked-caps family as the subtitle, slightly smaller, dimmer.
   A hairline bottom border appears on hover to signal interactivity. */
.hero-offline-link {
    display: inline-block;
    font-family: var(--font-family-primary);
    font-size: clamp(0.64rem, 1.3vw, 0.72rem);
    font-weight: var(--font-weight-normal);
    letter-spacing: 0.32em;
    /* Optical centering against the trailing letter-space */
    padding-left: 0.32em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 3px;
    margin-top: -6px;  /* Tighten slightly against the subtitle's 30px bottom margin */
    opacity: 0;
    /* Beat 3 in the reveal sequence — 0.8s after the name */
    transition: color 0.5s ease, border-color 0.5s ease, opacity var(--dur-beat) var(--ease-fade) calc(var(--beat) * 2);
    cursor: pointer;
}

body.hero-settled .hero-offline-link {
    opacity: 1;
}

.hero-offline-link:hover {
    color: rgba(255, 255, 255, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

.hero-offline-link:focus-visible {
    outline: 1px solid rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
}

.portrait-content {
    width: 100%;
    height: 100vh;
}

.portrait-content picture {
    display: block;
    width: 100%;
    height: 100%;
}

.portrait-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Mobile + Tablet Styles (snap is active below 992px) */
@media (max-width: 991px) {
    .navbar {
        padding: 15px 20px;
    }

    /* Explicit navbar color on mobile — guarantees dark/light switching */
    .navbar:not(.dark) .lang-btn {
        color: var(--color-text-light) !important;
    }
    .navbar.dark .lang-btn {
        color: var(--color-text-dark) !important;
    }

    .language-switcher {
        justify-content: flex-end;
    }

    /* Sections fill the viewport for mandatory scroll-snap, but may
       grow when text outruns a short/narrow viewport (320px reflow,
       400% zoom) — overflowing content scrolls into view instead of
       being clipped (WCAG 1.4.10). Snap still lands on section starts. */
    .section,
    #about,
    #services1, #services2, #services3, #services4, #services5, #services6, #services7,
    #bio {
        min-height: 100vh;
        min-height: 100dvh;
        height: auto;
        overflow: visible;
        padding-top: 50px;
        padding-bottom: 30px;
    }

    /* Portrait has no text content — no internal scroll or padding needed */
    .portrait-section {
        overflow: hidden;
        padding: 0;
    }

    /* Prevent overflow from long words and headings */
    .about-content,
    .services-content {
        max-width: min(600px, 100%);
        padding: 0 24px;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    /* Balanced headings on mobile */
    .section h2 {
        font-size: clamp(1.4rem, 5.5vw, 1.85rem);
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: none;
        margin-bottom: 0.5em;
    }

    /* Readable text on mobile - same size for all sections */
    .about-content p,
    .services-content p,
    .services-content blockquote {
        font-size: clamp(1.1rem, 4.5vw, 1.25rem);
        line-height: 1.55;
        margin-bottom: 0.8em;
        overflow-wrap: break-word;
        hyphens: auto;
        hyphenate-limit-chars: 6 3 3;
        -webkit-hyphenate-limit-before: 3;
        -webkit-hyphenate-limit-after: 3;
    }

    /* Slightly more side breathing room than the other sections, and a
       bottom pad that clears the fixed WRITE link (plus the iPhone
       home-indicator safe area) even when the quote runs long (DE/FR). */
    #services7 {
        padding: clamp(3.5rem, 9vh, 6rem)
                 clamp(1.5rem, 6vw, 2.5rem)
                 calc(clamp(4rem, 10vh, 6rem) + env(safe-area-inset-bottom, 0px));
    }

    #services7 .services-content {
        max-width: min(44rem, 100%);
        padding: 0;
    }

    #services7 h2 {
        margin-bottom: clamp(1.5rem, 6vw, 2.25rem);
        font-size: clamp(0.7rem, 0.66rem + 0.2vw, 0.78rem);
        letter-spacing: 0.22em;
    }

    /* A notch smaller than the desktop epigraph: still clearly larger
       than body text, but the long quote no longer fills the whole
       viewport (and the DE/FR versions fit without being cut off). */
    #services7 blockquote {
        font-size: clamp(1.1rem, 0.95rem + 1.1vw, 1.5rem);
        line-height: 1.5;
        margin: 0;
        hyphens: auto;
    }

    #services7 .philosophy-signature {
        margin-top: clamp(1.4rem, 5vw, 2.25rem);
        font-size: 0.66rem;
        letter-spacing: 0.22em;
    }
}

/* Short phone viewports (older/small devices, landscape): tighten the
   epigraph further so the quote — especially the longer German and
   French text — fits the screen instead of colliding with the fixed
   WRITE link under the mandatory scroll snap. */
@media (max-width: 991px) and (max-height: 620px) {
    #services7 {
        padding-top: 3rem;
    }

    #services7 h2 {
        margin-bottom: 1.25rem;
    }

    #services7 blockquote {
        font-size: clamp(1rem, 0.9rem + 0.8vw, 1.2rem);
        line-height: 1.45;
    }

    #services7 .philosophy-signature {
        margin-top: 1rem;
    }
}

/* Accessibility Focus Styles — hide on mouse, show on keyboard */
a:focus-visible,
.lang-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Hero entrance — name fade
   Beat 1 of the 5-beat reveal sequence (0.4s interval, 0.7s duration).
   See .section-dots notes below for the full score. */
.hero-content h1 {
    opacity: 0;
    transition: opacity var(--dur-beat) var(--ease-fade) 0s;
}

.hero-content h1.name-visible {
    opacity: 1;
}

/* --- Hero vignette overlay --- */
#home::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(
        ellipse at center,
        transparent 40%,
        rgba(0, 0, 0, 0.35) 100%
    );
    pointer-events: none;
}

/* --- Scroll-reveal animations ---
   Short travel + strong deceleration: content settles into place
   rather than sliding in from elsewhere. */
.reveal {
    opacity: 0;
    transform: translateY(var(--reveal-rise));
    transition: opacity var(--dur-reveal) var(--ease-fade),
                transform var(--dur-reveal) var(--ease-settle);
}

.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

.reveal-stagger-1 { transition-delay: 0s; }
.reveal-stagger-2 { transition-delay: 0.12s; }
.reveal-stagger-3 { transition-delay: 0.24s; }

/* --- Fog canvas — drifts in slowly once the shader is ready --- */
#fog-canvas {
    opacity: 0;
    transition: opacity 2.8s ease 0.8s;
}

#fog-canvas.fog-ready {
    opacity: 0.7;
}

/* --- Selection — Eton green while dragging, hand-drawn mark on release --- */
::selection {
    background: rgba(134, 176, 116, 0.15);
    color: inherit;
}

.highlight-overlay {
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

/* Bio link animated underline */
#bio a {
    text-decoration: none;
    position: relative;
}

#bio a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(1);
    transform-origin: left;
    transition: transform 0.3s ease;
}

#bio a:hover::after {
    transform: scaleX(0);
    transform-origin: right;
}

/* --- Section navigation dots (desktop) ---
   Beat 4 in the 5-beat reveal sequence.
   All five elements fade in via a single body.hero-settled trigger
   (added by JS 300ms after load). Each has its own transition-delay
   to create a smooth 0.4s-interval rhythm with 0.7s duration:
     T+0.0s  name         (0.4s interval × 0)
     T+0.4s  subtitle     (0.4s × 1)
     T+0.8s  read-offline (0.4s × 2)
     T+1.2s  nav dots     (0.4s × 3)  ← this element
     T+1.6s  write-link   (0.4s × 4)
   (All times relative to hero-settled / name-visible being added.)
   Each element takes 0.7s to fully fade in, so consecutive elements
   overlap by 0.3s — a legato reveal, no gaps. */
.section-dots {
    position: fixed;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 0;
    opacity: 0;
    transition: opacity var(--dur-beat) var(--ease-fade) calc(var(--beat) * 3);
}

body.hero-settled .section-dots {
    opacity: 1;
}

/* Each dot is a 24px hit target (WCAG 2.5.8); the visible 6px circle
   is drawn in ::before so hover scaling never distorts the tooltip. */
.section-dot {
    position: relative;
    width: 24px;
    height: 24px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.section-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    transition: background 0.3s ease, transform 0.3s ease;
}

.section-dot:hover::before {
    transform: scale(1.5);
}

.section-dot.active::before {
    background: #3A6B6E;
}

body.on-dark .section-dot::before {
    background: rgba(255, 255, 255, 0.6);
}

body.on-dark .section-dot.active::before {
    background: #7AACB0;
}

/* Whisper-quiet tracked-caps label, slides in from the dot on hover/focus */
.section-dot::after {
    content: attr(data-label);
    position: absolute;
    right: 26px;
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    font-family: var(--font-family-primary);
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.section-dot:hover::after,
.section-dot:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

body.on-dark .section-dot::after {
    color: rgba(255, 255, 255, 0.75);
}

.section-dot:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.7);
    outline-offset: 1px;
    border-radius: 50%;
}

body.on-dark .section-dot:focus-visible {
    outline-color: rgba(255, 255, 255, 0.9);
}


@media (max-width: 991px) {
    .section-dots { display: none; }
}

/* --- Subtle parallax for background image sections (desktop) ---
   will-change keeps these four viewport-sized bitmaps on their own
   compositor layers, so the per-frame --parallax-y writes move a
   layer instead of repainting a cover-sized AVIF. */
@media (min-width: 992px) {
    #services1::before,
    #services3::before,
    #services5::before,
    #services7::before {
        transform: translateY(var(--parallax-y, 0));
        top: -40px;
        bottom: -40px;
        will-change: transform;
    }

    /* One-shot settle as each photograph fades in: a single exhale
       (scale 1.045 → 1) riding the existing opacity fade — masks the
       pop of a background finishing mid-view and adds depth without
       moving any text. The keyframes include the parallax variable, so
       the filled animation and the scroll-driven offset compose. */
    @keyframes bg-settle {
        from { transform: translateY(var(--parallax-y, 0px)) scale(1.045); }
        to   { transform: translateY(var(--parallax-y, 0px)) scale(1); }
    }

    #services1.bg-loaded::before,
    #services3.bg-loaded::before,
    #services5.bg-loaded::before,
    #services7.bg-loaded::before {
        animation: bg-settle 1.8s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
}

/* --- Custom scrollbar (desktop) --- */
@media (min-width: 992px) {
    main {
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
    }

    main::-webkit-scrollbar {
        display: block;
        width: 4px;
    }

    main::-webkit-scrollbar-track {
        background: transparent;
    }

    main::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 2px;
    }

    main::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }
}

/* Respect reduced motion: no blinking/animation */
@media (prefers-reduced-motion: reduce) {
  /* Animated full-viewport scrolling is exactly the large-field motion
     this preference exists to prevent (mandatory snap makes every
     navigation a full-screen glide). */
  html, main { scroll-behavior: auto !important; }
  body { opacity: 1 !important; transition: none !important; }
  .hero-content h1, .hero-content p { opacity: 1 !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  #services1::before,
  #services3::before,
  #services5::before,
  #services7::before {
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  /* The blanket .reveal override can't reach pseudo-elements or the
     line masks — freeze them explicitly. */
  #services7 h2::after,
  #services7 .philosophy-signature-rule {
    transform: none !important;
    transition: none !important;
  }
  #services7 blockquote.pq-masked .pq-line-inner { transform: none !important; transition: none !important; }
  #services7 blockquote.pq-masked::before { opacity: 1 !important; }
}

.has-fog { position: relative; isolation: isolate; }

/* --- Film grain overlay ---
   Oversized by one tile (200px) on every side and animated with
   transform, not background-position: the steps(4) shimmer is
   identical but runs on the compositor — zero per-frame repaints. */
body::after {
    content: '';
    position: fixed;
    inset: -128px;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") repeat;
    background-size: 200px 200px;
}

body.loaded::after {
    opacity: 0.034;
    animation: grain 1s steps(3) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-80px, -60px, 0); }
    50% { transform: translate3d(40px, -120px, 0); }
    75% { transform: translate3d(-120px, 80px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  #fog-canvas { display: none !important; }
  body::after { display: none !important; }
}


/* ============================================================
   PRINT-ONLY DOCUMENT — hidden on screen
   Rendered as the entire print output (#print-document).
   All other body children are hidden in @media print.
   ============================================================ */
#print-document {
    display: none;
}


/* --- High-contrast grade: the whispers speak up, the photos stay --- */
@media (prefers-contrast: more) {
    .hero-offline-link {
        color: rgba(255, 255, 255, 0.95);
        text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
    }

    .portrait-contact-inner,
    .portrait-contact-inner a {
        color: #fff;
    }

    .portrait-contact {
        background: linear-gradient(to top,
            rgba(0, 0, 0, 0.8) 0%,
            rgba(0, 0, 0, 0.45) 55%,
            transparent 100%
        );
    }

    #home::after {
        background: radial-gradient(
            ellipse at center,
            rgba(0, 0, 0, 0.15) 30%,
            rgba(0, 0, 0, 0.55) 100%
        );
    }

    body::after,
    #fog-canvas {
        display: none !important;
    }

    .section-dot::before {
        background: rgba(0, 0, 0, 0.7);
    }

    body.on-dark .section-dot::before {
        background: rgba(255, 255, 255, 0.9);
    }
}

/* ========================================
   PRINT STYLESHEET

   Moved to css/print.css, loaded with media="print"
   in index.html. That lets mobile browsers (iOS Safari,
   Android Chrome) pick up the print rules reliably —
   @media print inside a screen stylesheet can be
   partially ignored on mobile.
   ======================================== */


.site-version-switch { margin-left: 0; }
@media print { .site-version-switch { display: none !important; } }
