/* =========================================================================
   AmazingDens — shared theme
   Tokens, reset, typography, layout primitives, reusable components.
   Page-specific styles live in per-page CSS files (e.g. home.css).
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Design tokens
   ------------------------------------------------------------------------- */
:root {
    /* Colour — base surfaces */
    --bg:            #272727;
    --bg-raised:     #303030;
    --bg-sunken:     #1c1c1c;

    /* Colour — ink */
    --ink:           #f9f9f9;
    --ink-muted:     #b7b7b7;
    --ink-subtle:    #909090;

    /* Colour — accents (earth-tone palette, terracotta leads) */
    --accent:        #973c20;
    --accent-soft:   #b54a28;
    --sage:          #4d5b48;
    --mud:           #5f584f;
    --saddle:        #6d533c;

    /* Colour — borders */
    --border:        rgba(249, 249, 249, 0.08);
    --border-strong: rgba(249, 249, 249, 0.18);

    /* Typography families */
    --font-display: "Fraunces", "Cardo", Georgia, "Times New Roman", serif;
    --font-body:    "Cardo", Georgia, "Times New Roman", serif;
    --font-ui:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                    Roboto, sans-serif;

    /* Type scale (fluid) */
    --fs--1: clamp(0.85rem, 0.80rem + 0.25vw, 1rem);
    --fs-0:  clamp(1rem,    0.95rem + 0.3vw,  1.15rem);
    --fs-1:  clamp(1.25rem, 1.1rem  + 0.8vw,  1.75rem);
    --fs-2:  clamp(1.75rem, 1.5rem  + 1.2vw,  2.5rem);
    --fs-3:  clamp(2.5rem,  2rem    + 2.5vw,  4rem);
    --fs-4:  clamp(3.5rem,  2.5rem  + 4vw,    6.5rem);

    /* Spacing scale */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 3rem;
    --sp-8: 4rem;
    --sp-9: 6rem;
    --sp-10: 8rem;
    --sp-11: 12rem;

    /* Layout */
    --container:      72rem;
    --container-wide: 86rem;
    --gutter:         clamp(1rem, 4vw, 2.5rem);
    --header-h:       5rem;

    /* Motion */
    --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast:    200ms;
    --dur-base:    400ms;
    --dur-slow:    800ms;

    /* Radii + shadows */
    --radius-sm: 6px;
    --radius:    12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow:    0 12px 40px rgba(0, 0, 0, 0.4);
}

/* -------------------------------------------------------------------------
   2. Reset (modern, minimal)
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    min-height: 100dvh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
}

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

ul,
ol {
    list-style: none;
    padding: 0;
}

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

/* Reduced-motion killswitch for CSS transitions/animations.
   main.js handles the GSAP side separately. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* -------------------------------------------------------------------------
   3. Base typography
   ------------------------------------------------------------------------- */
body {
    font-family: var(--font-body);
    font-size: var(--fs-0);
    color: var(--ink);
    background: var(--bg);
    font-optical-sizing: auto;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variation-settings: "opsz" 144, "SOFT" 50;
    color: var(--ink);
}

h1 { font-size: var(--fs-3); }
h2 { font-size: var(--fs-2); }
h3 { font-size: var(--fs-1); }
h4 { font-size: var(--fs-0); font-family: var(--font-ui); font-weight: 600; letter-spacing: 0; }

p {
    max-width: 62ch;
}

small,
.text-small {
    font-size: var(--fs--1);
    color: var(--ink-muted);
}

a.link {
    color: var(--ink);
    border-bottom: 1px solid var(--border-strong);
    transition: border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out);
}
a.link:hover {
    color: var(--accent-soft);
    border-color: var(--accent-soft);
}

