:root {
    --lead-color: #1a1a1a;
    --lead-width: 8px;
    --glass-glow: inset 0 0 20px rgba(0,0,0,0.6);

    /* Authentic stained glass colors */
    --glass-red: #d80129;
    --glass-blue: #1b51ac;
    --glass-green: #00912b;
    --glass-gold: #c2a000;
    --glass-purple: #6a1b9a;
    --glass-orange: #e65100;
    --glass-teal: #00796b;
    --glass-rose: #c2185b;

    /* Accent colors for UI */
    --accent-ruby: #d80129;
    --accent-emerald: #00912b;
    --accent-amber: #c2a000;
    --accent-cobalt: #1b51ac;
}

/* ===== Day / Night theme palettes =====
   Night is the default (no attribute). An inline <head> script sets
   data-theme on <html> before paint; the toggle in the bar flips it. */
:root,
[data-theme="night"] {
    --page-bg: #0e0e12;                         /* notch / status-bar fill */
    --veil: rgba(9, 9, 13, 0.85);               /* dimming layer over the glass */
    --text: #f0f0f0;
    --text-strong: #ffffff;
    --text-muted: rgba(255,255,255,0.80);
    --text-faint: rgba(255,255,255,0.60);
    --text-shadow: 0 1px 6px rgba(0,0,0,0.85);
    --hairline: rgba(255,255,255,0.20);
    --hairline-soft: rgba(255,255,255,0.15);
    --panel-bg: rgba(0,0,0,0.25);
    --panel-bg-strong: rgba(0,0,0,0.30);
    --panel-border: rgba(255,255,255,0.20);
    --topbar-bg: rgba(14,14,18,0.5);
    --topbar-border: rgba(255,255,255,0.12);
    --topbar-shadow: 0 2px 14px rgba(0,0,0,0.45);
    --input-bg: rgba(255,255,255,0.07);
    --input-bg-focus: rgba(255,255,255,0.12);
    --input-border: rgba(255,255,255,0.20);
    --input-text: #ffffff;
    --accent-link: #4a7dd4;
    --accent-green: #2eb85c;
    --accent-rose: #f06292;
}

[data-theme="day"] {
    --page-bg: #ddd8cc;                          /* daylight stone */
    /* ONE neutral warm-greige veil — soft (not glaring white), but light enough
       that dark text clears WCAG AA. Neutral so the seasonal glass keeps its hue. */
    --veil: rgba(225, 221, 210, 0.82);
    --text: #211e26;                             /* solid (no alpha) for reliable contrast */
    --text-strong: #14121a;
    --text-muted: #423f49;                       /* AA on the veil */
    --text-faint: #3d3a44;                       /* footer / fine print — AA worst-case */
    --text-shadow: none;                         /* crisp dark text on a light veil */
    --hairline: rgba(0,0,0,0.22);
    --hairline-soft: rgba(0,0,0,0.14);
    --panel-bg: rgba(255,255,255,0.42);
    --panel-bg-strong: rgba(255,255,255,0.55);
    --panel-border: rgba(0,0,0,0.16);
    --topbar-bg: rgba(255,255,255,0.55);
    --topbar-border: rgba(0,0,0,0.10);
    --topbar-shadow: 0 2px 14px rgba(0,0,0,0.18);
    --input-bg: rgba(255,255,255,0.62);
    --input-bg-focus: rgba(255,255,255,0.90);
    --input-border: rgba(0,0,0,0.20);
    --input-text: #14121a;
    --accent-link: #214480;                      /* darkened for AA on light */
    --accent-green: #156229;
    --accent-rose: #851941;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--lead-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #222;
    min-height: 100vh;
    overflow-x: hidden;
}

.stained-glass-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    grid-auto-rows: 200px;
    gap: var(--lead-width);
    background-color: var(--lead-color);
    filter: blur(7px);            /* frosted-glass blur over the moving stained glass */
    transform: scale(1.06);       /* hide the blur halo at the screen edges (JS adds parallax translate) */
    transform-origin: top center;
    will-change: transform;       /* keep the blurred layer cached for smooth parallax */
    z-index: -2;                  /* behind the dimming veil (body::before, z-index -1) */
}


.shard {
    width: 100%;
    height: 100%;
    box-shadow: var(--glass-glow);
    position: relative;
}

/* Sun glow - applied to each shard from upper-left */
.shard::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 200, 0.9) 0%,
        rgba(255, 240, 150, 0.5) 40%,
        transparent 80%
    );
}

