/* ============================================================
   cbdc.studio — Swiss pastoral atelier
   Jewel tones on cream · Glassmorphic cards · Border-animate
   Swiss International Typographic Style — clean alignments
   IntersectionObserver (threshold: 0.15 entrance rhythm)
   ============================================================ */

@property --jewel-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}
@property --jewel-hue {
    syntax: "<color>";
    initial-value: #7B4B94;
    inherits: false;
}

:root {
    /* Core palette */
    --cream: #F7F3EB;
    --sage: #E8EDE5;
    --walnut: #2C2418;
    --stone: #7A6E5D;

    /* Jewel accents */
    --amethyst: #7B4B94;
    --emerald: #2D6A4F;
    --sapphire: #2B4C7E;
    --ruby: #9B2335;
    --topaz: #C17817;

    /* Glass surfaces */
    --glass-bg: rgba(255, 252, 247, 0.72);
    --glass-border: rgba(193, 120, 23, 0.18);
    --glass-border-strong: rgba(193, 120, 23, 0.32);
    --glass-shadow: 0 8px 32px rgba(44, 36, 24, 0.06);

    /* Grid */
    --sidebar-w: 280px;
    --outer-margin: 48px;
    --col-gap: 24px;
    --section-gap: 120px;

    --ease-out-cubic: cubic-bezier(0.33, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: "Quicksand", system-ui, sans-serif;
    font-weight: 400;
    font-size: 1.0625rem;
    line-height: 1.9;
    letter-spacing: 0.01em;
    color: var(--walnut);
    background: var(--cream);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Linen texture via subtle repeating gradient + noise-feeling crosshatch */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(122,110,93,0.025) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(122,110,93,0.025) 0 1px, transparent 1px 3px);
    mix-blend-mode: multiply;
    opacity: 0.9;
}

/* Ambient jewel-tone field behind the sidebar glass */
.ambient-field {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.ambient-gradient {
    position: absolute;
    width: 640px; height: 640px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.22;
    animation: ambient-drift 48s linear infinite;
}
.ambient-gradient.g1 {
    top: -120px; left: -80px;
    background: radial-gradient(circle at 40% 40%, var(--amethyst), transparent 70%);
}
.ambient-gradient.g2 {
    top: 40vh; right: -180px;
    background: radial-gradient(circle at 50% 50%, var(--topaz), transparent 70%);
    animation-delay: -16s;
}
.ambient-gradient.g3 {
    bottom: -140px; left: 30vw;
    background: radial-gradient(circle at 50% 50%, var(--emerald), transparent 70%);
    animation-delay: -32s;
}
@keyframes ambient-drift {
    0%   { transform: translate3d(0,0,0) scale(1); }
    25%  { transform: translate3d(40px,-30px,0) scale(1.08); }
    50%  { transform: translate3d(-20px,40px,0) scale(0.96); }
    75%  { transform: translate3d(-50px,-10px,0) scale(1.05); }
    100% { transform: translate3d(0,0,0) scale(1); }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: rgba(232, 237, 229, 0.65);
    backdrop-filter: blur(20px) saturate(1.1);
    -webkit-backdrop-filter: blur(20px) saturate(1.1);
    border-right: 1px solid rgba(193, 120, 23, 0.15);
    z-index: 20;
    display: flex;
}
.sidebar-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 48px 36px 36px;
    position: relative;
}

.studio-name {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--walnut);
    position: absolute;
    left: 16px;
    top: 48px;
    height: calc(100vh - 96px);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.studio-mark { color: var(--walnut); }
.studio-dot { color: var(--topaz); font-size: 1.4rem; line-height: 0.9; }
.studio-suffix { color: var(--stone); font-weight: 600; }

.sidebar-nav {
    margin-top: auto;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
    padding-left: 36px;
}

.nav-item {
    position: relative;
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    grid-column-gap: 10px;
    align-items: baseline;
    text-decoration: none;
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    color: var(--walnut);
    padding-left: 18px;
    transition: color 320ms ease;
}
.nav-num {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--stone);
    letter-spacing: 0.02em;
    grid-row: 1;
    grid-column: 1 / span 2;
    line-height: 1;
}
.nav-label {
    font-size: 0.875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    grid-row: 2;
    grid-column: 1 / span 2;
    line-height: 1.2;
    padding-top: 4px;
}

