/* ===========================
   Work View
   =========================== */
.work-view {
    position: absolute;
    top: 0;
    left: 25%;
    width: 50%;
    min-height: 100%;
    z-index: 4;
    padding: 20vh 40px 120px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.work-view-inner {
    position: relative;
    min-height: 120px;
    transition: height 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

/* Full-width layout when TeacherGPT (app layout) is visible */
.work-view.work-view-full {
    left: 0;
    width: 100%;
    padding: 60px 120px 100px 120px;
    box-sizing: border-box;
    transform: none; /* so .case-study-stats position:fixed is viewport-relative */
}

.work-section:has(.case-study-app-layout) {
    min-height: 100vh;
}

.work-view h2 {
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 500;
    margin-bottom: 16px;
    color: rgba(0, 0, 0, 0.6);
}

.work-view p {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(0, 0, 0, 0.7);
}

/* View state transitions */
.mode-home .work-view {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

.mode-work .work-view {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ===========================
   Work Sections (per project — stacked, crossfade)
   =========================== */
.work-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.work-section.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ===========================
   Work Sub-navigation (projects)
   =========================== */
.work-subnav {
    position: fixed;
    top: calc(56%);
    left: 96px;
    transform: translateY(-50%) translateX(4px);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    min-width: 180px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Visible when hovering Work nav item */
.work-subnav-hover .work-subnav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

/* Hidden when already on a Work page */
body.mode-work .work-subnav {
    opacity: 0;
    pointer-events: none;
}

.work-subnav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition:
        background 0.18s ease,
        transform 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}

.work-subnav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateX(1px);
}

.work-subnav-item.is-active {
    background: rgba(0, 0, 0, 0.06);
}

.work-subnav-icon {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.work-subnav-icon svg {
    width: 16px;
    height: 16px;
    stroke: rgba(0, 0, 0, 0.55);
    stroke-width: 1.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.work-subnav-item.is-active .work-subnav-icon svg {
    stroke: rgba(0, 0, 0, 0.9);
}

.work-subnav-label {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    color: rgba(0, 0, 0, 0.7);
    white-space: nowrap;
}

/* ===========================
   Case Study Layout
   =========================== */
.case-study {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* ===========================
   TeacherGPT App Layout (canvas + sidebar + floating stats)
   =========================== */
.case-study-app-layout {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr 340px;
    min-height: 100vh;
    gap: 0;
}

.case-study-top {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px 32px 20px;
}

.case-study-top .case-study-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
}

.case-study-top h1 {
    font-family: 'Georgia', 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(22px, 2.8vw, 42px);
    line-height: 1.4;
    color: rgba(0, 0, 0, 0.85);
    letter-spacing: -0.01em;
    margin: 0;
}

.case-study-top h3 {
    font-family: 'Georgia', 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(14px, 1.5vw, 20px);
    line-height: 1.4;
    color: rgba(0, 0, 0, 0.7);
    letter-spacing: -0.01em;
    margin: 0;
}

.case-study-canvas {
    grid-column: 1;
    min-height: 400px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    margin: 0 24px 24px 32px;
}

.case-study-sidebar {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0 32px 24px 0;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

.case-study-app-layout .case-study-carousel {
    flex-shrink: 0;
    height: 200px;
    border-radius: 12px;
}

.case-study-app-layout .case-study-carousel .carousel-slide img {
    object-fit: cover;
}

.case-study-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.case-study-app-layout .case-study-section h2 {
    font-size: clamp(14px, 1.4vw, 18px);
}

.case-study-app-layout .case-study-section p {
    font-size: 14px;
    max-width: none;
}

/* Viewport-fixed wrapper (stats moved to body by JS when TeacherGPT is visible) */
#case-study-stats-viewport {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: none;
}

#case-study-stats-viewport .case-study-stats {
    pointer-events: auto;
}

.case-study-stats {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    padding: 8px 16px 10px;
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.case-study-stats .case-study-role {
    padding-right: 14px;
    margin-right: 14px;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.case-study-stats .role-icon {
    width: 20px;
    height: 20px;
}

.case-study-stats .role-item {
    font-size: 11px;
}

.case-study-stats .case-study-insights {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px 20px;
    padding-left: 0;
    margin-left: 0;
    border-left: none;
}

.case-study-stats .insight-value {
    font-size: 14px;
}

.case-study-stats .insight-label {
    font-size: 11px;
}

/* Header — logo + title + subtitle (default case study) */
.case-study-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-study-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: contain;
    margin-bottom: 4px;
}

.case-study-header h1 {
    font-family: 'Georgia', 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(22px, 2.8vw, 42px);
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.85);
    letter-spacing: -0.01em;
    text-transform: none;
    margin-bottom: 0;
}

.case-study-header h3 {
    font-family: 'Georgia', 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(16px, 1.8vw, 24px);
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.85);
    letter-spacing: -0.01em;
    text-transform: none;
    margin: 0;
}

.case-study-subtitle {
    font-size: 18px;
    line-height: 1.55;
    color: rgba(0, 0, 0, 0.55);
    font-weight: 400;
    max-width: 540px;
}

/* Badge container — role + insights */
.case-study-badge {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    margin-top: 8px;
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.06),
        0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.case-study-role {
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    color: rgba(0, 0, 0, 0.6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.role-icon svg {
    width: 100%;
    height: 100%;
}

.role-labels {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.role-item {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

/* Insights / Analytics — inside badge */
.case-study-badge .case-study-insights {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding-left: 16px;
    margin-left: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.case-study-insights {
    display: flex;
    flex-wrap: wrap;
    gap: 24px 32px;
}

.insight-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.case-study-badge .insight-value {
    font-size: 17px;
}

.case-study-badge .insight-label {
    font-size: 12px;
}

.insight-value {
    font-size: 20px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
    letter-spacing: -0.02em;
}

.insight-label {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.5);
    font-weight: 400;
}

/* Sections */
.case-study-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-study-section h2 {
    font-family: 'Georgia', 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(18px, 2.2vw, 32px);
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.85);
    letter-spacing: -0.01em;
    text-transform: none;
    margin: 0;
}

.case-study-section p {
    font-size: 16px;
    line-height: 1.7;
    color: rgba(0, 0, 0, 0.7);
    max-width: 600px;
}

/* ===========================
   Carousel
   =========================== */
.case-study-carousel {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.carousel-track {
    position: relative;
    width: 100%;
}

/* First slide is in flow to set the natural height */
.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.carousel-slide:first-child {
    position: relative;
}

.carousel-slide.is-active {
    opacity: 1;
}

.carousel-slide img {
    display: block;
    width: 100%;
    height: auto;
}

/* Prev / Next arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.case-study-carousel:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-50%) scale(1.08);
}

.carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }

.carousel-arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: rgba(0, 0, 0, 0.7);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Bottom controls bar — dots + counter */
.carousel-controls {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 5;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
}

.carousel-dots {
    display: flex;
    gap: 6px;
}

.carousel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 0;
    transition: background 0.25s ease, transform 0.25s ease;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.2);
}

.carousel-dot.is-active {
    background: rgba(255, 255, 255, 0.95);
}

.carousel-counter {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}