/* Very subtle glass texture - varies per shard */
.shard::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* Vary texture position so each shard looks different */
.shard:nth-child(3n)::after { background-position: 50px 30px; }
.shard:nth-child(3n+1)::after { background-position: -20px 60px; }
.shard:nth-child(3n+2)::after { background-position: 80px -40px; }
.shard:nth-child(5n)::after { opacity: 0.02; }
.shard:nth-child(7n)::after { opacity: 0.04; }

/* === TOP ROWS: Full complexity - varied diagonal angles === */
.shard-1 { background: linear-gradient(135deg, var(--glass-purple) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-red) 52%); }
.shard-2 { background: linear-gradient(45deg, var(--glass-orange) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); grid-column: span 2; }
.shard-3 { background: linear-gradient(60deg, var(--glass-gold) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-green) 52%); }
.shard-4 { background: linear-gradient(160deg, var(--glass-gold) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-rose) 52%); grid-row: span 2; }
.shard-5 { background: linear-gradient(25deg, var(--glass-teal) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); }
.shard-6 { background: linear-gradient(-60deg, var(--glass-purple) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-rose) 52%); }
.shard-7 { background: linear-gradient(110deg, var(--glass-green) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-teal) 52%); grid-column: span 2; }
.shard-8 { background: linear-gradient(-40deg, var(--glass-red) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-orange) 52%); }
.shard:nth-child(9) { background: linear-gradient(-45deg, var(--glass-blue) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-green) 52%); }
.shard:nth-child(10) { background: linear-gradient(70deg, var(--glass-gold) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-red) 52%); }
.shard:nth-child(11) { background: linear-gradient(-30deg, var(--glass-teal) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-purple) 52%); }
.shard:nth-child(12) { background: linear-gradient(150deg, var(--glass-orange) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); }

/* === MIDDLE ROWS: Fewer colors (5), with lead lines === */
.shard:nth-child(13) { background: linear-gradient(-75deg, var(--glass-blue) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-green) 52%); }
.shard:nth-child(14) { background: linear-gradient(35deg, var(--glass-gold) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-red) 52%); }
.shard:nth-child(15) { background: linear-gradient(-135deg, var(--glass-blue) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-gold) 52%); }
.shard:nth-child(16) { background: linear-gradient(95deg, var(--glass-green) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-red) 52%); }
.shard:nth-child(17) { background: linear-gradient(-15deg, var(--glass-green) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); }
.shard:nth-child(18) { background: linear-gradient(170deg, var(--glass-red) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-gold) 52%); }
.shard:nth-child(19) { background: linear-gradient(-105deg, var(--glass-gold) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-green) 52%); }
.shard:nth-child(20) { background: linear-gradient(85deg, var(--glass-red) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); }

/* === LOWER-MIDDLE: Even fewer colors (3), with lead lines === */
.shard:nth-child(21) { background: linear-gradient(55deg, var(--glass-green) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); }
.shard:nth-child(22) { background: linear-gradient(-70deg, var(--glass-gold) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-green) 52%); }
.shard:nth-child(23) { background: linear-gradient(125deg, var(--glass-blue) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-gold) 52%); }
.shard:nth-child(24) { background: linear-gradient(-25deg, var(--glass-green) 48%, #1a1a1a 48%, #1a1a1a 52%, var(--glass-blue) 52%); }

/* === LOWER ROWS: Simple - solid colors (just 3 colors) === */
.shard:nth-child(25) { background: var(--glass-blue); }
.shard:nth-child(26) { background: var(--glass-green); }
.shard:nth-child(27) { background: var(--glass-gold); }
.shard:nth-child(28) { background: var(--glass-blue); }
.shard:nth-child(29) { background: var(--glass-green); }
.shard:nth-child(30) { background: var(--glass-gold); }
.shard:nth-child(31) { background: var(--glass-blue); }
.shard:nth-child(32) { background: var(--glass-green); }

/* === BOTTOM: Simplest - just 2 colors === */
.shard:nth-child(33) { background: var(--glass-blue); }
.shard:nth-child(34) { background: var(--glass-green); }
.shard:nth-child(35) { background: var(--glass-blue); }
.shard:nth-child(36) { background: var(--glass-green); }
.shard:nth-child(37) { background: var(--glass-blue); }
.shard:nth-child(38) { background: var(--glass-green); }
.shard:nth-child(39) { background: var(--glass-blue); }
.shard:nth-child(40) { background: var(--glass-green); }

/* Fallback for any extras */
.shard:nth-child(n+41):nth-child(odd) { background: var(--glass-green); }
.shard:nth-child(n+41):nth-child(even) { background: var(--glass-blue); }

.frosted-overlay {
    /* the full-screen veil is the card; content just centres on it */
    background: transparent;
    width: var(--content-w);
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 44px 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--text);
    text-shadow: var(--text-shadow);   /* keep text legible over the dimmed animation */
    transition: color 0.4s ease, text-shadow 0.4s ease;
}

header {
    text-align: center;
    border-bottom: 2px solid var(--hairline);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 0 0 5px 0;
    color: var(--text-strong);
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 18px 0 15px 0;     /* a little breathing room under the logo */
    font-style: italic;
}

nav {
    margin-top: 15px;
}

nav a {
    text-decoration: none;
    color: rgba(255,255,255,0.85);
    font-weight: bold;
    margin: 0 15px;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--glass-gold);
}

