/* sach.co.za
   Motion values (easings, durations, stagger) follow stitch.me. */

:root {
    --ink: #0f0c15;
    --ink-inverse: #fcfbfb;
    --muted: rgba(15, 12, 21, 0.5);
    --bg: #ffffff;
    --surface-1: #fcfbfb;
    --surface-2: #f5f4f4;
    --accent: #6e2cff;
    --accent-hover: #5a24d9;
    --lime: #daff35;
    --heart: #f87272;

    --font-display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
    --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

    --text-sm: 0.8rem;
    --text-base: 1rem;
    --text-md: 1.25rem;
    --text-lg: 1.5625rem;
    --text-2xl: 2.441rem;
    --text-3xl: 3.052rem;
    --text-5xl: 4.768rem;

    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 40px;
    --radius-pill: 9999px;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-enter: cubic-bezier(0.38, 0.13, 0, 0.88);
    --ease-headline: cubic-bezier(1, 0.02, 0, 0.85);
    --ease-blob: cubic-bezier(0.73, 0.49, 0, 0.89);
    --ease-carousel: cubic-bezier(0.87, 0.12, 0.11, 0.88);

    --max-width: 94rem;
    --pad-x: clamp(1.5rem, 5vw, 3.5rem);
    --section-gap: clamp(6.75rem, 15.75vw, 11.25rem);
    --stack-gap: clamp(1.5rem, 3vw, 2.5rem);
    --element-gap: clamp(1.25rem, 2.5vw, 2rem);
    --header-h: 4.5rem;
    --footer-height: 0px;
}

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

html {
    overflow-x: clip;
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
}

body {
    margin: 0;
    padding-top: var(--header-h);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
figure { margin: 0; }
h1, h2, p { margin: 0; }

.wrap {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding-left: var(--pad-x);
    padding-right: var(--pad-x);
}

.display {
    font-family: var(--font-display);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    line-height: 0.85;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-pill);
}

/* Placeholder surfaces (swap for photos) */

