/* ==========================================================================
   dev.kylehowell.com — web design for New England small businesses
   Dusk over the Connecticut River Valley. Custom-built, no dependencies.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..700;1,9..144,400..600&family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    color-scheme: dark;
    --ink:        #0b1017;   /* night-blue page ground */
    --ink-2:      #101725;   /* elevated */
    --card:       #131c2b;
    --text:       #f1ecdf;   /* warm paper cream */
    --muted:      #b0a995;
    --faint:      #7d7868;
    --amber:      #e8a14f;   /* lantern light */
    --amber-deep: #c97f3a;
    --amber-soft: rgba(232, 161, 79, 0.13);
    --spruce:     #8fae86;
    --border:     rgba(241, 236, 223, 0.09);
    --border-2:   rgba(241, 236, 223, 0.16);
    --on-amber:   #1d1206;   /* ink atop amber fills */
    --on-spruce:  #101a0e;
    --btn-fill-hover: #f0b46a;
    --nav-cta-border: rgba(232, 161, 79, 0.45);
    --glass:        rgba(11, 16, 23, 0.8);   /* scrolled nav */
    --glass-strong: rgba(11, 16, 23, 0.96);  /* mobile menu */
    --toast-bg:     rgba(16, 23, 37, 0.92);
    --shadow-card:  0 24px 60px rgba(0, 0, 0, 0.4);
    --error:        #e8896b;
    --caption:      rgba(241, 236, 223, 0.4);
    --hero-grad: linear-gradient(180deg, #0d1322 0%, #16203a 38%, #3a3a56 62%, #7a5343 78%, #0b1017 100%);
    --hero-scrim:
        radial-gradient(70% 60% at 30% 62%, rgba(11, 16, 23, 0.62), transparent 65%),
        linear-gradient(180deg, rgba(11, 16, 23, 0.35), transparent 30%, transparent 62%, rgba(11, 16, 23, 0.88) 96%);
    --contact-grad: linear-gradient(180deg, var(--ink) 0%, #18223a 55%, #432f2b 88%, #0b1017 100%);

    --font-display: 'Fraunces', Georgia, serif;
    --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;

    --nav-h: 72px;
    --gutter: clamp(20px, 5vw, 64px);
    --section-pad: clamp(90px, 13vh, 170px);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light theme — morning over the valley. Warm paper, dark ink, deep ochre.
   Modeled on the print one-pager: cream ground, hairline rules, white cards. */
html[data-theme="light"] {
    color-scheme: light;
    --ink:        #faf7ef;   /* warm paper ground */
    --ink-2:      #f2eee1;   /* elevated */
    --card:       #ffffff;
    --text:       #1d1c19;   /* near-black ink */
    --muted:      #57534a;
    --faint:      #8b8577;
    --amber:      #b9771f;   /* deep ochre — reads on cream */
    --amber-deep: #9c621a;
    --amber-soft: rgba(185, 119, 31, 0.1);
    --spruce:     #4f7a48;
    --border:     rgba(29, 28, 25, 0.12);
    --border-2:   rgba(29, 28, 25, 0.22);
    --on-amber:   #fff8ec;
    --on-spruce:  #f2f7ef;
    --btn-fill-hover: #9c621a;
    --nav-cta-border: rgba(185, 119, 31, 0.5);
    --glass:        rgba(250, 247, 239, 0.85);
    --glass-strong: rgba(250, 247, 239, 0.96);
    --toast-bg:     rgba(255, 255, 255, 0.95);
    --shadow-card:  0 18px 44px rgba(29, 28, 25, 0.14);
    --error:        #b4452a;
    --caption:      rgba(29, 28, 25, 0.45);
    --hero-grad: linear-gradient(180deg, #aecfe6 0%, #c9e0ee 38%, #e9ddc0 62%, #e0c89e 78%, #faf7ef 100%);
    --hero-scrim:
        radial-gradient(70% 60% at 30% 62%, rgba(250, 247, 239, 0.55), transparent 65%),
        linear-gradient(180deg, rgba(250, 247, 239, 0.25), transparent 30%, transparent 62%, rgba(250, 247, 239, 0.9) 96%);
    --contact-grad: linear-gradient(180deg, var(--ink) 0%, #d9e7f0 55%, #ecd9b4 88%, #faf7ef 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--ink);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

::selection { background: var(--amber); color: var(--on-amber); }

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; }

:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
    border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Page chrome
   -------------------------------------------------------------------------- */
.grain {
    position: fixed;
    inset: -60px;
    z-index: 2000;
    pointer-events: none;
    background-image: url('../assets/grain.svg');
    background-size: 240px;
    opacity: 0.045;
    mix-blend-mode: overlay;
}

#snow {
    position: fixed;
    inset: 0;
    z-index: 1900;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}
body.snowing #snow { opacity: 1; }

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translate(-50%, 80px);
    z-index: 2100;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    color: var(--text);
    background: var(--toast-bg);
    border: 1px solid var(--border-2);
    border-radius: 9999px;
    padding: 11px 22px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s var(--ease-out), opacity 0.5s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast .amber { color: var(--amber); }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1800;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    transition: transform 0.45s var(--ease-out), background-color 0.35s, border-color 0.35s;
    border-bottom: 1px solid transparent;
}
.nav.scrolled {
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom-color: var(--border);
}
.nav.hidden { transform: translateY(-100%); }

.nav-inner {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--text);
    position: relative;
    z-index: 1901;
}
.logo::before { content: '> '; color: var(--amber); }

.nav-right { display: flex; align-items: center; gap: 20px; }
.nav-links { display: flex; align-items: center; gap: 34px; }

.theme-toggle {
    width: 38px; height: 38px;
    display: grid;
    place-items: center;
    background: none;
    border: 1px solid var(--border-2);
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    z-index: 1901;
    transition: color 0.25s, border-color 0.25s, transform 0.5s var(--ease-out);
}
.theme-toggle:hover { color: var(--amber); border-color: var(--amber); transform: rotate(40deg); }
.theme-toggle .tt-moon { display: none; }
html[data-theme="light"] .theme-toggle .tt-moon { display: block; }
html[data-theme="light"] .theme-toggle .tt-sun { display: none; }
.nav-links a:not(.nav-cta) {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--muted);
    transition: color 0.2s;
    position: relative;
}
.nav-links a:not(.nav-cta)::after {
    content: '';
    position: absolute;
    left: 0; bottom: -6px;
    width: 100%; height: 1px;
    background: var(--amber);
    transform: scaleX(0);
    transform-origin: 100% 0;
    transition: transform 0.35s var(--ease-out);
}
.nav-links a:not(.nav-cta):hover { color: var(--text); }
.nav-links a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: 0 0; }