/* Sections */
.section {
    padding: 30px 0;
    border-bottom: 1px solid var(--hairline-soft);
}

.section:last-child {
    border-bottom: none;
}

.section h2 {
    font-size: 1.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 20px 0;
    color: var(--text-strong);
}

.lead {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* About Section */
.about-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.about-image {
    flex: 0 0 200px;
}

.about-image img {
    width: 100%;
    border: 3px solid var(--lead-color);
    box-shadow: 5px 5px 0 rgba(0,0,0,0.1);
}

.about-text {
    flex: 1;
}

.credentials p {
    margin: 8px 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.credentials strong {
    color: var(--glass-gold);
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.portfolio-item {
    border: 2px solid var(--panel-border);
    padding: 10px;
    background: var(--panel-bg-strong);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.4s ease;
    text-align: center;
    cursor: pointer;
}

.portfolio-item:hover {
    transform: translateY(-3px);
    box-shadow: 5px 5px 15px rgba(0,0,0,0.4);
    border-color: var(--glass-gold);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.lightbox.active {
    display: flex;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 4px solid #fff;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--accent-ruby);
}

/* prev / next arrows for flipping between portfolio pieces */
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 54px; height: 78px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.35);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10001;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
}
.lightbox-prev { left: max(10px, env(safe-area-inset-left, 0px)); }
.lightbox-next { right: max(10px, env(safe-area-inset-right, 0px)); }
.lightbox-nav:hover { background: rgba(0,0,0,0.65); }

#lightbox-caption {
    color: #fff;
    margin-top: 15px;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.portfolio-item span {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);
}

.img-frame img {
    width: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 1 / 1;        /* square frames — the (square-ish) artwork is barely cropped */
    height: auto;
}

/* Services */
.services-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-top: 20px;
}

.service-item {
    padding: 20px;
    background: var(--panel-bg);
    border-left: 4px solid var(--glass-green);
    transition: background 0.4s ease;
}

.service-item h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--accent-green);
}

.service-item p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Contact */
.contact-details {
    background: var(--panel-bg);
    padding: 20px;
    border-left: 4px solid var(--glass-rose);
    transition: background 0.4s ease;
}

.contact-details p {
    margin: 8px 0;
    color: var(--text-muted);
}

.contact-details a {
    color: var(--accent-rose);
    text-decoration: none;
}

.contact-details a:hover {
    text-decoration: underline;
    color: var(--text-strong);
}

/* Footer */
footer {
    text-align: center;
    padding-top: 30px;
    margin-top: 20px;
    border-top: 2px solid var(--hairline);
    font-size: 0.9rem;
    color: var(--text-faint);
}

footer a {
    color: var(--accent-link);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
    color: var(--text-strong);
}

footer p {
    margin: 5px 0;
}

/* Responsive */
@media (max-width: 700px) {
    .frosted-overlay {
        width: 85%;
        padding: 20px;
        margin: 15px auto;
    }

    .about-content {
        flex-direction: column;
    }

    .about-image {
        flex: none;
        width: 150px;
        margin: 0 auto;
    }

    .portfolio-grid,
    .services-list {
        grid-template-columns: 1fr;
    }

    nav a {
        display: block;
        margin: 8px 0;
    }

    h1 {
        font-size: 1.8rem;
    }

    .stained-glass-bg {
        grid-template-columns: 1fr;
    }
}