.ph--mono   { background: linear-gradient(160deg, #e2e2e2, #3a3a3a); }
.ph--sun    { background: radial-gradient(circle at 30% 30%, #ffd54a, #f4a61c 70%); }
.ph--clay   { background: linear-gradient(140deg, #d9b8a0 0%, #7fb2e5 55%, #e0552f 100%); }
.ph--sky    { background: radial-gradient(circle at 40% 30%, #6fb6ff, #1f6fe0 70%); }
.ph--sunset { background: linear-gradient(135deg, #3a7bff 0%, #ff3d8b 50%, #ff7a1a 100%); }
.ph--violet { background: radial-gradient(circle at 70% 20%, #b8f25a, #4b5bff 45%, #3a2bd8 100%); }
.ph--mint   { background: radial-gradient(circle at 50% 60%, #daff35, #59fcf9 60%, #eae7fc 100%); }

/* ---------- Split CTA button ---------- */

.btn-cta {
    --btn-h: 40px;
    --btn-r: 20px;
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.2;
    color: var(--ink-inverse);
    white-space: nowrap;
    transition: transform 150ms ease-out;
}

.btn-cta:active { transform: scale(0.98); }

.btn-cta__label,
.btn-cta__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--btn-h);
    border-radius: var(--btn-r);
    background: var(--accent);
    transition: background-color 200ms ease-out;
}

.btn-cta__label { padding: 0 1.3rem 0 1.25rem; }

.btn-cta__morph {
    display: block;
    flex: 0 0 7px;
    width: 7px;
    height: var(--btn-h);
    margin-left: -4px;
    color: var(--accent);
    transition: color 200ms ease-out;
}

.btn-cta__icon {
    position: relative;
    width: var(--btn-h);
    margin-left: -4px;
    font-size: 0.9rem;
    line-height: 1;
}

/* Plus sign drawn with two bars */
.btn-cta:not(.btn-cta--surface) .btn-cta__icon::before,
.btn-cta:not(.btn-cta--surface) .btn-cta__icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: currentColor;
    border-radius: 1px;
    transform: translate(-50%, -50%);
    transition: transform 320ms var(--ease-out);
}
.btn-cta:not(.btn-cta--surface) .btn-cta__icon::before { width: 11px; height: 1.5px; }
.btn-cta:not(.btn-cta--surface) .btn-cta__icon::after  { width: 1.5px; height: 11px; }

.btn-cta:hover .btn-cta__label,
.btn-cta:hover .btn-cta__icon { background-color: var(--accent-hover); }
.btn-cta:hover .btn-cta__morph { color: var(--accent-hover); }
.btn-cta:not(.btn-cta--surface):hover .btn-cta__icon::before,
.btn-cta:not(.btn-cta--surface):hover .btn-cta__icon::after { transform: translate(-50%, -50%) rotate(90deg); }

/* Lime "surface" variant with an arrow */
.btn-cta--surface { color: var(--ink); }
.btn-cta--surface .btn-cta__label,
.btn-cta--surface:hover .btn-cta__label { background: linear-gradient(to right, var(--lime), var(--surface-2)); }
.btn-cta--surface .btn-cta__icon,
.btn-cta--surface:hover .btn-cta__icon { background: var(--surface-2); }
.btn-cta--surface .btn-cta__morph,
.btn-cta--surface:hover .btn-cta__morph { color: var(--surface-2); }
.btn-cta--surface .btn-cta__icon { transition: transform 200ms var(--ease-out); }
.btn-cta--surface:hover .btn-cta__icon { transform: translateX(3px); }

/* ---------- Header ---------- */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg);
    transition: transform 320ms var(--ease-out);
}

html.header-hidden .site-header {
    transform: translateY(-100%);
    pointer-events: none;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--element-gap);
    height: var(--header-h);
}

.site-header__start,
.site-header__actions {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.5vw, 1.75rem);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.9rem;
    font-weight: 500;
    letter-spacing: -0.05em;
    line-height: 1;
}

.logo__mark { display: block; width: 2.6rem; height: 2.6rem; transition: color 200ms ease-out; }
.logo:hover .logo__mark { color: var(--accent); }

.site-nav {
    display: flex;
    gap: clamp(1rem, 2vw, 1.5rem);
    font-size: 0.9rem;
}

.site-nav a { transition: opacity 60ms ease-out; }
.site-nav a:hover { opacity: 0.65; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: 6px; }

/* Work / Personal switch with sliding blurred blob */

.site-switch__canvas {
    position: relative;
    width: calc(252 / 44 * 32px);
    height: 32px;
}

.site-switch__shape { display: block; width: 100%; height: 100%; }

.site-switch__indicator {
    transform: translate(186px, 0);
    transform-box: fill-box;
    transition: transform 620ms var(--ease-blob);
}

.site-switch[data-blob="work"] .site-switch__indicator { transform: translate(0, 0); }
.site-switch[data-blob="personal"] .site-switch__indicator { transform: translate(186px, 0); }

.site-switch__controls {
    position: absolute;
    inset: 0;
    display: flex;
}

.site-switch__tab {
    flex: 1 1 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
}

/* Mobile menu toggles */

.menu-toggle,
.menu-close {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--ink);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.menu-toggle__bars,
.menu-toggle__bars::after,
.menu-close__x,
.menu-close__x::after {
    display: block;
    width: 16px;
    height: 1.5px;
    background: currentColor;
    border-radius: 1px;
}

.menu-toggle__bars { position: relative; transform: translateY(-3px); }
.menu-toggle__bars::after { content: ""; position: absolute; top: 6px; }

.menu-close__x { position: relative; transform: rotate(45deg); }
.menu-close__x::after { content: ""; position: absolute; transform: rotate(90deg); }

@media (max-width: 1023px) {
    .site-nav,
    .site-header__actions > .btn-cta,
    .site-header__start .site-switch { display: none; }
    .menu-toggle { display: inline-flex; }
}

/* ---------- Mobile menu ---------- */

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 200;
    overflow: hidden;
    pointer-events: none;
}

html.menu-open { overflow: hidden; }
html.menu-open .mobile-menu { pointer-events: auto; }
html.menu-open .site-header { z-index: 210; background: transparent; transform: none; pointer-events: auto; }
html.menu-open .menu-toggle { display: none; }
html.menu-open .menu-close { display: inline-flex; }

.mobile-menu__panel {
    position: absolute;
    inset: 0;
    display: flex;
    min-height: 100dvh;
    background-color: var(--bg);
    background-image: linear-gradient(to bottom, #fff 0%, #fff 30%, var(--menu-mid, #eff6d0) 58%, var(--menu-end, #daff35) 100%);
    transform: translate3d(100%, 0, 0);
    transition: transform 480ms var(--ease-enter);
}

html.menu-open .mobile-menu__panel { transform: translate3d(0, 0, 0); }

.mobile-menu__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    padding: var(--header-h) var(--pad-x) clamp(2.5rem, 10vh, 4.5rem);
}

.mobile-menu__nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
}

.mobile-menu__link { font-size: max(8.75vw, 2.5rem); }

.mobile-menu__footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.mobile-menu__mail { font-size: 0.9rem; }

@keyframes menu-item-in {
    from { opacity: 0; transform: translateY(1.25rem); }
    to   { opacity: 1; transform: translateY(0); }
}

html.menu-open .mobile-menu__link,
html.menu-open .mobile-menu__footer > * {
    animation: menu-item-in 520ms var(--ease-enter) both;
    animation-delay: calc(200ms + var(--i, 0) * 75ms);
}

.mobile-menu__link:nth-child(1) { --i: 0; }
.mobile-menu__link:nth-child(2) { --i: 1; }
.mobile-menu__link:nth-child(3) { --i: 2; }
.mobile-menu__link:nth-child(4) { --i: 3; }
.mobile-menu__footer > :nth-child(1) { --i: 4; }
.mobile-menu__footer > :nth-child(2) { --i: 5; }

/* ---------- Main + footer reveal ---------- */

main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--section-gap);
    padding-bottom: clamp(5rem, 12.5vw, 10rem);
    background: var(--bg);
    margin-bottom: calc(var(--footer-height) - 1.5rem);
    border-bottom-left-radius: 3rem;
    border-bottom-right-radius: 3rem;
}

/* ---------- Hero ---------- */

.hero { padding-top: clamp(0.75rem, 2vw, 1.25rem); }

.hero__media {
    width: 100%;
    aspect-ratio: 2.39;
    max-height: 55vh;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--surface-2);
}

.hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 30%;
}

.hero__headline-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    margin: clamp(-4rem, -6vw, -2.5rem) auto 0;
}

