/* Global light / dark appearance ---------------------------------------- */

html[data-site-theme="light"] {
    color-scheme: light;
    --bg-primary: #f1efe7;
    --bg-secondary: #e8e5dc;
    --bg-tertiary: #dedbd2;
    --bg-card: #f8f6ef;
    --text-primary: #080a09;
    --text-secondary: #525752;
    --text-muted: #737872;
    --line-light: rgba(15, 20, 17, .14);

    --revamp-paper: #f1efe7;
    --revamp-paper-soft: #e8e5dc;
    --revamp-soft: #e8e5dc;
    --revamp-panel: #f8f6ef;
    --revamp-ink: #080a09;
    --revamp-ink-soft: #0e1211;
    --revamp-muted: #686d68;
    --revamp-light-line: rgba(15, 20, 17, .14);

    --site-toggle-bg: #080a09;
    --site-toggle-fg: #f8f6ef;
    --site-toggle-line: rgba(248, 246, 239, .52);
}

html[data-site-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #080a09;
    --bg-secondary: #0e1211;
    --bg-tertiary: #151917;
    --bg-card: #0e1211;
    --text-primary: #f8f6ef;
    --text-secondary: #d4d1c8;
    --text-muted: #aaa79f;
    --line-light: rgba(255, 255, 255, .2);

    --revamp-paper: #080a09;
    --revamp-paper-soft: #0e1211;
    --revamp-soft: #0e1211;
    --revamp-panel: #151917;
    --revamp-ink: #f8f6ef;
    --revamp-ink-soft: #e8e5dc;
    --revamp-orange-deep: #ff6847;
    --revamp-muted: #bbb8af;
    --revamp-light-line: rgba(255, 255, 255, .2);

    --site-toggle-bg: #f8f6ef;
    --site-toggle-fg: #080a09;
    --site-toggle-line: rgba(8, 10, 9, .42);
}

html,
body,
main {
    background-color: var(--revamp-paper);
}

body {
    color: var(--revamp-ink);
    transition: color .28s ease, background-color .28s ease;
}

::selection {
    color: #ffffff;
    background: var(--revamp-orange);
}

/* The one site-wide control lives in the navigation. */
.site-theme-toggle {
    position: relative;
    display: grid;
    width: 74px;
    height: 40px;
    min-height: 0;
    padding: 3px;
    place-items: center;
    flex: 0 0 auto;
    color: #343a3a;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    perspective: 520px;
    isolation: isolate;
    transition: transform .22s ease, filter .22s ease;
}

.site-theme-toggle:hover {
    filter: saturate(1.08);
    transform: translateY(-2px) scale(1.015);
}

.site-theme-toggle:focus-visible {
    outline: 3px solid var(--revamp-orange);
    outline-offset: 3px;
}

.site-theme-toggle__track {
    position: relative;
    display: block;
    width: 68px;
    height: 34px;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 255, 255, .98), transparent 38%),
        linear-gradient(145deg, #d6d7d3 0%, #f8f7f1 50%, #c7cac8 100%);
    border: 1px solid rgba(8, 10, 9, .2);
    border-radius: 999px;
    box-shadow:
        inset 5px 6px 10px rgba(8, 10, 9, .2),
        inset -5px -5px 9px rgba(255, 255, 255, .94),
        0 7px 14px rgba(8, 10, 9, .18),
        0 1px 0 rgba(255, 255, 255, .86);
    transform: rotateX(3deg);
    transform-style: preserve-3d;
    transition: background .42s ease, border-color .32s ease, box-shadow .42s ease, transform .18s ease;
}

.site-theme-toggle__track::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(8, 10, 9, .09);
    border-radius: inherit;
    box-shadow: inset 0 2px 5px rgba(8, 10, 9, .16);
    pointer-events: none;
}

.site-theme-toggle__track::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    width: 24px;
    height: 24px;
    background: radial-gradient(circle, rgba(240, 74, 36, .44), rgba(240, 74, 36, .08) 58%, transparent 72%);
    border-radius: 50%;
    filter: blur(5px);
    opacity: .34;
    transform: translateX(0);
    transition: transform .58s cubic-bezier(.16, 1.2, .3, 1), opacity .3s ease;
    pointer-events: none;
}