/* ===== Ginkgo Glass brand additions ===== */
.logo-plaque {
    display: inline-block;
    background: #fdfcf7;
    padding: 18px 34px;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(0,0,0,0.05);
    line-height: 0;
    transition: transform 0.3s ease;
}
.logo-plaque:hover { transform: translateY(-2px); }
.logo-plaque img {
    width: 320px;
    max-width: 70vw;
    height: auto;
}

/* Contact form (mockup, matches live site fields) */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 520px;
    margin-bottom: 24px;
}
.contact-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}
.contact-form input,
.contact-form textarea {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 3px;
    padding: 10px 12px;
    color: var(--input-text);
    font-family: inherit;
    font-size: 1rem;
    transition: background 0.4s ease, border-color 0.2s ease, color 0.4s ease;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--glass-green);
    background: var(--input-bg-focus);
}
.contact-form button {
    align-self: flex-start;
    background: var(--glass-green);
    color: #fff;
    border: none;
    padding: 12px 26px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: bold;
    cursor: pointer;
    transition: filter 0.3s;
}
.contact-form button:hover { filter: brightness(1.15); }
.form-note { color: var(--glass-green); font-size: 0.9rem; margin: 0; }

@media (max-width: 768px) {
    .logo-plaque { padding: 14px 20px; }
    .logo-plaque img { width: 240px; }
}

/* ===== Proxima Nova (local) ===== */
@font-face{font-family:"Proxima Nova";font-weight:300;font-style:normal;font-display:swap;src:url("../fonts/ProximaNova-Light.woff2") format("woff2");}
@font-face{font-family:"Proxima Nova";font-weight:400;font-style:normal;font-display:swap;src:url("../fonts/ProximaNova-Regular.woff2") format("woff2");}
@font-face{font-family:"Proxima Nova";font-weight:700;font-style:normal;font-display:swap;src:url("../fonts/ProximaNova-Bold.woff2") format("woff2");}
body{font-family:"Proxima Nova","Segoe UI",sans-serif;}
h1,h2,h3,.section h2,.service-item h3,.tagline,nav a,.contact-form button,.contact-form label{font-family:"Proxima Nova","Segoe UI",sans-serif;}
.lead{font-weight:300;}

/* ===== Sticky top menu bar ===== */
/* body bg = lead colour: propagates to the page canvas so the notch/status-bar
   strip shows dark — WITHOUT a background on <html>, so the fixed colourful
   .stained-glass-bg still shows through (background propagation stays intact) */
:root { --content-w: 58%; --content-max: 860px; }
body { background-color: var(--page-bg); transition: background-color 0.4s ease; }

/* translucent dimming layer over the frosted glass — a dedicated fixed full-viewport
   element (over-covers top & bottom) so it always shades, incl. behind the iOS toolbar
   (lower alpha = more animation shows through) */
body::before {
    content: "";
    position: fixed;
    top: -200px; left: 0; right: 0;
    /* cover the LARGEST viewport + generous slack so the dimming always reaches
       the very bottom, regardless of the iOS toolbar showing/hiding */
    height: calc(100vh + 600px);    /* fallback (iOS 100vh = large viewport) */
    height: calc(100lvh + 600px);   /* explicit large-viewport cover where supported */
    background: var(--veil);
    z-index: -1;
    pointer-events: none;
    transition: background 0.4s ease;
}
html { scroll-behavior: smooth; scroll-padding-top: calc(52px + env(safe-area-inset-top, 0px)); }

.topbar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    margin: 0;                 /* override theme's `nav { margin-top: 15px }` (the gap!) */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;               /* centre the button band so it lines up with the content column */
    gap: 1rem;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    /* translucent lead — more of the animated glass shows through (frosted) */
    background: var(--topbar-bg);
    backdrop-filter: blur(10px) saturate(1.2);
    -webkit-backdrop-filter: blur(10px) saturate(1.2);
    border-bottom: 1px solid var(--topbar-border);
    box-shadow: var(--topbar-shadow);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    will-change: transform;
}
.topbar--hidden { transform: translateY(-100%); }   /* slides up off screen on scroll-down */

/* Day/night toggle — floats at the right of the bar (out of flex flow so the
   glass panes stay centred); rides with the bar when it auto-hides */