.hero__panel {
    width: 100%;
    max-width: 50vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2vw;
    background: var(--bg);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    text-align: center;
}

.hero__headline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    font-size: 4.25vw;
    line-height: 0.9;
}

.hero__roles {
    display: grid;
    place-items: center;
    color: var(--accent);
}

.hero__role {
    grid-area: 1 / 1;
    opacity: 0;
    transform: translateY(0.75rem);
}

.hero__role.is-active { opacity: 1; transform: translateY(0); }
.hero__role.is-in  { animation: hero-line-in 450ms var(--ease-headline) forwards; }
.hero__role.is-out { animation: hero-line-out 450ms var(--ease-headline) forwards; }

@keyframes hero-line-in {
    from { opacity: 0; transform: translateY(0.75rem); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes hero-line-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-0.75rem); }
}

.hero__body {
    margin-top: 2rem;
    max-width: 40ch;
    font-size: var(--text-md);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.5;
    color: var(--muted);
}

.hero__actions {
    display: flex;
    justify-content: center;
    margin-top: var(--element-gap);
}

/* ---------- Carousel ("What I work on") ---------- */

.logo-bar {
    position: relative;
    isolation: isolate;
    overflow-x: clip;
    text-align: center;
}

.logo-bar__title {
    margin-bottom: var(--element-gap);
    font-size: var(--text-2xl);
    line-height: 1;
}