.site-theme-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    z-index: 2;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: #363b3b;
    background:
        radial-gradient(circle at 31% 20%, rgba(255, 255, 255, 1) 0 8%, rgba(255, 255, 255, .56) 9% 20%, transparent 35%),
        linear-gradient(145deg, #ffffff 0%, #e0e1dd 49%, #acb0af 100%);
    border: 1px solid rgba(255, 255, 255, .92);
    border-radius: 50%;
    box-shadow:
        0 8px 11px rgba(8, 10, 9, .36),
        0 2px 3px rgba(8, 10, 9, .24),
        inset 2px 2px 4px rgba(255, 255, 255, .95),
        inset -3px -4px 6px rgba(70, 76, 75, .2);
    transform: translate3d(0, 0, 8px) rotateY(-7deg) rotateX(4deg);
    transform-style: preserve-3d;
    transition:
        transform .58s cubic-bezier(.16, 1.22, .3, 1),
        color .32s ease,
        background .42s ease,
        border-color .32s ease,
        box-shadow .42s ease;
}

.site-theme-toggle__thumb::after {
    content: "";
    position: absolute;
    inset: 2px 4px auto;
    height: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .82), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.site-theme-toggle__icon {
    position: absolute;
    width: 15px;
    height: 15px;
    overflow: visible;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .62));
    transform: translateZ(4px) rotate(0) scale(1);
    transition: opacity .26s ease, transform .48s cubic-bezier(.16, 1, .3, 1);
}

.site-theme-toggle__icon--moon {
    opacity: 0;
    transform: translateZ(4px) rotate(-55deg) scale(.5);
}

.site-theme-toggle:hover .site-theme-toggle__thumb {
    transform: translate3d(0, -1px, 12px) rotateY(-4deg) rotateX(2deg) scale(1.045);
}

.site-theme-toggle:active .site-theme-toggle__track {
    transform: rotateX(7deg) scale(.985);
}

.site-theme-toggle:active .site-theme-toggle__thumb {
    transform: translate3d(1px, 1px, 4px) rotateY(-3deg) scale(.94);
}

