/* Palette (All assets/Colour Palette.jpg): black #000000, crimson red #E61E32,
   pure white #FFFFFF, steel grey #B3B3B3. Crimson is the accent in both modes (it
   reads at 4.6:1 on black and on white). Steel grey is too light for text on white
   (2.1:1), so day mode uses a darker steel #6B6B6B for muted text. */

/* Type pairing (balanced after sheethaljacob.com): Montserrat carries ~95% of the
   site — headings, body, labels, numbers. DM Serif Text italic is a rare accent for
   a handful of short, voice-y lines: the About subtitle, the contact CTA and
   case-study pull quotes. */
:root {
    --font-serif: 'DM Serif Text', Georgia, serif;
    --font-sans: 'Montserrat', system-ui, sans-serif;
    /* Side margins: 10% (or 5% on case studies) of the width, until the desktop
       scale cap below is reached; past that the content stops widening and centres. */
    --gutter: max(10%, calc((100% - 85.35rem) / 2));
    --gutter-wide: max(5%, calc((100% - 96.02rem) / 2));
}

/* Desktop scaling: every size is in rem, so tying the root font size to the viewport
   makes each page a scaled copy of the 1707px-wide reference screen (1rem = 16px there).
   Capped at 20px (a 2134px-wide window); wider screens keep that size and centre. */
@media (min-width: 1025px) {
    html {
        font-size: min(calc(100vw / 106.6875), 20px);
    }
}

/* Night */
:root {
    --bg-color: #000000;
    --text-main: #FFFFFF;
    --text-muted: #B3B3B3;
    --accent: #FFFFFF;
    --on-accent: #FFFFFF;
    --border-color: rgba(179, 179, 179, 0.35);
    --highlight-color: #EE6270; /* softer tint of crimson #E61E32 (30% toward white) for dark mode */
    --bg-secondary: #1F1F1F;
    --title-color: #FFFFFF;
    --text-desc: rgba(255, 255, 255, 0.8);
    --mouse-border: #B3B3B3;
    --showcase-desc: rgba(255, 255, 255, 0.85);
    --metric-text: #B3B3B3;
    --contact-btn-border: #B3B3B3;
    --ticker-bg: rgba(238, 98, 112, 0.14);
    --pill-bg: rgba(238, 98, 112, 0.10);
    --metric-label: #BDBDBD;
    --metric-bg: #111111;
    --overlay-dark: rgba(0, 0, 0, 0.12);
}

/* Day */
[data-theme="light"] {
    --bg-color: #FFFFFF;
    --text-main: #000000;
    --text-muted: #6B6B6B;
    --accent: #000000;
    --on-accent: #FFFFFF;
    --border-color: #B3B3B3;
    --highlight-color: #E61E32;
    --bg-secondary: #ECECEC;
    --title-color: #000000;
    --text-desc: rgba(0, 0, 0, 0.72);
    --mouse-border: #B3B3B3;
    --showcase-desc: rgba(0, 0, 0, 0.95);
    --metric-text: #181818;
    --contact-btn-border: #B3B3B3;
    --ticker-bg: rgba(230, 30, 50, 0.12);
    --pill-bg: rgba(230, 30, 50, 0.08);
    --metric-label: #3D3D3D;
    --metric-bg: #F6F6F6;
    --overlay-dark: rgba(0, 0, 0, 0.04);
}