.nav-cta {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--amber);
    border: 1px solid var(--nav-cta-border);
    padding: 10px 20px;
    border-radius: 9999px;
    transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.nav-cta:hover { background: var(--amber); color: var(--on-amber); border-color: var(--amber); }

.burger {
    display: none;
    background: none;
    border: 0;
    width: 44px; height: 44px;
    cursor: pointer;
    position: relative;
    z-index: 1901;
}
.burger span {
    position: absolute;
    left: 10px;
    width: 24px; height: 2px;
    background: var(--text);
    transition: transform 0.35s var(--ease-out), background-color 0.3s;
}
.burger span:nth-child(1) { top: 17px; }
.burger span:nth-child(2) { top: 25px; }
.burger.open span:nth-child(1) { transform: translateY(4px) rotate(45deg); background: var(--amber); }
.burger.open span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); background: var(--amber); }

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 1750;
    background: var(--glass-strong);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 var(--gutter);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease-out), visibility 0s linear 0.4s;
}
.mobile-menu.open { opacity: 1; visibility: visible; transition: opacity 0.4s var(--ease-out); }
.mobile-menu a {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 8.5vw, 3.2rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--text);
    padding: 0.3em 0;
    display: flex;
    align-items: baseline;
    gap: 18px;
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.mobile-menu.open a { opacity: 1; transform: none; }
.mobile-menu.open a:nth-child(1) { transition-delay: 0.07s; }
.mobile-menu.open a:nth-child(2) { transition-delay: 0.14s; }
.mobile-menu.open a:nth-child(3) { transition-delay: 0.21s; }
.mobile-menu.open a:nth-child(4) { transition-delay: 0.28s; }
.mobile-menu.open a:nth-child(5) { transition-delay: 0.35s; }
.mobile-menu a .idx {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--amber);
}
.mobile-menu .menu-foot {
    position: absolute;
    bottom: 34px;
    left: var(--gutter); right: var(--gutter);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 24px;
}