.nav-indicator {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    border-radius: 2px;
    background: rgba(122, 110, 93, 0.22);
    opacity: 1;
    transition: background 400ms ease, height 400ms ease;
}

.nav-item:hover { color: var(--amethyst); }
.nav-item:hover .nav-indicator { background: var(--amethyst); }

.nav-item.active {
    color: var(--walnut);
}
.nav-item.active .nav-indicator {
    height: 36px;
    background: conic-gradient(
        from var(--jewel-angle),
        var(--amethyst), var(--emerald), var(--sapphire),
        var(--ruby), var(--topaz), var(--amethyst)
    );
    animation: jewel-rotate 12s linear infinite;
    box-shadow: 0 0 12px rgba(123, 75, 148, 0.35);
}

@keyframes jewel-rotate {
    to { --jewel-angle: 360deg; }
}

.sidebar-foot {
    margin-top: 24px;
    padding-left: 36px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.foot-rule {
    width: 40px; height: 1px;
    background: var(--stone);
    opacity: 0.35;
}
.foot-copy {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 300;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--stone);
    letter-spacing: 0.02em;
}

/* ============================================================
   STAGE / GRID
   ============================================================ */
.stage {
    margin-left: var(--sidebar-w);
    padding: var(--outer-margin);
    padding-bottom: 0;
    position: relative;
    z-index: 2;
}

.grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--col-gap);
    max-width: 1400px;
    margin: 0 auto;
}

.section {
    padding-top: var(--section-gap);
    padding-bottom: var(--section-gap);
    position: relative;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms var(--ease-out-cubic), transform 600ms var(--ease-out-cubic);
}
.section.in-view { opacity: 1; transform: translateY(0); }
.section:first-of-type { padding-top: 72px; }

/* ============================================================
   TYPOGRAPHY HELPERS
   ============================================================ */
.cormorant-italic,
.cormorant {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 300;
    letter-spacing: 0;
}

.section-num {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    color: var(--topaz);
    line-height: 1;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 600ms ease 0ms, transform 600ms ease 0ms;
}
.section.in-view .section-num {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0ms;
}

.section-slug {
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--stone);
}

/* ============================================================
   GLASS CARD (base)
   ============================================================ */
.glass-card {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 48px;
    box-shadow: var(--glass-shadow);
    transition: box-shadow 500ms ease, border-color 500ms ease, transform 500ms var(--ease-out-cubic);
    overflow: hidden;
}

/* Animated border via conic gradient mask — on hover */
.glass-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    padding: 1px;
    background: conic-gradient(
        from var(--jewel-angle),
        var(--amethyst), var(--emerald), var(--sapphire),
        var(--ruby), var(--topaz), var(--amethyst)
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 500ms ease;
    pointer-events: none;
    animation: jewel-rotate 12s linear infinite;
    z-index: 1;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(44, 36, 24, 0.09);
}
.glass-card:hover::after { opacity: 0.95; }

/* Corner ornaments */
.corner {
    position: absolute;
    width: 22px; height: 22px;
    border: 2px solid var(--topaz);
    opacity: 0;
    transition: opacity 400ms ease 80ms;
    pointer-events: none;
    z-index: 2;
}
.corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; border-top-left-radius: 4px; }
.corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; border-top-right-radius: 4px; }
.corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; border-bottom-left-radius: 4px; }
.corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; border-bottom-right-radius: 4px; }

.glass-card:hover .corner { opacity: 1; }

/* Each card can tint the corner ornament with its own jewel */
.project-card[data-jewel="amethyst"] .corner { border-color: var(--amethyst); }
.project-card[data-jewel="emerald"]  .corner { border-color: var(--emerald); }
.project-card[data-jewel="sapphire"] .corner { border-color: var(--sapphire); }
.project-card[data-jewel="ruby"]     .corner { border-color: var(--ruby); }
.project-card[data-jewel="topaz"]    .corner { border-color: var(--topaz); }

/* ============================================================
   01 · OPENING VIGNETTE
   ============================================================ */
.section-vignette { min-height: calc(100vh - var(--outer-margin) * 2); display: flex; align-items: center; }

.vignette-card {
    grid-column: 2 / span 5;
    padding: 72px 72px 64px;
    position: relative;
    overflow: hidden;
}

.vignette-meta {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 40px;
}