.theme-toggle {
    position: fixed;                                   /* floats top-right on every screen, always visible */
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 1100;                                     /* above the nav bar */
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    padding: 0; margin: 0;
    border: none;
    border-radius: 50%;
    overflow: hidden;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 6px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.theme-toggle:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.45); }
.theme-toggle:active { transform: scale(0.92); }

/* tiny build stamp, lower-right — confirms which deploy you're looking at */
.build-stamp {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    right: calc(env(safe-area-inset-right, 0px) + 8px);
    z-index: 1200;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    color: var(--text-faint);
    opacity: 0.5;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.theme-toggle img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* show the SUN window in night mode (tap → day), the MOON window in day mode (tap → night) */
.theme-toggle .ico-moon { display: none; }
[data-theme="day"] .theme-toggle .ico-sun  { display: none; }
[data-theme="day"] .theme-toggle .ico-moon { display: block; }

.topbar-logo {
    display: flex;
    align-items: center;
    background: #fdfcf7;
    padding: 5px 12px;
    border-radius: 5px;
    line-height: 0;
    flex: 0 0 auto;
}
.topbar-logo img { height: 40px; width: auto; display: block; }
/* nav links rendered as a row of leaded stained-glass panes (borders touch = continuous lead) */
.topbar-links {
    display: flex; gap: 0; flex-wrap: nowrap;
    justify-content: center;               /* menu group centred in the header (desktop) */
    width: auto;
    margin: 0 auto;
}
.topbar-links a:not(:first-child) { margin-left: -3px; }   /* overlap borders into single 3px lead lines */
/* keep only the outer ends of the leaded strip rounded; internal seams stay square */
.topbar-links a:first-child { border-top-left-radius: 7px; border-bottom-left-radius: 7px; }
.topbar-links a:last-child  { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.topbar-links a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    height: 44px;
    padding: 0 16px;
    margin: 0;
    text-decoration: none;
    border: 3px solid #000;                        /* black lead came */
    border-top-width: 4px;                         /* thicker lead along the top */
    border-radius: 0;                              /* internal divisions square (no gap at the top seams) */
    overflow: hidden;
    isolation: isolate;                            /* contain the active-glow blend to this pane */
    box-shadow: inset 0 0 9px rgba(0,0,0,0.5);     /* glass set into the lead */
    filter: brightness(0.92);                      /* vivid; only slightly unlit */
    transition: filter 0.2s ease, box-shadow 0.2s ease;
}
.topbar-links a::after {                           /* subtle scrim so labels read on the glass */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.38) 100%);
}
.topbar-links .pane-label {
    position: relative;
    z-index: 1;
    color: #fff;
    font-family: "Proxima Nova", "Segoe UI", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.85);
    white-space: nowrap;
}
/* real stained-glass panel images */
.topbar-links a[data-target="home"]      { background: url("../images/nav/pane-home.png")      center / cover no-repeat; }
.topbar-links a[data-target="about"]     { background: url("../images/nav/pane-about.png")     center / cover no-repeat; }
.topbar-links a[data-target="portfolio"] { background: url("../images/nav/pane-portfolio.png") center / cover no-repeat; }
.topbar-links a[data-target="services"]  { background: url("../images/nav/pane-services.png")  center / cover no-repeat; }
.topbar-links a[data-target="contact"]   { background: url("../images/nav/pane-contact.png")   center / cover no-repeat; }
.topbar-links a:hover { filter: brightness(1.05); }
/* the current section stays lit — an `overlay` blend brightens the glass but leaves
   the black leads black, and (being inset) it doesn't bleed across the seams */
.topbar-links a.active::after { background: rgba(255,248,224,0.45); mix-blend-mode: overlay; }

/* content starts exactly at the bar's bottom, so the glass only peeks through the bar */
.frosted-overlay { margin-top: calc(48px + env(safe-area-inset-top, 0px)); }

@media (max-width: 1000px) {
    :root { --content-w: 72%; --content-max: 680px; }
}

@media (max-width: 768px) {
    :root { --content-w: 90%; }
    .topbar-links a { min-width: 0; height: 40px; padding: 0 12px; }
    .topbar-links a.nav-home { flex: 0 0 60px; min-width: 60px; width: 60px; padding: 0; }
    .topbar-links .pane-label { font-size: 0.66rem; letter-spacing: 0.5px; }
    html { scroll-padding-top: calc(44px + env(safe-area-inset-top, 0px)); }
    .frosted-overlay { margin-top: calc(44px + env(safe-area-inset-top, 0px)); padding: 32px 0; }
}