html[data-site-theme="dark"] .site-theme-toggle__track {
    background:
        radial-gradient(circle at 82% 78%, rgba(240, 74, 36, .2), transparent 34%),
        linear-gradient(145deg, #11151d 0%, #2c3443 52%, #080b10 100%);
    border-color: rgba(255, 255, 255, .24);
    box-shadow:
        inset 5px 6px 10px rgba(0, 0, 0, .7),
        inset -4px -4px 8px rgba(142, 155, 180, .2),
        0 8px 17px rgba(0, 0, 0, .38),
        0 0 0 1px rgba(240, 74, 36, .08);
}

html[data-site-theme="dark"] .site-theme-toggle__track::before {
    border-color: rgba(255, 255, 255, .08);
    box-shadow: inset 0 3px 7px rgba(0, 0, 0, .62);
}

html[data-site-theme="dark"] .site-theme-toggle__track::after {
    opacity: .72;
    transform: translateX(34px);
}

html[data-site-theme="dark"] .site-theme-toggle__thumb {
    color: #f8f6ef;
    background:
        radial-gradient(circle at 72% 78%, rgba(240, 74, 36, .42), transparent 42%),
        radial-gradient(circle at 30% 18%, rgba(255, 255, 255, .58), transparent 27%),
        linear-gradient(145deg, #687184 0%, #3e4656 48%, #202631 100%);
    border-color: rgba(255, 255, 255, .42);
    box-shadow:
        -1px 9px 13px rgba(0, 0, 0, .58),
        0 0 14px rgba(240, 74, 36, .24),
        inset 2px 2px 4px rgba(255, 255, 255, .4),
        inset -4px -5px 7px rgba(0, 0, 0, .34);
    transform: translate3d(34px, 0, 8px) rotateY(7deg) rotateX(4deg);
}

html[data-site-theme="dark"] .site-theme-toggle__icon--sun {
    opacity: 0;
    transform: translateZ(4px) rotate(55deg) scale(.5);
}

html[data-site-theme="dark"] .site-theme-toggle__icon--moon {
    opacity: 1;
    transform: translateZ(4px) rotate(0) scale(1);
}

html[data-site-theme="dark"] .site-theme-toggle:hover .site-theme-toggle__thumb {
    transform: translate3d(34px, -1px, 12px) rotateY(4deg) rotateX(2deg) scale(1.045);
}

html[data-site-theme="dark"] .site-theme-toggle:active .site-theme-toggle__thumb {
    transform: translate3d(33px, 1px, 4px) rotateY(3deg) scale(.94);
}

/* Navigation chrome changes theme; the original logo artwork is untouched. */
html[data-site-theme="dark"] .phase-one .navbar {
    background: rgba(8, 10, 9, .94);
    border-color: rgba(255, 255, 255, .2);
    box-shadow: 0 14px 42px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .09);
}

html[data-site-theme="dark"] .phase-one .nav-brand {
    padding-right: 7px;
    padding-left: 4px;
    background: #f1efe7;
    border-radius: 9px;
}

html[data-site-theme="dark"] .phase-one .nav-links {
    border-right-color: rgba(255, 255, 255, .15);
    border-left-color: rgba(255, 255, 255, .15);
}

html[data-site-theme="dark"] .phase-one .nav-item {
    color: rgba(248, 246, 239, .82);
}

html[data-site-theme="dark"] .phase-one .nav-item.is-active,
html[data-site-theme="dark"] .phase-one .nav-item:hover,
html[data-site-theme="dark"] .phase-one .nav-item:focus-visible {
    color: #ffffff;
}

html[data-site-theme="dark"] .phase-one .nav-links:has(.nav-item:hover) .nav-item:not(:hover) {
    color: rgba(248, 246, 239, .42);
}

/* Video and canvas artwork keep their authored colors in both modes. */
.phase-one .hero-sequence {
    --revamp-ink: #080a09;
    --revamp-panel: #f8f6ef;
    --revamp-dark-line: rgba(255, 255, 255, .13);
    color-scheme: dark;
}

.hero-sequence img,
.hero-sequence video,
.hero-sequence canvas,
.gryx-logo,
.footer-compute-showcase img,
.footer-compute-showcase video,
.footer-compute-showcase canvas {
    filter: none;
}

/* Living-system chapter */
html[data-site-theme="dark"] .phase-two-story .rock-showcase__frame {
    background: #0e1211;
    box-shadow: 0 22px 70px rgba(0, 0, 0, .32);
}

html[data-site-theme="dark"] .phase-two-story .rock-showcase__header {
    background: rgba(14, 18, 17, .88);
}

html[data-site-theme="dark"] .phase-two-story .rock-showcase__hint b {
    color: rgba(248, 246, 239, .38);
}

html[data-site-theme="dark"] .phase-two-story .rock-interaction {
    background: #0e1211;
}

html[data-site-theme="dark"] .phase-two-story .strata-survey {
    --strata-ink: #f8f6ef;
    --strata-blue: #73dbe4;
    background-color: #0e1211;
}

html[data-site-theme="dark"] .phase-two-story .rock-cursor-grid {
    mix-blend-mode: normal;
}

html[data-site-theme="dark"] .phase-two-story .strata-icon-paper {
    fill: #0e1211;
}

html[data-site-theme="dark"] .phase-two-story .strata-title-block i {
    background: rgba(248, 246, 239, .74);
}

html[data-site-theme="dark"] .phase-two-story .strata-sample-card {
    background: rgba(21, 25, 23, .82);
    border-color: rgba(248, 246, 239, .5);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

html[data-site-theme="dark"] .phase-two-story .strata-sample-image {
    color: rgba(248, 246, 239, .58);
    background: rgba(8, 10, 9, .72);
    border-color: rgba(248, 246, 239, .44);
}

html[data-site-theme="dark"] .phase-two-story .rock-interaction::before {
    mix-blend-mode: normal;
}

html[data-site-theme="dark"] .phase-two-story .rock-interaction::after {
    color: rgba(248, 246, 239, .56);
}

/* Services and proof surfaces */
html[data-site-theme="dark"] .services-ledger::before {
    background:
        radial-gradient(circle at 17px 17px, rgba(255, 255, 255, .13) 0 .72px, transparent .92px) 0 0 / 34px 34px,
        linear-gradient(90deg, transparent calc(25% - .5px), rgba(255, 255, 255, .055) 25%, transparent calc(25% + .5px)),
        linear-gradient(90deg, transparent calc(75% - .5px), rgba(255, 255, 255, .055) 75%, transparent calc(75% + .5px));
}

html[data-site-theme="dark"] .services-ledger::after {
    background: linear-gradient(180deg, rgba(8, 10, 9, .12), transparent 26%, rgba(8, 10, 9, .78));
}

html[data-site-theme="dark"] .why-choose::before {
    background:
        linear-gradient(90deg, transparent calc(25% - .5px), rgba(255, 255, 255, .055) 25%, transparent calc(25% + .5px)),
        linear-gradient(90deg, transparent calc(75% - .5px), rgba(255, 255, 255, .055) 75%, transparent calc(75% + .5px));
}

html[data-site-theme="dark"] .why-choose__grid {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .18);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

html[data-site-theme="dark"] .why-choice {
    background: #0e1211;
}

html[data-site-theme="dark"] .why-choice__meta b {
    color: rgba(248, 246, 239, .56);
}

html[data-site-theme="dark"] .why-choice--delivery::before {
    background: #f8f6ef;
}

html[data-site-theme="dark"] .why-choice--delivery .why-choice__meta span {
    color: #f8f6ef;
}

html[data-site-theme="dark"] .why-choice--delivery .why-choice__dither {
    filter: invert(1);
}

html[data-site-theme="dark"] .why-choice__partnership {
    filter: grayscale(1) contrast(1.85);
    mix-blend-mode: screen;
}

@media (hover: hover) {
    html[data-site-theme="dark"] .why-choice:hover .why-choice__meta b {
        color: rgba(8, 10, 9, .58);
    }

    html[data-site-theme="dark"] .why-choice--delivery:hover .why-choice__meta span {
        color: #080a09;
    }

    html[data-site-theme="dark"] .why-choice--delivery:hover .why-choice__dither {
        filter: none;
    }
}

/* Trust strip inherits the global text tokens; contact's art half stays dark. */
html[data-site-theme="dark"] .contact-composite__intro {
    background:
        linear-gradient(90deg, transparent calc(50% - .5px), rgba(255, 255, 255, .06) 50%, transparent calc(50% + .5px)),
        #0e1211;
    border-right-color: rgba(255, 255, 255, .2);
    box-shadow: inset 0 1px rgba(255, 255, 255, .08), inset 0 -18px 38px rgba(0, 0, 0, .14);
}

html[data-site-theme="dark"] .contact-deck__lead > p {
    color: rgba(248, 246, 239, .78);
}

html[data-site-theme="dark"] .contact-deck__offices--light {
    border-top-color: rgba(255, 255, 255, .2);
    border-bottom-color: rgba(255, 255, 255, .2);
}

html[data-site-theme="dark"] .contact-deck__offices--light .contact-office + .contact-office {
    border-left-color: rgba(255, 255, 255, .2);
}

html[data-site-theme="dark"] .contact-office__icon-badge {
    background: #24120e;
    border-color: rgba(255, 104, 71, .42);
}

html[data-site-theme="dark"] .contact-office__tag,
html[data-site-theme="dark"] .contact-office__row dt {
    color: rgba(248, 246, 239, .58);
}

html[data-site-theme="dark"] .contact-office__row dd {
    color: rgba(248, 246, 239, .9);
}

html[data-site-theme="dark"] .contact-deck__offices--light .contact-office__details a {
    color: #ffffff;
}

html[data-site-theme="dark"] .contact-deck__response-badge {
    color: rgba(248, 246, 239, .64);
}

/* Smooth only the UI surfaces that actually change. */
.phase-one .navbar,
.phase-two-story.rock-showcase,
.phase-two-story .rock-showcase__frame,
.phase-two-story .rock-showcase__header,
.phase-two-story .rock-interaction,
.phase-two-story .strata-survey,
.phase-two-rail,
.services-ledger,
.why-choose,
.why-choice,
.contact-composite__intro {
    transition: color .28s ease, background-color .28s ease, border-color .28s ease, box-shadow .28s ease;
}

@media (max-width: 430px) {
    .site-theme-toggle {
        width: 64px;
        height: 36px;
        padding: 3px;
    }

    .site-theme-toggle__track {
        width: 58px;
        height: 30px;
    }

    .site-theme-toggle__thumb {
        width: 24px;
        height: 24px;
    }

    .site-theme-toggle__icon {
        width: 13px;
        height: 13px;
    }

    html[data-site-theme="dark"] .site-theme-toggle__track::after {
        transform: translateX(30px);
    }

    html[data-site-theme="dark"] .site-theme-toggle__thumb {
        transform: translate3d(30px, 0, 8px) rotateY(7deg) rotateX(4deg);
    }

    html[data-site-theme="dark"] .site-theme-toggle:hover .site-theme-toggle__thumb {
        transform: translate3d(30px, -1px, 12px) rotateY(4deg) rotateX(2deg) scale(1.045);
    }

    html[data-site-theme="dark"] .site-theme-toggle:active .site-theme-toggle__thumb {
        transform: translate3d(29px, 1px, 4px) rotateY(3deg) scale(.94);
    }
}

@media (prefers-reduced-motion: reduce) {
    body,
    .site-theme-toggle,
    .site-theme-toggle__track,
    .site-theme-toggle__track::after,
    .site-theme-toggle__thumb,
    .site-theme-toggle__icon,
    .phase-one .navbar,
    .phase-two-story.rock-showcase,
    .phase-two-story .rock-showcase__frame,
    .phase-two-story .rock-showcase__header,
    .phase-two-story .rock-interaction,
    .phase-two-story .strata-survey,
    .phase-two-rail,
    .services-ledger,
    .why-choose,
    .why-choice,
    .contact-composite__intro {
        transition: none;
    }
}