body.menu-locked { overflow: hidden; }
body.menu-locked .nav {
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom-color: transparent;
    transform: none;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 16px 28px;
    border-radius: 9999px;
    position: relative;
    transition: color 0.3s var(--ease-out), border-color 0.3s, background-color 0.3s, transform 0.3s var(--ease-out);
    will-change: transform;
}
.btn .arr { transition: transform 0.3s var(--ease-out); }
.btn:hover .arr { transform: translateX(4px); }
.btn-fill { background: var(--amber); color: var(--on-amber); border: 1px solid var(--amber); }
.btn-fill:hover { background: var(--btn-fill-hover); border-color: var(--btn-fill-hover); }
.btn-ghost { color: var(--text); border: 1px solid var(--border-2); }
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

/* --------------------------------------------------------------------------
   Hero — dusk over the Connecticut River Valley
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    background: var(--hero-grad);
}

.scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.scene svg {
    width: 100%;
    height: 100%;
    display: block;
}
.scene [data-depth] { will-change: transform; }

/* scrim so type sits on the art */
.hero-scrim {
    position: absolute;
    inset: 0;
    background: var(--hero-scrim);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 4vh) var(--gutter) 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: clamp(0.66rem, 1.3vw, 0.78rem);
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--amber);
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(20px, 3vh, 36px);
}
.hero-eyebrow::before { content: ''; width: 36px; height: 1px; background: var(--amber); }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6.5vw, 5.8rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    line-height: 1.04;
    letter-spacing: -0.015em;
    max-width: 11.5em;
    margin-bottom: clamp(24px, 4vh, 44px);
    text-wrap: balance;
}
.hero-title .line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.12em;
    margin-bottom: -0.12em;
}
.hero-title .line > span { display: inline-block; transform: translateY(115%); }
body.loaded .hero-title .line > span {
    transition: transform 1.1s var(--ease-expo);
    transform: translateY(0);
}
body.loaded .hero-title .l1 > span { transition-delay: 0.1s; }
body.loaded .hero-title .l2 > span { transition-delay: 0.22s; }
.hero-title em {
    font-style: italic;
    font-weight: 500;
    color: var(--amber);
}

/* hand-drawn underline draw-in */
.uline { position: relative; white-space: nowrap; }
.uline::after {
    content: '';
    position: absolute;
    left: 0.02em; right: 0.04em;
    bottom: 0.04em;
    height: 0.06em;
    background: var(--amber);
    border-radius: 2px;
    transform: scaleX(0) rotate(-0.6deg);
    transform-origin: 0 100%;
    transition: transform 0.9s var(--ease-expo) 1.1s;
}
body.loaded .uline::after { transform: scaleX(1) rotate(-0.6deg); }

.hero-sub-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 48px;
    opacity: 0;
    transform: translateY(22px);
}
body.loaded .hero-sub-row {
    transition: opacity 0.9s var(--ease-out) 0.6s, transform 0.9s var(--ease-out) 0.6s;
    opacity: 1;
    transform: none;
}
.hero-sub {
    max-width: 480px;
    color: var(--muted);
    font-size: clamp(0.98rem, 1.15vw, 1.1rem);
    font-weight: 300;
}
.hero-sub strong { color: var(--text); font-weight: 500; }
.hero-ctas { display: flex; gap: 14px; flex-shrink: 0; flex-wrap: wrap; }

.hero-strip {
    position: relative;
    z-index: 2;
    margin-top: clamp(32px, 5vh, 60px);
    border-top: 1px solid var(--border);
    opacity: 0;
}
body.loaded .hero-strip { transition: opacity 1s var(--ease-out) 0.9s; opacity: 1; }
.hero-strip-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px var(--gutter);
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}
.hero-strip-inner .live { color: var(--amber); }
.scroll-hint { display: flex; align-items: center; gap: 8px; }
.scroll-hint .bar {
    width: 1px; height: 14px;
    background: var(--faint);
    animation: scrollPulse 1.8s var(--ease-out) infinite;
}
@keyframes scrollPulse {
    0% { transform: scaleY(0); transform-origin: 0 0; }
    45% { transform: scaleY(1); transform-origin: 0 0; }
    55% { transform: scaleY(1); transform-origin: 0 100%; }
    100% { transform: scaleY(0); transform-origin: 0 100%; }
}