/* phones: a single full-width leaded-glass menu image; the 5 links become
   transparent tap-targets laid over it (the labels are baked into the artwork) */
@media (max-width: 560px) {
    :root { --content-w: 92%; }
    /* full-width leaded-glass menu, permanently pinned at the top — built from the
       individual pane images so the section you're viewing can light up */
    .topbar {
        position: fixed;
        padding: env(safe-area-inset-top, 0px) 0 0 0;
        gap: 0;
        border-bottom: none;
        box-shadow: 0 3px 12px rgba(0,0,0,0.45);
    }
    .topbar-links {
        width: 100%; margin: 0; gap: 0;
        aspect-ratio: 846 / 256;
        background: none;
    }
    .topbar-links a,
    .topbar-links a.nav-home,
    .topbar-links a:first-child,
    .topbar-links a:last-child {
        flex: 1; min-width: 0; width: auto; height: auto; padding: 0; margin: 0;
        border: 3px solid #000;            /* black lead — stays black (no filter on the pane) */
        border-top-width: 5px;             /* thicker lead top & bottom (where the came is heavier) */
        border-bottom-width: 5px;
        border-radius: 0;
        isolation: isolate;                /* keep the glow blend contained to this pane */
        box-shadow: inset 0 0 9px rgba(0,0,0,0.3);
        filter: none;                      /* neutralise the desktop brightness filter (it double-lit) */
    }
    .topbar-links a:not(:first-child) { margin-left: -3px; }   /* merge adjacent 3px side borders into one lead */
    .topbar-links a:hover { filter: none; }   /* no sticky tap-hover brightening on mobile */
    .topbar-links a[data-target="home"]      { background: url("../images/nav/m-home.png")      center / cover no-repeat; }
    .topbar-links a[data-target="about"]     { background: url("../images/nav/m-about.png")     center / cover no-repeat; }
    .topbar-links a[data-target="portfolio"] { background: url("../images/nav/m-portfolio.png") center / cover no-repeat; }
    .topbar-links a[data-target="services"]  { background: url("../images/nav/m-services.png")  center / cover no-repeat; }
    .topbar-links a[data-target="contact"]   { background: url("../images/nav/m-contact.png")   center / cover no-repeat; }
    /* unlit by default; the section you're on lights up. An `overlay` blend brightens
       the coloured glass but leaves the BLACK leads black, so the lead never greys out. */
    .topbar-links a::after {
        content: "";
        position: absolute; inset: 0;
        pointer-events: none;
        background: rgba(10,10,14,0.28);     /* gently unlit */
        mix-blend-mode: overlay;
        transition: background 0.35s ease;
    }
    .topbar-links a.active::after { background: rgba(255,248,224,0.45); }   /* lit, but not washed out */
    .topbar-links .pane-label { display: none; }         /* labels live in the images */
    /* floating toggle sits just UNDER the permanent menu (menu height = 30.3vw) */
    .theme-toggle { top: calc(env(safe-area-inset-top, 0px) + 30.3vw + 8px); right: 12px; }
    .frosted-overlay { margin-top: calc(30.3vw + env(safe-area-inset-top, 0px)); }
    html { scroll-padding-top: calc(30.3vw + env(safe-area-inset-top, 0px)); }
}

/* desktop/tablet: sit the toggle centred INSIDE the top header bar (no overlap) */
@media (min-width: 769px) {
    .theme-toggle { top: 5px; width: 34px; height: 34px; }   /* 45px bar */
}
@media (min-width: 561px) and (max-width: 768px) {
    .theme-toggle { top: 3px; width: 34px; height: 34px; }   /* 41px bar */
}

/* centre the section headings (and their intro line where there is one) */
#portfolio > h2,
#portfolio > .lead,
#services > h2,
#contact > h2,
#contact > .lead { text-align: center; }

/* wide desktop: let the Portfolio break out of the narrow content column and
   show its previews 4 across (the rest of the page stays in the column) */
@media (min-width: 1200px) {
    #portfolio {
        width: min(92vw, 1400px);
        margin-left: 50%;
        transform: translateX(-50%);     /* centre the wider band on the viewport */
    }
    #portfolio .lead { max-width: 640px; margin-left: auto; margin-right: auto; }  /* centred, readable line length */
    #portfolio .portfolio-grid { grid-template-columns: repeat(4, 1fr); }
}