/* Signature intro */
.sig-intro {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

/* Intro already played this visit: hide the overlay before it can paint */
html.sig-intro-seen .sig-intro {
    display: none;
}

.sig-intro.sig-intro--done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sig-svg {
    width: min(72vw, 36rem);
    height: auto;
    overflow: visible;
}

.sig-svg path.letter {
    fill: none;
    stroke: var(--text-main);
    stroke-width: 7px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* "Dhuti" strokes thicker than the rest of "Hey, I am" in the opening intro */
.sig-intro .letter[data-nav-keep="1"] {
    stroke-width: 11px;
}

body.sig-lock {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .sig-svg path {
        transition: none;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.04"/%3E%3C/svg%3E');
    z-index: 9999;
}

h1,
h2,
h3 {
    font-family: var(--font-sans);
    font-weight: 500;
    letter-spacing: -0.015em;
}

.highlight {
    font-weight: 600;
    color: var(--highlight-color);
}

/* Let the `hidden` attribute win over display rules like .showcase-item { display: flex } */
[hidden] {
    display: none !important;
}

::selection {
    background: var(--highlight-color);
    color: var(--on-accent);
}

:focus-visible {
    outline: 0.125rem solid var(--highlight-color);
    outline-offset: 0.1875rem;
}

html {
    scrollbar-color: #B3B3B3 transparent;
}

a {
    color: var(--text-main);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

a:hover {
    color: var(--highlight-color);
}



/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 0.7rem var(--gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: 500;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    height: 2.25rem;
}

/* Resting size once the signature relocates from the intro into the navbar */
.sig-svg--nav {
    width: auto;
    height: 2.25rem;
    overflow: visible;
    display: block;
}

/* Nav logo strokes 0.25x thicker than the intro (7px * 1.25) so the reduced-size mark stays legible */
.sig-svg--nav path.letter {
    stroke-width: 15px;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 2.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Handwritten nav words (Work / About / Resume) drawn as strokes that follow the theme color */
.nav-word-link {
    display: flex;
    align-items: center;
}

.nav-word {
    height: 1.25rem;
    width: auto;
    overflow: visible;
    display: block;
}

/* Each word's artwork has a different viewBox height, so a stroke-width in SVG units
   renders at a different thickness per word once scaled to 20px. Non-scaling strokes
   keep every word the same on-screen thickness. */
.nav-word path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3px;
    vector-effect: non-scaling-stroke;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

/* Overrides the icon's width/height="20" attributes so it scales with the page */
.theme-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--highlight-color);
    transform: rotate(15deg);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8rem var(--gutter) 0;
    /* padding top for navbar */
    position: relative;
}

#webgl-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hero-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    z-index: 2;
    opacity: 0;
    transform: translateY(1.875rem);
    animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.3s;
    animation-play-state: paused;
}

body.intro-done .hero-content {
    animation-play-state: running;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tagline {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 2rem;
    display: inline-block;
    border-bottom: 0.125rem solid var(--highlight-color);
    padding-bottom: 0.5rem;
}

.description {
    font-size: 1.15rem;
    color: var(--text-desc);
    max-width: 46.875rem;
    font-weight: 300;
    margin: 0 auto;
}

.hero-statement {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    line-height: 1.35;
    font-weight: 400;
    color: var(--title-color);
    max-width: 90rem;
    margin: 0;
}

.hero-statement-lead {
    display: inline-block;
    font-size: clamp(2.75rem, 5.5vw, 4.5rem);
    line-height: 1.2;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

/* Skill pills under the hero statement — reuse .showcase-tag pill styling. */
.hero-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--highlight-color);
}

.hero-statement .ticker {
    display: inline-flex;
    align-items: center;
    gap: 0.24em;
    background: var(--ticker-bg);
    border-radius: 999px;
    padding: 0.14em 0.55em 0.14em 0.45em;
    vertical-align: middle;
}

.hero-statement .ticker-dot {
    width: 0.32em;
    height: 0.32em;
    border-radius: 50%;
    background: var(--highlight-color);
    flex-shrink: 0;
}

.hero-statement .ticker-word {
    font-weight: 500;
    white-space: nowrap;
}

/* Zero-width space keeps a line box in the word even when it's fully deleted,
   so the pill's height (and the surrounding line spacing) never collapses. */
.hero-statement .ticker-word::after {
    content: "\200B";
}

.hero-statement .ticker-cursor {
    width: 0.05em;
    min-width: 0.125rem;
    height: 0.8em;
    border-radius: 1px;
    background: var(--highlight-color);
    flex-shrink: 0;
    animation: tickerCursorBlink 0.9s steps(1, jump-none) infinite;
}

@keyframes tickerCursorBlink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeUp 1s ease forwards 1.2s;
    animation-play-state: paused;
}

body.intro-done .scroll-indicator {
    animation-play-state: running;
}

.mouse {
    width: 1.625rem;
    height: 2.5rem;
    border: 1px solid var(--mouse-border);
    border-radius: 0.8125rem;
    position: relative;
}

.mouse::before {
    content: '';
    position: absolute;
    width: 0.25rem;
    height: 0.25rem;
    background: var(--highlight-color);
    border-radius: 50%;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 2s cubic-bezier(0.15, 0.41, 0.69, 0.94) infinite;
}

@keyframes scroll {
    0% {
        transform: translate(-50%, 0);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, 0.9375rem);
        opacity: 0;
    }
}