.logo-bar__copy {
    max-width: 52ch;
    margin: 0 auto;
    line-height: 1.55;
    color: var(--muted);
}

.carousel {
    --carousel-card: 36vw;
    position: relative;
    z-index: -1;
    width: 100%;
    margin-top: -6vw;
    overflow-x: clip;
    pointer-events: none;
}

.carousel__track {
    position: relative;
    width: 100%;
    height: calc(var(--carousel-card) + 2rem);
    perspective: 600px;
    transform-style: preserve-3d;
}

.carousel__card {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--carousel-card);
    height: var(--carousel-card);
    border-radius: 48px;
    overflow: hidden;
    backface-visibility: hidden;
    transform: translate(-50%, -50%)
        translateX(var(--x, 0px))
        rotateY(var(--ry, 0deg))
        translateZ(var(--z, 0px));
    opacity: var(--o, 1);
    z-index: var(--stack, 1);
    transition:
        transform 1500ms var(--ease-carousel),
        opacity 1500ms var(--ease-carousel);
}

.carousel__card.is-instant { transition: none; }

.carousel__surface { position: absolute; inset: 0; }

.carousel__plate {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62%;
    aspect-ratio: 3 / 2;
    padding: 0.75rem 1rem;
    border-radius: 32px;
    background: var(--bg);
    box-shadow: 0 10px 28px rgba(15, 12, 21, 0.12);
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-weight: 900;
    font-size: calc(var(--carousel-card) * 0.075);
    letter-spacing: -0.04em;
    color: var(--accent);
}

.carousel__plate--blue { background: #36b0ff; color: var(--ink); }
.carousel__plate--lime { background: var(--lime); color: var(--ink); }
.carousel__plate--ink  { background: var(--ink); color: var(--lime); }

/* ---------- Work (sticky media, scrolling copy) ---------- */

.work {
    --sticky-h: calc(100vh - var(--header-h));
}

.work__layout {
    opacity: 0;
    transition: opacity 520ms var(--ease-out);
}

.work.is-entered .work__layout { opacity: 1; }
html:not(.js) .work__layout { opacity: 1; }

.work__media-col { display: none; }

.work__sticky {
    position: sticky;
    top: var(--header-h);
    height: var(--sticky-h);
    display: flex;
    align-items: center;
    justify-content: center;
}

.work__media {
    position: relative;
    width: 100%;
    max-width: min(100%, 560px);
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-2xl);
    overflow: hidden;
}

.work__image {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 180ms linear;
    will-change: opacity;
}

.work__image:first-child { opacity: 1; }

.work__panel-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.work__panel-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    margin-bottom: var(--stack-gap);
    border-radius: var(--radius-2xl);
}

.work__panel + .work__panel { margin-top: var(--stack-gap); }

.work__eyebrow {
    margin-bottom: var(--element-gap);
    font-size: var(--text-sm);
    line-height: 1;
}

.work__headline {
    max-width: 20ch;
    margin-bottom: var(--element-gap);
    font-size: var(--text-3xl);
    line-height: 0.88;
}

.work__body {
    max-width: min(48ch, 100%);
    margin-bottom: var(--stack-gap);
    line-height: 1.55;
    color: var(--muted);
}

@media (min-width: 1024px) {
    .work__layout {
        display: grid;
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        gap: clamp(3rem, 6vw, 6rem);
    }
    .work__media-col { display: block; align-self: start; }
    .work__panel-media { display: none; }
    .work__panel + .work__panel { margin-top: 0; }
    .work__panel-content { min-height: var(--sticky-h); }
}

/* ---------- Large CTA with layered glow ---------- */