.hero-tagline {
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.04;
    color: var(--walnut);
    margin-bottom: 40px;
}
.hero-tagline .accent em {
    font-family: "Cormorant Garamond", serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1.1em;
    color: var(--topaz);
    letter-spacing: 0;
    margin: 0 0.05em;
}

/* Typewriter-style clip reveal per line */
.reveal-mask {
    display: block;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1200ms var(--ease-out-cubic);
    transition-delay: var(--mask-delay, 0ms);
}
.section-vignette.in-view .reveal-mask {
    clip-path: inset(0 0 0 0);
}

.hero-subtitle {
    max-width: 640px;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--stone);
    margin-bottom: 48px;
}

/* Ornament divider */
.ornament-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 40px;
}
.ornament-divider .rule {
    flex: 1;
    height: 1px;
    background: var(--stone);
    opacity: 0.35;
}
.ornament-divider .diamond {
    width: 10px; height: 10px;
    background: var(--topaz);
    transform: rotate(45deg);
    box-shadow: 0 0 10px rgba(193, 120, 23, 0.35);
}

.vignette-botanical {
    max-width: 360px;
    margin: 8px auto 0;
    opacity: 0.38;
}
.vignette-botanical svg { width: 100%; height: auto; display: block; }

/* Watermark botanical behind card */
.vignette-card[data-ornament]::before {
    content: "";
    position: absolute;
    right: -80px; bottom: -80px;
    width: 380px; height: 380px;
    background-image: radial-gradient(circle, rgba(44,36,24,0.05), transparent 60%);
    pointer-events: none;
}

/* ============================================================
   02 · PORTFOLIO GARDEN
   ============================================================ */
.section-header {
    margin-bottom: 56px;
    align-items: end;
}
.section-header .header-left {
    grid-column: 1 / span 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.section-header .header-right {
    grid-column: 3 / span 4;
}
.section-title {
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--walnut);
}

.garden-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.project-card {
    padding: 36px 32px 36px;
    display: flex;
    flex-direction: column;
    min-height: 340px;
    position: relative;
}
.project-number {
    font-size: 1.2rem;
    color: var(--topaz);
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}
.project-botanical {
    width: 120px; height: 120px;
    margin: 6px 0 22px;
    opacity: 0.3;
}
.project-botanical svg { width: 100%; height: 100%; display: block; }
.project-title {
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 1.45rem;
    line-height: 1.15;
    letter-spacing: -0.015em;
    color: var(--walnut);
    margin-bottom: 6px;
}
.project-kind {
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 16px;
}
.project-note {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--walnut);
    opacity: 0.88;
    margin-top: auto;
}

.project-card[data-jewel="amethyst"]:hover .project-number { color: var(--amethyst); }
.project-card[data-jewel="emerald"]:hover  .project-number { color: var(--emerald); }
.project-card[data-jewel="sapphire"]:hover .project-number { color: var(--sapphire); }
.project-card[data-jewel="ruby"]:hover     .project-number { color: var(--ruby); }
.project-card[data-jewel="topaz"]:hover    .project-number { color: var(--topaz); }

/* ============================================================
   03 · PHILOSOPHY PASSAGE
   ============================================================ */
.section-philosophy { min-height: 100vh; display: flex; align-items: center; }

.philosophy-inner {
    grid-column: 2 / span 4;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.philosophy-meta {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
}
.philosophy-lead {
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: clamp(1.6rem, 2.8vw, 2.3rem);
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--walnut);
}
.philosophy-body {
    font-size: 1.0625rem;
    line-height: 1.9;
    color: var(--walnut);
    opacity: 0.92;
}

.pullquote {
    position: relative;
    padding: 22px 28px 22px 52px;
    margin: 12px 0 12px -8px;
    border-left: 1px solid var(--glass-border-strong);
    background: rgba(255, 252, 247, 0.45);
    border-radius: 8px;
}
.pullquote .quotemark {
    position: absolute;
    left: 12px;
    top: -8px;
    font-size: 3.4rem;
    color: var(--amethyst);
    line-height: 1;
}
.pullquote p {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    line-height: 1.5;
    color: var(--walnut);
}

.philosophy-signoff {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}
.signoff-line { flex: 1; height: 1px; background: var(--stone); opacity: 0.3; }
.signoff-word { font-size: 1rem; color: var(--stone); white-space: nowrap; }

/* ============================================================
   04 · CONTACT ALCOVE
   ============================================================ */
.alcove-card {
    grid-column: 2 / span 5;
    padding: 64px 72px;
}