/* Showcases */
.showcases {
    padding: 12rem var(--gutter);
}

.showcase-list {
    max-width: 87.5rem;
}

.section-header {
    margin-bottom: 8rem;
}

.section-header h2 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-family: var(--font-sans);
    font-weight: 300;
}

.showcase-item {
    display: flex;
    gap: 3rem;
    /* top-align so the tags line up with the top edge of the image */
    align-items: flex-start;
    margin-bottom: 8rem;
    padding: 4rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    opacity: 0;
    transform: translateY(3.75rem);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.showcase-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Whole card is clickable: the title link stretches over the card */
.showcase-item {
    position: relative;
    cursor: pointer;
}

/* "View case study" pill that follows the pointer on card hover (Figma: Portfolio website / Cursor 150:44).
   Only on devices with a real mouse; touch keeps normal tap behavior. */
.view-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4688rem 0.4375rem;
    border-radius: 0.6562rem;
    background-color: var(--text-main);
    pointer-events: none;
    opacity: 0;
    transform: translate(0.875rem, 1.125rem) scale(0.6);
    transform-origin: top left;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-cursor.is-active {
    opacity: 1;
    transform: translate(0.875rem, 1.125rem) scale(1);
}

[data-theme="light"] .view-cursor {
    box-shadow: 0 0 0 1px var(--border-color), 0 0.25rem 1rem rgba(0, 0, 0, 0.08);
}

.view-cursor-label {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 0.625rem;
    line-height: normal;
    color: var(--bg-color);
    white-space: nowrap;
}

@media (hover: none),
(pointer: coarse) {
    .view-cursor {
        display: none;
    }
}

.showcase-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.showcase-link:hover {
    opacity: 1;
    color: var(--text-main);
}

.showcase-item.reverse {
    flex-direction: row-reverse;
}

.showcase-visuals {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.showcase-image-container {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 0.125rem;
    border: 1px solid var(--border-color);
    aspect-ratio: 16/9;
}

.showcase-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

/* Each Problem / Solution / Impact sits in a faint grey box. */
.metric {
    padding: 1.25rem;
    background-color: var(--metric-bg);
    border-radius: 0.75rem;
}

.metric h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--metric-label);
    margin-bottom: 0.6rem;
}

.metric p {
    font-size: 0.95rem;
    color: var(--metric-text);
    line-height: 1.6;
    font-weight: 300;
}

.showcase-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.showcase-img.pad-fit {
    object-fit: contain;
    padding: 3rem;
    background-color: var(--bg-color);
}

.showcase-item:hover .showcase-img {
    transform: scale(1.05);
}

.showcase-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-dark);
    transition: background 0.8s ease;
    pointer-events: none;
}

.showcase-item:hover .showcase-image-container::after {
    background: transparent;
}

/* Text column stretches to the card height; the sticky note (with its lead-in line, if any)
   is pushed to the bottom so it lines up with the bottom edge of the visuals. */
.showcase-info {
    flex: 1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.showcase-meta {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--highlight-color);
    margin-bottom: 0.5rem;
    display: inline-block;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* Keyword pills (home page) — lighter tint than the hero ticker pill. */
.showcase-meta.showcase-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0;
    border-bottom: none;
    margin-bottom: 1rem;
}