.large-cta__panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    place-items: center;
    min-height: clamp(22rem, 52vw, 34rem);
    padding: clamp(3rem, 8vw, 5.5rem) clamp(1.5rem, 4vw, 3rem);
    border-radius: clamp(2rem, 4vw, 3.75rem);
    background: var(--surface-1);
}

.large-cta__glow {
    position: absolute;
    inset: -12%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.large-cta__layer {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
}

.large-cta__layer svg { display: block; width: 100%; aspect-ratio: 1; }

.large-cta__layer--cyan  { width: min(118%, 62rem); color: #59fcf9; filter: blur(clamp(2.5rem, 9vw, 5.5rem)); }
.large-cta__layer--green { width: min(96%, 50rem); color: #4cff35; filter: blur(clamp(2rem, 7vw, 4.25rem)); }
.large-cta__layer--lime  { width: min(74%, 38rem); color: #daff35; filter: blur(clamp(1.5rem, 5.5vw, 3.25rem)); }
.large-cta__layer--white { width: min(50%, 26rem); color: #ffffff; filter: blur(clamp(1rem, 4vw, 2.5rem)); }

.large-cta__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 2.25rem);
    text-align: center;
}

.large-cta__eyebrow { font-size: var(--text-sm); line-height: 1; }

.large-cta__headline {
    font-size: clamp(var(--text-2xl), 5.4vw, var(--text-5xl));
    line-height: 0.88;
}

.large-cta__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* ---------- Footer ---------- */

.site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: min(80vh, 46rem);
    padding-top: calc(var(--pad-x) + 1.5rem);
    overflow: hidden;
    background: var(--surface-2);
}

.site-footer__top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2rem;
}

.site-footer__label {
    margin-bottom: 0.5rem;
    font-size: var(--text-sm);
    color: var(--muted);
}

.site-footer__mail {
    font-size: clamp(var(--text-md), 3vw, var(--text-2xl));
    letter-spacing: -0.03em;
    transition: color 200ms ease-out;
}

.site-footer__mail:hover { color: var(--accent); }

.site-footer__links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.site-footer__links a { transition: opacity 60ms ease-out; }
.site-footer__links a:hover { opacity: 0.65; }

.site-footer__wordmark {
    font-size: 36vw;
    line-height: 0.72;
    letter-spacing: -0.07em;
    text-align: center;
    color: var(--ink);
    transform: translateY(0.02em);
}

.site-footer__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
    font-size: var(--text-sm);
    color: var(--muted);
}

.heart { width: 14px; height: 14px; color: var(--heart); vertical-align: -2px; margin: 0 2px; }

/* ---------- Section reveals (staggered) ---------- */

@keyframes reveal-in {
    from { opacity: 0; transform: translateY(1.25rem); }
    to   { opacity: 1; transform: translateY(0); }
}

.js [data-reveal] [data-reveal-item] { opacity: 0; transform: translateY(1.25rem); }

.js [data-reveal].is-revealing [data-reveal-item] {
    animation: reveal-in 520ms var(--ease-enter) both;
    animation-delay: calc(var(--reveal-i, 0) * 90ms);
}

.js [data-reveal].is-revealed [data-reveal-item] { opacity: 1; transform: none; }

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
    .hero__media { aspect-ratio: 4 / 5; max-height: 62vh; }
    .hero__headline-wrap { margin-top: -2.5rem; }
    .hero__panel { max-width: none; padding: 1.5rem 1rem 0; }
    .hero__headline { font-size: 11vw; }
    .hero__body { font-size: var(--text-base); }

    .carousel { --carousel-card: 64vw; margin-top: -8vw; }

    .work__headline { font-size: var(--text-2xl); }

    .site-footer { min-height: min(70vh, 34rem); }
    .site-footer__wordmark { font-size: 40vw; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .js [data-reveal] [data-reveal-item] { opacity: 1; transform: none; }
    .hero__role { display: none; }
    .hero__role:first-child { display: block; opacity: 1; transform: none; }
    .work__layout { opacity: 1; }
}