/* -------------------------------------------------------------------------
   4. Layout primitives
   ------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.container-wide {
    width: 100%;
    max-width: var(--container-wide);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section {
    padding-block: var(--sp-10);
}

.section--tight {
    padding-block: var(--sp-8);
}

.stack > * + * {
    margin-top: var(--stack-gap, var(--sp-5));
}

.stack-lg > * + * {
    margin-top: var(--sp-7);
}

.grid {
    display: grid;
    gap: var(--grid-gap, var(--sp-6));
    grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
}

@media (min-width: 700px) {
    .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cluster-gap, var(--sp-4));
    align-items: center;
}

/* -------------------------------------------------------------------------
   5. Header / nav
   ------------------------------------------------------------------------- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding-inline: var(--gutter);
    background: rgba(39, 39, 39, 0);
    backdrop-filter: blur(0);
    transition: background var(--dur-base) var(--ease-out),
                backdrop-filter var(--dur-base) var(--ease-out),
                height var(--dur-base) var(--ease-out),
                border-color var(--dur-base) var(--ease-out);
    border-bottom: 1px solid transparent;
}

.site-header--scrolled {
    background: rgba(28, 28, 28, 0.72);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom-color: var(--border);
    height: 4rem;
}

.site-header__inner {
    width: 100%;
    max-width: var(--container-wide);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-5);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink);
    font-variation-settings: "opsz" 144;
}

.brand__mark {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-strong);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
}

.nav__list {
    display: none;
    gap: var(--sp-5);
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink-muted);
}

@media (min-width: 960px) {
    .nav__list { display: flex; }
}

.nav__link {
    position: relative;
    padding-block: var(--sp-2);
    transition: color var(--dur-fast) var(--ease-out);
}

.nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--accent-soft);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur-base) var(--ease-out);
}

.nav__link:hover {
    color: var(--ink);
}

.nav__link:hover::after {
    transform: scaleX(1);
}

.nav__cta {
    display: none;
}

@media (min-width: 960px) {
    .nav__cta { display: inline-flex; }
}

.nav__toggle {
    --sz: 2.75rem;
    width: var(--sz);
    height: var(--sz);
    display: grid;
    place-items: center;
    color: var(--ink);
    background: rgba(28, 28, 28, 0.55);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    transition: background var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}

.nav__toggle:hover {
    background: rgba(28, 28, 28, 0.75);
    border-color: rgba(249, 249, 249, 0.35);
}

@media (min-width: 960px) {
    .nav__toggle { display: none; }
}

.nav__toggle-bars {
    display: grid;
    gap: 4px;
}

.nav__toggle-bars span {
    display: block;
    width: 1.1rem;
    height: 1.5px;
    background: currentColor;
    transition: transform var(--dur-fast) var(--ease-out),
                opacity var(--dur-fast) var(--ease-out);
}

body.nav-open .nav__toggle-bars span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}
body.nav-open .nav__toggle-bars span:nth-child(2) {
    opacity: 0;
}
body.nav-open .nav__toggle-bars span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* -------------------------------------------------------------------------
   Mobile drawer — floating translucent card
   A pill-cornered card that floats below the header on the right side of
   the viewport, matching the scrolled-header blur treatment so the two
   chrome elements feel like one family. Hidden at ≥ 960px.
   ------------------------------------------------------------------------- */
.nav__drawer {
    position: fixed;
    top: calc(var(--header-h) - 0.25rem);
    right: var(--gutter);
    left: var(--gutter);
    max-width: 22rem;
    margin-left: auto;
    padding: var(--sp-5);
    background: rgba(22, 22, 22, 0.96);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55),
                0 2px 6px rgba(0, 0, 0, 0.35);
    font-family: var(--font-ui);

    /* Closed state. Use opacity + transform rather than display:none so
       the opening/closing transition animates. pointer-events:none stops
       the offscreen card capturing taps. */
    opacity: 0;
    transform: translateY(-0.75rem) scale(0.96);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity var(--dur-base) var(--ease-out),
                transform var(--dur-base) var(--ease-out);
}

body.nav-open .nav__drawer {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* At desktop width the drawer has no reason to exist — take it out of
   the layout entirely so no stale styles leak through. */
@media (min-width: 960px) {
    .nav__drawer { display: none; }
}

.nav__drawer ul {
    display: grid;
    gap: var(--sp-2);
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink);
}

.nav__drawer ul a {
    display: block;
    padding: 0.85rem 1.1rem;
    border-radius: 999px;
    color: var(--ink-muted);
    border: 1px solid transparent;
    transition: background var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}

.nav__drawer ul a:hover,
.nav__drawer ul a:focus-visible {
    color: var(--ink);
    background: rgba(249, 249, 249, 0.06);
    border-color: var(--border-strong);
}

