/* ===== Theme ===== */

:root {
    color-scheme: light dark;
    --bg: light-dark(#fff, #000);
    --fg: light-dark(#000, #fff);
    --muted: light-dark(#6b6b6b, #8a8a8a);
    --line: light-dark(#e2e2e2, #262626);
    --glow: light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.09));
    --max: 72rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* set by the inline head script / toggle; without it the system scheme applies */
:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

/* ===== Base ===== */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* soft spotlight behind the hero */
body::before {
    content: "";
    position: fixed;
    inset: -20% -20% auto -20%;
    height: 80vh;
    background: radial-gradient(ellipse at 30% 0%, var(--glow), transparent 60%);
    pointer-events: none;
    z-index: -1;
}

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

:focus-visible {
    outline: 3px solid var(--fg);
    outline-offset: 3px;
}

em {
    font-style: italic;
    font-weight: 300;
}

.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
    padding: 0.5rem 1rem;
    background: var(--fg);
    color: var(--bg);
    transform: translateY(-200%);
}

.skip-link:focus-visible {
    transform: none;
}

/* ===== Layout ===== */

.site-header,
main,
.site-footer {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding-left: clamp(1.25rem, 4vw, 3rem);
    padding-right: clamp(1.25rem, 4vw, 3rem);
}

main {
    flex: 1;
}

/* ===== Header ===== */

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 2rem;
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
}

.brand .logo {
    display: block;
    width: clamp(14rem, 60vw, 34rem);
    aspect-ratio: 460 / 50;
    /* mask lets the logo take the current text colour in both themes */
    background: var(--fg);
    -webkit-mask: url("../images/logo-transparent.svg") no-repeat center / contain;
    mask: url("../images/logo-transparent.svg") no-repeat center / contain;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    /* --muted (not --line) keeps the control boundary at >= 3:1 (WCAG 1.4.11) */
    border: 1px solid var(--muted);
    border-radius: 50%;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s, transform 0.5s var(--ease);
}

.theme-toggle svg {
    width: 1rem;
    height: 1rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--fg);
    border-color: var(--fg);
    transform: rotate(180deg);
}

.mail {
    font-size: 0.9375rem;
    color: var(--muted);
    transition: color 0.3s;
    white-space: nowrap;
}

.mail:hover,
.mail:focus-visible {
    color: var(--fg);
}

/* ===== Hero ===== */

.hero {
    padding: clamp(4rem, 14vh, 9rem) 0 clamp(3rem, 8vh, 5rem);
}

.hero h1 {
    margin: 0 0 1.25rem;
    font-size: clamp(3rem, 11vw, 9rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.045em;
}

.hero .line {
    display: block;
    overflow: hidden;
    animation: rise 1s var(--ease) both;
}

.hero .line:nth-child(2) {
    animation-delay: 0.1s;
}

.hero p {
    margin: 0;
    max-width: 28ch;
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    color: var(--muted);
    animation: rise 1s var(--ease) 0.25s both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(1.5rem);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ===== Services ===== */

.services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    animation: rise 1s var(--ease) 0.4s both;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 2rem 4rem 2rem 2rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background 0.4s var(--ease);
}

.card:hover,
.card:focus-visible {
    background: var(--fg);
    color: var(--bg);
    outline-offset: -6px;
    outline-color: var(--bg);
}

.card h2 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.card p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    transition: color 0.4s var(--ease);
}

.card:hover p,
.card:focus-visible p {
    color: var(--bg);
    opacity: 0.6;
}

.card .arrow {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    font-size: 1.5rem;
    transition: transform 0.4s var(--ease);
}

.card:hover .arrow,
.card:focus-visible .arrow {
    transform: translate(0.35rem, -50%);
}

/* ===== CTA ===== */

.cta {
    padding: clamp(4rem, 12vh, 8rem) 0;
}

.cta p {
    margin: 0 0 0.5rem;
    color: var(--muted);
}

.big-link {
    display: inline-block;
    font-size: clamp(1.75rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-size: 0% 2px;
    background-position: 0 100%;
    padding-bottom: 0.1em;
    transition: background-size 0.5s var(--ease);
}

.big-link:hover,
.big-link:focus-visible {
    background-size: 100% 2px;
}

/* ===== Footer ===== */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--line);
    font-size: 0.8125rem;
    color: var(--muted);
}

.site-footer address {
    font-style: normal;
}

.site-footer p {
    margin: 0;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--fg);
}

/* ===== Error pages ===== */

.error {
    padding: clamp(4rem, 14vh, 9rem) 0;
}

.error h1 {
    margin: 0 0 1rem;
    font-size: clamp(2.5rem, 8vw, 6rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.045em;
}

.error p {
    margin: 0 0 2rem;
    color: var(--muted);
}

/* ===== Preferences ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* the masked logo is a background and would vanish in high-contrast mode */
@media (forced-colors: active) {
    .brand .logo {
        forced-color-adjust: none;
        background: CanvasText;
    }
}