.showcase-tag {
    background: var(--pill-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.525em 0.9em;
    line-height: 1.2;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.showcase-title {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.showcase-desc {
    color: var(--showcase-desc);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    font-weight: 400;
}

/* Lead-in line directly above a How-might-we box: tighter gap so they read as one unit,
   and it moves to the bottom of the column together with the note. */
.showcase-desc--lead {
    margin-top: auto;
    margin-bottom: 1rem;
}

.showcase-desc--lead + .showcase-hmw {
    margin-top: 0;
}

/* How-might-we statement on a showcase card — a sticky note, slightly tilted,
   with a strip of tape. Paper stays yellow in both themes, like a real note. */
.showcase-hmw {
    position: relative;
    max-width: 22rem;
    margin: auto 0 0 0.25rem;
    padding: 1.25rem;
    background: linear-gradient(180deg, #FFF6B8 0%, #FFEE94 100%);
    border-radius: 0.125rem 0.125rem 0.125rem 1.125rem / 0.125rem 0.125rem 0.125rem 0.625rem;
    box-shadow: 0 1px 0.125rem rgba(0, 0, 0, 0.08), 0.1875rem 0.5rem 0.875rem -6px rgba(0, 0, 0, 0.25);
    color: #E61E32;
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.5;
    transform: rotate(-1.5deg);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tape strip */
.showcase-hmw::before {
    content: '';
    position: absolute;
    top: -0.6rem;
    left: 50%;
    width: 5.5rem;
    height: 1.4rem;
    background: rgba(225, 225, 220, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 0.125rem rgba(0, 0, 0, 0.06);
    transform: translateX(-50%) rotate(2deg);
}

.showcase-item:hover .showcase-hmw {
    transform: rotate(0deg);
}

/* Green sticky note variant (Camino card) — a pastel take on the sage green in the Camino artwork. */
.showcase-hmw--green {
    background: linear-gradient(180deg, #E4EFD3 0%, #D3E5BC 100%);
    transform: rotate(1.5deg);
}

/* Blue sticky note variant (Navigation Guide card) — a pastel take on the guide's "Initial Doctor Visits" blue. */
.showcase-hmw--blue {
    background: linear-gradient(180deg, #E4EFFC 0%, #D2E4F9 100%);
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.view-btn .arrow {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-btn:hover .arrow {
    transform: translateX(0.5rem);
    color: var(--highlight-color);
}

/* About Section */
.about {
    padding: 12rem var(--gutter);
    background-color: var(--bg-secondary);
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.about-content {
    max-width: 75rem;
    display: flex;
    align-items: center;
    gap: 4rem;
    text-align: left;
    margin: 0;
}

.about-img-container {
    flex: 1;
    max-width: 23.75rem;
    border-radius: 0.75rem;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0.75rem 1.875rem var(--overlay-dark);
    border: 1px solid var(--border-color);
    aspect-ratio: 2 / 3;
}

.about-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.about-text {
    flex: 2;
    max-width: 43.75rem;
}

.about-content h2 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.about-subtitle {
    font-size: 1.4rem;
    color: var(--highlight-color);
    margin-bottom: 2.5rem;
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0;
}

.about-content p {
    font-size: 1.0rem;
    color: var(--text-desc);
    line-height: 1.5;
    font-weight: 400;
    text-wrap: pretty;
    margin-bottom: 1.25rem;
}

/* Footer */
.footer {
    padding: 4rem var(--gutter);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.footer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    margin-bottom: 0;
}

.footer h2 {
    font-size: clamp(3rem, 6vw, 5rem);
    margin-bottom: 4rem;
}

.contact-btn {
    display: inline-block;
    padding: 1.2rem 4rem;
    border: 1px solid var(--contact-btn-border);
    border-radius: 6.25rem;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.35rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-btn:hover {
    background: var(--highlight-color);
    color: var(--on-accent);
    border-color: var(--highlight-color);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.socials {
    display: flex;
    gap: 3rem;
    text-transform: uppercase;
}

/* Chatbot Widget */
.chatbot-container {
    position: fixed;
    bottom: 1.875rem;
    right: 1.875rem;
    z-index: 1000;
    font-family: var(--font-sans);
}

.chatbot-fab {
    width: 3.75rem;
    height: 3.75rem;
    border-radius: 50%;
    background-color: var(--highlight-color);
    color: var(--on-accent);
    border: none;
    cursor: pointer;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s ease;
}

.chatbot-fab:hover {
    transform: scale(1.1);
}

.chat-icon {
    width: 1.75rem;
    height: 1.75rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-icon.hidden {
    opacity: 0;
    position: absolute;
    transform: rotate(90deg) scale(0);
}

.chatbot-window {
    position: absolute;
    bottom: 5rem;
    right: 0;
    width: 21.875rem;
    height: 28.75rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem var(--overlay-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.chatbot-window.hidden {
    opacity: 0;
    transform: scale(0.8) translateY(1.25rem);
    pointer-events: none;
}

.chatbot-header {
    background-color: var(--bg-secondary);
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.chatbot-bot-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.chatbot-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background-color: var(--highlight-color);
    color: var(--on-accent);
    display: flex;
    justify-content: center;
    align-items: center;
}

.chatbot-avatar svg {
    width: 1.375rem;
    height: 1.375rem;
}

.chatbot-bot-info h4 {
    font-size: 0.95rem;
    color: var(--title-color);
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 500;
}

.chatbot-bot-info .status {
    font-size: 0.75rem;
    color: #10B981;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.125rem;
}

.chatbot-bot-info .status::before {
    content: '';
    display: inline-block;
    width: 0.375rem;
    height: 0.375rem;
    background-color: #10B981;
    border-radius: 50%;
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
    display: flex;
}

.chatbot-close:hover {
    color: var(--text-main);
}

.chatbot-messages {
    flex: 1;
    padding: 1.2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--bg-color);
}

.message {
    display: flex;
    max-width: 85%;
    animation: fadeUpMsg 0.3s ease forwards;
}

@keyframes fadeUpMsg {
    from {
        opacity: 0;
        transform: translateY(0.625rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-content {
    padding: 0.8rem 1.1rem;
    border-radius: 0.875rem;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot .message-content {
    background-color: var(--bg-secondary);
    color: var(--text-main);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.message.user .message-content {
    background-color: var(--highlight-color);
    color: var(--on-accent);
    border-bottom-right-radius: 0.25rem;
}

.chatbot-input-area {
    padding: 1rem;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.6rem;
}

.chatbot-input-area input {
    flex: 1;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input-area input:focus {
    border-color: var(--highlight-color);
}

.chatbot-input-area input::placeholder {
    color: var(--text-muted);
}

.chatbot-input-area button {
    background-color: var(--highlight-color);
    color: var(--on-accent);
    border: none;
    border-radius: 50%;
    width: 2.375rem;
    height: 2.375rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.chatbot-input-area button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.8rem 1.1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.875rem;
    border-bottom-left-radius: 0.25rem;
    align-self: flex-start;
    border: 1px solid var(--border-color);
    margin-bottom: 0.3125rem;
    display: none;
}

.typing-indicator.active {
    display: flex;
}

.typing-dot {
    width: 0.375rem;
    height: 0.375rem;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .showcase-item {
        flex-direction: column !important;
        gap: 3rem;
        padding: 2rem;
        margin-bottom: 6rem;
    }

    .showcase-visuals {
        display: contents;
    }

    .showcase-image-container {
        width: 100%;
        order: 1;
    }

    .showcase-info {
        width: 100%;
        order: 2;
    }

    .showcase-metrics {
        width: 100%;
        order: 3;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer h2 {
        font-size: 3.5rem;
    }

    .about-content {
        flex-direction: column;
        text-align: center;
        gap: 3rem;
    }

    .about-img-container {
        max-width: 17.5rem;
    }
}

@media (max-width: 600px) {
    .nav-links {
        display: none;
    }

    .chatbot-window {
        width: calc(100vw - 2.5rem);
        height: 65vh;
        right: -15px;
        bottom: 4.375rem;
    }
}

/* Case study pages */
.case-study {
    max-width: 68.75rem;
    margin: 0 auto;
    padding: 10rem var(--gutter-wide) 8rem;
}

.case-back {
    display: inline-block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
    margin-bottom: 3rem;
}

.case-hero .showcase-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
}

.case-cover {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    margin: 2rem 0 6rem;
    display: block;
}

.case-section {
    margin-bottom: 5rem;
}

.case-section h2 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
}

.case-section p {
    color: var(--showcase-desc);
    line-height: 1.8;
    font-weight: 300;
    max-width: 70ch;
}

@media (max-width: 768px) {
    .case-study {
        padding: 7rem 1rem 5rem;
    }

    .case-hero .showcase-title {
        font-size: 2.4rem;
    }
}

/* Case study wireframe (shared by all case study pages) */
.cs {
    max-width: 90rem;
    margin: 0 auto;
    padding: 6rem var(--gutter-wide) 6rem;
}

.cs h2 {
    font-size: 2.2rem;
    line-height: 1.2;
    margin-bottom: 1.25rem;
}

.cs h3 {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.cs p {
    color: var(--showcase-desc);
    line-height: 1.8;
    font-weight: 300;
}

.cs-body>.cs-section>p,
.cs-subtitle {
    max-width: 68ch;
    margin-bottom: 1.25rem;
}

/* Hero */
.cs-hero {
    margin-bottom: 1.25rem;
}

.cs-hero .cs-subtitle {
    margin-bottom: 0;
}

/* Cover image sits right under the hero */
.cs-hero + .cs-img {
    margin-top: 0;
    margin-bottom: 5rem;
}

.cs-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Same pill look as the home page .showcase-tag */
.cs-tags li {
    background: var(--pill-bg);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.525em 0.9em;
    font-size: 0.8rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.cs-title {
    /* Sized so the title stays on one line at desktop widths */
    font-size: clamp(1.3rem, calc(2.9vw - 0.5rem), 2.15rem);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 0.75rem;
}

.cs-subtitle {
    font-size: 1.15rem;
}

.cs-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.cs-details dt,
.cs-eyebrow,
.cs-toc-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

/* Inside a section (e.g. Summary) the details sit right under the label, no divider */
.cs-section .cs-details {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.cs-details dd {
    font-weight: 400;
}

.cs-partner-logo {
    display: block;
    width: 100%;
    max-width: 15rem;
    height: auto;
}

/* Logo text is dark on transparent, so give it a light backing in night mode */
:root:not([data-theme="light"]) .cs-partner-logo {
    background: #FFFFFF;
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
}

/* Image placeholders */
.cs-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 2rem 0 0.5rem;
    border: 1px dashed var(--mouse-border);
    border-radius: 0.75rem;
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-align: center;
}

.cs-ph--wide {
    aspect-ratio: 21 / 9;
}

.cs-ph--square {
    aspect-ratio: 4 / 3;
    margin: 0;
}

.cs-img {
    display: block;
    width: 100%;
    height: auto;
    margin: 2rem 0 0.5rem;
    border-radius: 0.75rem;
}

.cs .cs-caption {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Body with sticky table of contents */
.cs-layout {
    display: grid;
    grid-template-columns: 11.25rem 1fr;
    gap: 4rem;
}

.cs-toc {
    position: sticky;
    top: 6rem;
    align-self: start;
}

.cs-toc ol {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cs-toc a {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.cs-toc a:hover,
.cs-toc a:focus-visible {
    color: var(--highlight-color);
    opacity: 1;
}

.cs-body {
    min-width: 0;
}

.cs-section {
    padding-bottom: 6rem;
    margin-bottom: 6rem;
    scroll-margin-top: 6rem;
}

.cs-section:last-child {
    margin-bottom: 0;
}

.cs-eyebrow {
    margin-bottom: 1rem;
}

/* Section names (Summary, Problem…) in a softened tint of the highlight red */
.cs-section > .cs-eyebrow {
    font-size: 0.85rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--highlight-color) 75%, var(--bg-color));
}

/* Grids & cards */
.cs-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.cs-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.cs-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.cs-card {
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.cs-stats {
    margin-top: 1.5rem;
}

.cs-stat {
    padding: 1.75rem;
    border-radius: 0.75rem;
    background-color: var(--bg-secondary);
}

.cs-stat-num {
    display: block;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 3rem;
    line-height: 1;
    color: var(--highlight-color);
    margin-bottom: 0.75rem;
}

.cs-callout {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 2rem 0;
    padding: 2rem;
    border-left: 0.1875rem solid var(--highlight-color);
    background-color: var(--bg-secondary);
    border-radius: 0 0.75rem 0.75rem 0;
}

.cs-callout .cs-stat-num {
    margin-bottom: 0;
}

.cs .cs-statement {
    font-size: 2rem;
    font-style: italic;
    max-width: 30ch;
}

.cs-list {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    color: var(--showcase-desc);
    font-weight: 300;
    line-height: 1.7;
}

/* Collaborator names: plain lines, no bullets */
#collaborators .cs-list {
    list-style: none;
    padding-left: 0;
}

#collaborators .cs-subhead {
    margin-top: 0;
}

.cs-subhead {
    margin-top: 3rem;
}

/* Research process */
.cs-process {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin: 2rem 0;
    counter-reset: step;
}

.cs-process li {
    counter-increment: step;
    padding-top: 1rem;
    border-top: 0.125rem solid var(--border-color);
}

.cs-process li::before {
    content: counter(step, decimal-leading-zero);
    display: block;
    font-size: 0.75rem;
    color: var(--highlight-color);
    margin-bottom: 0.5rem;
}

.cs-process p {
    font-size: 0.85rem;
}

.cs-process--4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Insights */
.cs-insights {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-top: 2rem;
}

.cs-insight {
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 1rem;
}

.cs-insight-num {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 2rem;
    color: var(--highlight-color);
    line-height: 1;
}

.cs-quote {
    margin-top: 3rem;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.cs .cs-quote p {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.6rem;
    line-height: 1.4;
    color: var(--text-main);
}

.cs-quote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Solution features */
.cs-feature {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 2.5rem;
    align-items: center;
    margin-top: 4rem;
}

.cs-feature--reverse .cs-feature-text {
    order: 2;
}

.cs-feature .cs-img {
    margin: 0;
}

/* Embedded video (e.g. Vimeo) */
.cs-video {
    position: relative;
    aspect-ratio: 16 / 9;
    margin: 2rem 0 0.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--bg-secondary);
}

.cs-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Next projects */
.cs-next {
    margin-top: 2rem;
    padding-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.cs-next-card h3 {
    margin-top: 1rem;
}

@media (max-width: 900px) {
    .cs-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .cs-toc {
        display: none;
    }

    .cs-process {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cs {
        padding: 5.5rem 1rem 4rem;
    }

    .cs-details {
        grid-template-columns: 1fr 1fr;
    }

    .cs-grid--2,
    .cs-grid--3,
    .cs-feature {
        grid-template-columns: 1fr;
    }

    .cs-feature--reverse .cs-feature-text {
        order: 0;
    }

    .cs-callout {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .cs-section {
        padding-bottom: 4rem;
        margin-bottom: 4rem;
    }
}

/* Desktop: swap viewport-based type for the size it reaches on the reference screen, in rem,
   so headings scale with everything else and stop growing at the cap. */
@media (min-width: 1025px) {
    .hero-statement {
        font-size: 2.1rem;
    }

    .hero-statement-lead {
        font-size: 4.5rem;
    }

    .footer h2 {
        font-size: 5rem;
    }

    .cs-title {
        font-size: 2.15rem;
    }

    /* Keyword pills stay on one line, as on the reference screen. */
    .showcase-meta.showcase-tags {
        flex-wrap: nowrap;
    }

    /* Longer tag sets: slightly smaller pills so they stay on one line; wrap as a fallback
       rather than widening the text column and shrinking the image. */
    .showcase-meta.showcase-tags.showcase-tags--compact {
        font-size: 0.72rem;
        flex-wrap: wrap;
    }
}