.alcove-head {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 24px;
}
.alcove-title {
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--walnut);
    margin-bottom: 16px;
}
.alcove-copy {
    color: var(--stone);
    max-width: 520px;
    margin-bottom: 40px;
}

.alcove-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 24px;
    margin-bottom: 44px;
}
.field { position: relative; display: flex; flex-direction: column; }
.field-full { grid-column: 1 / span 2; }

.field label {
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--stone);
    margin-bottom: 10px;
}
.field input,
.field textarea {
    font-family: "Quicksand", sans-serif;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--walnut);
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(122, 110, 93, 0.3);
    padding: 6px 0 10px;
    letter-spacing: 0.01em;
    resize: none;
}
.field input::placeholder,
.field textarea::placeholder {
    color: rgba(122, 110, 93, 0.55);
    font-style: italic;
    font-family: "Cormorant Garamond", serif;
    font-weight: 300;
    font-size: 1.05rem;
}
.field-rule {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: conic-gradient(
        from var(--jewel-angle),
        var(--amethyst), var(--emerald), var(--sapphire),
        var(--ruby), var(--topaz), var(--amethyst)
    );
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 500ms var(--ease-out-cubic);
    animation: jewel-rotate 12s linear infinite;
}
.field input:focus,
.field textarea:focus { outline: none; }
.field input:focus ~ .field-rule,
.field textarea:focus ~ .field-rule { transform: scaleX(1); }

.form-foot {
    grid-column: 1 / span 2;
    display: flex;
    align-items: center;
    gap: 24px;
}

.post-btn {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 16px 28px;
    background: transparent;
    border: 1px solid var(--glass-border-strong);
    border-radius: 999px;
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--walnut);
    cursor: pointer;
    transition: border-color 400ms ease, color 400ms ease, background 400ms ease, transform 400ms var(--ease-out-cubic);
    position: relative;
    overflow: hidden;
}
.post-btn .post-arrow svg { width: 22px; height: 12px; transition: transform 400ms var(--ease-out-cubic); }
.post-btn:hover {
    background: rgba(193, 120, 23, 0.1);
    border-color: var(--topaz);
    color: var(--topaz);
    transform: translateY(-1px);
}
.post-btn:hover .post-arrow svg { transform: translateX(4px); }

.form-status {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--emerald);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 400ms ease, transform 400ms ease;
}
.form-status.visible { opacity: 1; transform: translateY(0); }

.alcove-foot {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding-top: 32px;
    border-top: 1px solid rgba(122, 110, 93, 0.18);
}
.foot-col { display: flex; flex-direction: column; gap: 10px; }
.foot-label {
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--topaz);
}
.foot-value { font-size: 0.95rem; line-height: 1.6; color: var(--walnut); }

/* ============================================================
   PAGE FOOT
   ============================================================ */
.page-foot {
    padding: 60px 0 48px;
    position: relative;
}
.foot-inner {
    grid-column: 1 / span 6;
    display: flex;
    align-items: center;
    gap: 24px;
}
.foot-mark {
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--walnut);
}
.foot-rule-h { flex: 1; height: 1px; background: var(--stone); opacity: 0.3; }
.foot-coord { font-size: 1.05rem; color: var(--stone); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
    :root { --sidebar-w: 220px; --outer-margin: 28px; --section-gap: 80px; }
    .vignette-card, .alcove-card { grid-column: 1 / span 6; padding: 44px 32px; }
    .garden-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .philosophy-inner { grid-column: 1 / span 6; }
    .section-header .header-left,
    .section-header .header-right { grid-column: 1 / span 6; }
}
@media (max-width: 680px) {
    :root { --sidebar-w: 64px; }
    .sidebar-inner { padding: 24px 10px; }
    .studio-name { left: 8px; font-size: 0.78rem; }
    .sidebar-nav { padding-left: 0; align-items: center; gap: 32px; }
    .nav-label { display: none; }
    .nav-num { font-size: 0.9rem; }
    .sidebar-foot, .foot-copy { display: none; }
    .sidebar-foot .foot-rule { display: none; }
    .garden-grid { grid-template-columns: 1fr; }
    .alcove-form { grid-template-columns: 1fr; }
    .field-full, .form-foot { grid-column: 1; }
    .alcove-foot { grid-template-columns: 1fr; }
    .vignette-card, .alcove-card { padding: 32px 22px; }
}