/* --- scene life: stars, fireflies, birds, bear -------------------------- */
.star { animation: twinkle 3.4s ease-in-out infinite; transform-origin: center; }
.star:nth-child(3n) { animation-delay: 1.1s; animation-duration: 4.2s; }
.star:nth-child(4n) { animation-delay: 2.2s; animation-duration: 2.8s; }
@keyframes twinkle { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.25; } }

.firefly { animation: drift 7s ease-in-out infinite; }
.firefly:nth-child(2n) { animation-delay: 1.6s; animation-duration: 8.5s; }
.firefly:nth-child(3n) { animation-delay: 3.4s; animation-duration: 6.2s; }
.firefly:nth-child(5n) { animation-delay: 5.1s; animation-duration: 9.4s; }
@keyframes drift {
    0%, 100% { transform: translate(0, 0); opacity: 0.1; }
    25% { opacity: 0.95; }
    50% { transform: translate(14px, -16px); opacity: 0.35; }
    75% { opacity: 0.85; }
}

#bear { cursor: pointer; transition: transform 0.45s var(--ease-out); }
#bear:hover { transform: translateY(-4px); }
#bear.found { animation: bearPop 0.9s var(--ease-out); }
@keyframes bearPop {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-14px) rotate(-3deg); }
    55% { transform: translateY(-10px) rotate(2deg); }
}

/* --------------------------------------------------------------------------
   Town marquee
   -------------------------------------------------------------------------- */
.marquee {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--ink-2);
    overflow: hidden;
    padding: 20px 0;
}
.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 60s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-track span {
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 1.7vw, 1.2rem);
    font-weight: 500;
    font-style: italic;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 32px;
}
.marquee-track span::after { content: '✦'; color: var(--amber); font-style: normal; font-size: 0.7em; }

/* --------------------------------------------------------------------------
   Shared section bits
   -------------------------------------------------------------------------- */
.section { position: relative; padding: var(--section-pad) 0; }
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    position: relative;
    z-index: 1;
}
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: clamp(44px, 7vh, 80px);
}
.section-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--amber);
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}
.section-label .num { color: var(--faint); }
.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4.2vw, 3.6rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    line-height: 1.08;
    letter-spacing: -0.01em;
    max-width: 15em;
    text-align: right;
}
.section-head h2 em { font-style: italic; color: var(--amber); font-weight: 500; }

.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-expo);
    transition-delay: var(--d, 0s);
    will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

/* stone wall divider */
.stonewall {
    height: 56px;
    background-image: url('../assets/stonewall.svg');
    background-size: 320px 56px;
    background-repeat: repeat-x;
    background-position: bottom center;
}

/* --------------------------------------------------------------------------
   Services
   -------------------------------------------------------------------------- */
.services { background: var(--ink); }
.svc-list { border-top: 1px solid var(--border); }
.svc-row {
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: clamp(20px, 4vw, 64px);
    padding: clamp(26px, 4vh, 42px) 0;
    position: relative;
}
.svc-row .svc-num {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--faint);
    transition: color 0.3s;
}
.svc-row h3 {
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 3.3vw, 2.6rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    letter-spacing: -0.01em;
    line-height: 1.12;
    transition: transform 0.45s var(--ease-out);
}
.svc-row p {
    max-width: 350px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 300;
    text-align: right;
}
.svc-row::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--amber-soft), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.svc-row:hover::before { opacity: 1; }
.svc-row:hover .svc-num { color: var(--amber); }
.svc-row:hover h3 { transform: translateX(14px); }

/* --------------------------------------------------------------------------
   Work
   -------------------------------------------------------------------------- */
.work { background: var(--ink-2); }
.work-grid { display: flex; flex-direction: column; gap: clamp(60px, 9vh, 120px); }

.project {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: clamp(28px, 4.5vw, 72px);
    align-items: center;
    text-decoration: none;
}
.project.flip .project-media { order: 2; }
.project.flip .project-info { order: 1; }