.nav__drawer ul a.is-cta {
    margin-top: var(--sp-3);
    text-align: center;
    color: var(--ink);
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nav__drawer ul a.is-cta:hover,
.nav__drawer ul a.is-cta:focus-visible {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
}

/* -------------------------------------------------------------------------
   6. Buttons + eyebrow
   ------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.85rem 1.6rem;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: var(--accent);
    color: var(--ink);
}

.btn--primary:hover {
    background: var(--accent-soft);
}

.btn--ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--border-strong);
}

.btn--ghost:hover {
    border-color: var(--ink);
    background: rgba(249, 249, 249, 0.04);
}

.btn--lg {
    padding: 1.05rem 2rem;
    font-size: 1rem;
}

.eyebrow {
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent-soft);
}

/* -------------------------------------------------------------------------
   7. Card + surface components
   ------------------------------------------------------------------------- */
.card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--dur-base) var(--ease-out),
                border-color var(--dur-base) var(--ease-out);
}

.card:hover {
    border-color: var(--border-strong);
    transform: translateY(-4px);
}

.card__media {
    aspect-ratio: 4 / 5;
    overflow: hidden;
}

.card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--dur-slow) var(--ease-out);
}

.card:hover .card__media img {
    transform: scale(1.04);
}

.card__body {
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    flex: 1;
}

.card__title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    line-height: 1.2;
}

.card__lede {
    color: var(--ink-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.card__link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--accent-soft);
}

.card__link span {
    transition: transform var(--dur-base) var(--ease-out);
}

.card:hover .card__link span {
    transform: translateX(4px);
}

/* -------------------------------------------------------------------------
   8. Footer
   ------------------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-sunken);
    padding-block: var(--sp-9) var(--sp-6);
    margin-top: var(--sp-10);
}

.site-footer__grid {
    display: grid;
    gap: var(--sp-7);
    grid-template-columns: 1fr;
}

@media (min-width: 720px) {
    .site-footer__grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

.site-footer__brand .brand {
    font-size: 1.75rem;
}

.site-footer__brand p {
    margin-top: var(--sp-4);
    color: var(--ink-muted);
    font-size: 0.95rem;
    max-width: 32ch;
}

.site-footer__col h4 {
    font-family: var(--font-ui);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-subtle);
    margin-bottom: var(--sp-4);
}

.site-footer__col ul {
    display: grid;
    gap: var(--sp-3);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    color: var(--ink-muted);
}

.site-footer__col a {
    transition: color var(--dur-fast) var(--ease-out);
}

.site-footer__col a:hover {
    color: var(--ink);
}

.site-footer__legal {
    margin-top: var(--sp-8);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-4);
    justify-content: space-between;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--ink-subtle);
}

/* The build stamp (`<version> · <sha>`), printed so a deploy can be verified
   from the page itself — if it is not the sha you expect, it is a stale tab
   or an unlanded sync, not a failed build. */
.site-footer__build {
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

/* -------------------------------------------------------------------------
   9. Motion helpers

   Default state: elements are visible. If JS fails to load or GSAP is
   blocked, the page is still fully functional.

   `.js-ready` is toggled on <body> by main.js only after GSAP is
   confirmed available. Under that class .reveal elements start hidden,
   and main.js animates them back to visible with gsap.to(). The
   prefers-reduced-motion query overrides the hidden state as a safety
   net.
   ------------------------------------------------------------------------- */
.reveal,
.reveal-stagger > * {
    will-change: transform, opacity;
}

.js-ready .reveal {
    opacity: 0;
    transform: translateY(40px);
}

@media (prefers-reduced-motion: reduce) {
    .js-ready .reveal {
        opacity: 1;
        transform: none;
    }
}

/* -------------------------------------------------------------------------
   10. Utilities (used ≥3× only)
   ------------------------------------------------------------------------- */
.text-muted  { color: var(--ink-muted); }
.text-subtle { color: var(--ink-subtle); }
.text-accent { color: var(--accent-soft); }
.text-center { text-align: center; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-7 { margin-top: var(--sp-7); }

.hide-sm { display: none; }
@media (min-width: 720px) { .hide-sm { display: revert; } }

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