.project-media {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-2);
    aspect-ratio: 16 / 10;
    background: var(--card);
    box-shadow: var(--shadow-card);
}
.project-media img {
    width: 100%;
    height: 118%;
    object-fit: cover;
    object-position: center top;
    will-change: transform;
    transition: filter 0.5s, scale 0.7s var(--ease-out);
    filter: saturate(0.94);
}
.project:hover .project-media img { filter: saturate(1.08); scale: 1.03; }
.media-tag {
    position: absolute;
    top: 16px; left: 16px;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--on-amber);
    background: var(--amber);
    padding: 6px 12px;
    border-radius: 9999px;
    z-index: 2;
}
.media-tag.alt { background: var(--spruce); color: var(--on-spruce); }

.proj-meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.project-info h3 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    letter-spacing: -0.01em;
    line-height: 1.1;
    margin-bottom: 14px;
}
.project-info p {
    color: var(--muted);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.02rem);
    max-width: 430px;
    margin-bottom: 24px;
}
.proj-link {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--amber);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.proj-link .arr { transition: transform 0.3s var(--ease-out); }
.project:hover .proj-link .arr { transform: translateX(6px); }

/* --------------------------------------------------------------------------
   Craft — Quabbin scene
   -------------------------------------------------------------------------- */
.craft {
    background: var(--ink);
    padding-bottom: 0;
    overflow: hidden;
}
.craft-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: clamp(32px, 5vw, 90px);
    align-items: start;
    margin-bottom: clamp(48px, 7vh, 90px);
}
.craft-copy h2 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4vw, 3.4rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin-bottom: 26px;
}
.craft-copy h2 em { font-style: italic; color: var(--amber); font-weight: 500; }
.craft-copy p {
    color: var(--muted);
    font-weight: 300;
    font-size: clamp(0.98rem, 1.15vw, 1.08rem);
    max-width: 540px;
    margin-bottom: 18px;
}
.craft-copy p strong { color: var(--text); font-weight: 500; }

.craft-points { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); }
.craft-point {
    background: var(--ink);
    padding: clamp(22px, 2.6vw, 32px);
    transition: background-color 0.35s;
}
.craft-point:hover { background: var(--ink-2); }
.craft-point h3 {
    font-family: var(--font-display);
    font-size: 1.18rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.craft-point h3 .tick { color: var(--amber); margin-right: 10px; font-family: var(--font-mono); font-weight: 700; }
.craft-point p { color: var(--muted); font-size: 0.92rem; font-weight: 300; }

.quabbin-wrap {
    position: relative;
    margin-top: clamp(20px, 4vh, 50px);
}
.quabbin-wrap .scene { position: relative; height: clamp(260px, 32vw, 460px); }
.scene-caption {
    position: absolute;
    bottom: 18px;
    left: var(--gutter);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--caption);
    z-index: 3;
}
#moon { cursor: pointer; }
#moon:hover .moon-core { filter: brightness(1.18); }

.shimmer { stroke-dasharray: 10 14; animation: shimmer 5s linear infinite; }
.shimmer.s2 { animation-duration: 7s; animation-delay: 0.8s; }
.shimmer.s3 { animation-duration: 6s; animation-delay: 1.7s; }
@keyframes shimmer { to { stroke-dashoffset: -96; } }

/* --------------------------------------------------------------------------
   Process
   -------------------------------------------------------------------------- */
.process { background: var(--ink); }
.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(20px, 2.5vw, 36px);
    counter-reset: step;
    position: relative;
}
.steps::before {
    content: '';
    position: absolute;
    top: 27px; left: 4%; right: 4%;
    border-top: 1px dashed var(--border-2);
}
.step { position: relative; padding-top: 72px; }
.step::before {
    counter-increment: step;
    content: '0' counter(step);
    position: absolute;
    top: 0; left: 0;
    width: 54px; height: 54px;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--amber);
    background: var(--ink);
    border: 1px solid var(--border-2);
    border-radius: 50%;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.step:hover::before { border-color: var(--amber); box-shadow: 0 0 24px rgba(232, 161, 79, 0.25); }
.step h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.step p { color: var(--muted); font-size: 0.92rem; font-weight: 300; max-width: 270px; }

/* --------------------------------------------------------------------------
   Service area
   -------------------------------------------------------------------------- */
.area { background: var(--ink-2); }
.area-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}
.region {
    background: var(--ink-2);
    padding: clamp(22px, 2.6vw, 34px);
    transition: background-color 0.35s;
}
.region:hover { background: var(--card); }
.region h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.region .reg-code {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    color: var(--amber);
    display: block;
    margin-bottom: 14px;
}
.region p { color: var(--muted); font-size: 0.88rem; font-weight: 300; line-height: 1.8; }
.area-note {
    margin-top: 28px;
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    color: var(--muted);
}
.area-note .amber { color: var(--amber); }

/* --------------------------------------------------------------------------
   Contact — mill town at dusk
   -------------------------------------------------------------------------- */
.contact {
    position: relative;
    background: var(--contact-grad);
    overflow: hidden;
    padding-bottom: 0;
}
.contact .container {
    text-align: center;
    padding-bottom: clamp(60px, 9vh, 120px);
}
.contact-label { justify-content: center; margin-bottom: 30px; }
.contact h2 {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6.5vw, 5.6rem);
    font-weight: 600;
    font-variation-settings: 'opsz' 144;
    line-height: 1.04;
    letter-spacing: -0.015em;
    margin-bottom: 26px;
    text-wrap: balance;
}
.contact h2 em { font-style: italic; color: var(--amber); font-weight: 500; }
.contact .lede {
    color: var(--muted);
    font-weight: 300;
    max-width: 520px;
    margin: 0 auto 40px;
    font-size: clamp(0.98rem, 1.2vw, 1.1rem);
}
.contact-actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.contact-email {
    display: inline-block;
    margin-top: 34px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: var(--faint);
    text-decoration: none;
    transition: color 0.25s;
}
.contact-email:hover { color: var(--amber); }

/* Contact form */
.contact-form {
    max-width: 520px;
    margin: 0 auto 8px;
    display: grid;
    gap: 14px;
    text-align: left;
}
.contact-form .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color 0.25s var(--ease-out), background-color 0.25s;
    box-sizing: border-box;
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--faint); }
.contact-form select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237d7868' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--amber);
    background: var(--ink-2);
}
.contact-form textarea {
    min-height: 130px;
    resize: vertical;
    line-height: 1.6;
}
.contact-form button {
    justify-self: center;
    margin-top: 6px;
    border: none;
    cursor: pointer;
}
.contact-form .hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.form-error {
    display: none;
    color: var(--error);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}
.form-success {
    display: none;
    max-width: 520px;
    margin: 0 auto;
    padding: 28px 26px;
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: 16px;
    color: var(--muted);
    line-height: 1.65;
    text-align: center;
}
.form-success.show { display: block; }
.form-success strong {
    display: block;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.mill-wrap { position: relative; }
/* The scene SVGs carry landscape far beyond the town (viewBox ~4400 wide), so
   "slice" reveals more world sideways on wide screens instead of zooming in
   and cropping the rooflines — the height can stay modest and capped. */
.mill-wrap .scene { position: relative; height: clamp(220px, 26vw, 400px); }

.win { animation: window-warm 7s ease-in-out infinite; }
.win:nth-child(3n) { animation-delay: 2.3s; }
.win:nth-child(4n) { animation-delay: 4.1s; animation-duration: 9s; }
@keyframes window-warm { 0%, 100% { opacity: 0.95; } 50% { opacity: 0.55; } }

.smoke { opacity: 0; animation: smoke 9s linear infinite; }
.smoke.k2 { animation-delay: 3s; }
.smoke.k3 { animation-delay: 6s; }
@keyframes smoke {
    0% { opacity: 0; transform: translate(0, 0) scale(0.7); }
    18% { opacity: 0.5; }
    100% { opacity: 0; transform: translate(46px, -130px) scale(2.1); }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer { border-top: 1px solid var(--border); background: var(--ink); padding: 44px 0; }
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
}
.footer-inner .codes { color: var(--amber); }
.footer-links { display: flex; gap: 26px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--amber); }

/* --------------------------------------------------------------------------
   Light theme — the same scenes, in daylight
   -------------------------------------------------------------------------- */
html[data-theme="light"] body { background: var(--ink); }

/* gentle cross-fade when switching themes */
body,
.nav.scrolled,
footer,
.marquee {
    transition: background-color 0.4s, color 0.4s;
}

/* night-only details */
html[data-theme="light"] .sc-stars,
html[data-theme="light"] .sc-fireflies { display: none; }

/* hero — morning over the Connecticut River Valley */
html[data-theme="light"] .sc-sun-core { fill: #f7cd66; opacity: 1; }
html[data-theme="light"] .sc-birds { stroke: #51606f; }
html[data-theme="light"] .sc-far path { fill: #a9bfd2; }
html[data-theme="light"] .sc-mid path { fill: #7fa185; }
html[data-theme="light"] .sc-valley > path:first-child { fill: #557a58; }
html[data-theme="light"] #riverGrad stop:nth-child(1) { stop-color: #f0d49c; }
html[data-theme="light"] #riverGrad stop:nth-child(2) { stop-color: #7fa3c0; }
html[data-theme="light"] #riverGrad stop:nth-child(3) { stop-color: #4a6f96; }
html[data-theme="light"] .sc-pines,
html[data-theme="light"] .sc-pines > rect,
html[data-theme="light"] .sc-pines > g[fill] { fill: #2e4a38; }
html[data-theme="light"] #bear { fill: #3a2c20; }
html[data-theme="light"] #bear path { stroke: #3a2c20; }

/* the Quabbin at midday — the moon stands in for the sun */
html[data-theme="light"] #qSky stop:nth-child(1) { stop-color: #9ec7e4; }
html[data-theme="light"] #qSky stop:nth-child(2) { stop-color: #d9ecf6; }
html[data-theme="light"] #qWater stop:nth-child(1) { stop-color: #6f9cbd; }
html[data-theme="light"] #qWater stop:nth-child(2) { stop-color: #c2dcec; }
html[data-theme="light"] #moon .moon-core { fill: #f7d066; }
html[data-theme="light"] #moon circle[opacity] { opacity: 0.18; }
html[data-theme="light"] .sc-moonpath { stroke: #f2d27a; }
html[data-theme="light"] .sc-ripples { stroke: #5d7f9a; }
html[data-theme="light"] .sc-shore path { fill: #6c8d77; }
html[data-theme="light"] .sc-tower { fill: #4a6354; }
html[data-theme="light"] .sc-tower rect { fill: #dceaf2; }

/* the mill town, late morning */
html[data-theme="light"] .sc-hills path { fill: #87a78f; }
html[data-theme="light"] .sc-town { fill: #5e4b40; }
html[data-theme="light"] #canal stop:nth-child(1) { stop-color: #7fa6c2; }
html[data-theme="light"] #canal stop:nth-child(2) { stop-color: #4c7396; }

/* fieldstone divider gets granite in the sun */
html[data-theme="light"] .stonewall { background-image: url('../assets/stonewall-light.svg'); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
    .section-head h2 { text-align: left; }
    .svc-row { grid-template-columns: auto 1fr; }
    .svc-row p { grid-column: 2; text-align: left; max-width: 480px; }
    .project, .craft-grid { grid-template-columns: 1fr; }
    .project.flip .project-media { order: 0; }
    .project.flip .project-info { order: 1; }
    .steps { grid-template-columns: 1fr 1fr; gap: 40px 24px; }
    .steps::before { display: none; }
    .area-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
    .nav-links { display: none; }
    .burger { display: block; }
    .hero-sub-row { flex-direction: column; align-items: flex-start; gap: 26px; }
    .hero-strip-inner span:nth-child(2) { display: none; }
    .svc-row:hover h3 { transform: none; }
    .steps { grid-template-columns: 1fr; gap: 36px; }
    .step p { max-width: none; }
    .area-grid { grid-template-columns: 1fr; }
    .contact-actions .btn { width: 100%; justify-content: center; }
    .footer-inner { flex-direction: column; align-items: flex-start; }

    /* Fraunces hairlines go sub-pixel at display optical size on small screens,
       so the thinnest strokes (e.g. the crossbar of an H) fade out and letters
       read as disconnected. Drop opsz to match the rendered size — and nudge
       the big display headings a touch heavier — so the thins survive. */
    .hero-title,
    .contact h2 { font-variation-settings: 'opsz' 38; font-weight: 650; }
    .section-head h2,
    .craft-copy h2 { font-variation-settings: 'opsz' 34; }
    .svc-row h3,
    .project-info h3 { font-variation-settings: 'opsz' 30; }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .hero-title .line > span { transform: none; }
    .hero-sub-row, .hero-strip { opacity: 1; transform: none; }
    .uline::after { transform: scaleX(1) rotate(-0.6deg); }
    .reveal { opacity: 1; transform: none; }
    .marquee-track { animation: none; }
}
