/* ════════════════════════════════════════════════════════════════
   WARMLYN CASE STUDY — project.css
   Inherits tokens (color, spacing, type, radius) from /css/global.css.
   Neutral throughout, no project accent color. Two custom pieces:
   the sidebar section nav, and the media frame for video walkthroughs.
   ════════════════════════════════════════════════════════════════ */

:root {
  --wl-hero-image:   url("https://res.cloudinary.com/g5cnxha1/image/upload/v1788252054/bg-image-1.png");
  --wl-frame-bg:      #171717;
  --wl-frame-border:  rgba(255, 255, 255, 0.1);
  --wl-content:       760px;
  --wl-sidebar:       180px;

  /* Deliberately fixed, always dark, never redefined under
     [data-theme="light"]. The hero photo stays dark-toned
     regardless of which theme the rest of the page is in. */
  --wl-hero-tint:     #0C0C0C;
}

[data-theme="light"] {
  --wl-frame-bg:      #E8E8E4;
  --wl-frame-border:  rgba(0, 0, 0, 0.1);
}

html { scroll-behavior: smooth; }
body { overflow-x: clip; }

@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;
  }
}

/* ─── HERO ───────────────────────────────────────────────────── */

.cs-hero {
  position: relative;
  min-height: min(92vh, 960px);
  padding: calc(var(--nav-height) + var(--space-6)) var(--space-8) var(--space-10);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  isolation: isolate;
}

.cs-hero__background {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to bottom,
      color-mix(in srgb, var(--wl-hero-tint) 18%, transparent),
      color-mix(in srgb, var(--wl-hero-tint) 38%, transparent)),
    var(--wl-hero-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: var(--wl-hero-tint);
}

.cs-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--wl-hero-tint) 5%, transparent),
    transparent 55%,
    color-mix(in srgb, var(--wl-hero-tint) 28%, transparent));
  pointer-events: none;
}

/* Deliberately no [data-theme="light"] override here. The hero
   photo stays the same dark tint in both themes, it does not
   lighten when the rest of the page switches to light mode. */

.cs-hero__top {
  width: min(100%, var(--container));
  margin: auto;
}

.cs-back {
  display: inline-flex;
  align-items: center;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cs-back:hover { opacity: 0.65; }

.cs-hero__media {
  width: min(100%, 1120px);
  margin: auto;
  display: grid;
  place-items: center;
}

/* ─── MEDIA FRAME (video walkthroughs) ───────────────────────── */

.cs-media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--wl-frame-border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.cs-media-frame--hero { width: min(100%, 1040px); }

.cs-media-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: inherit;
}

.cs-media-frame video,
.cs-media-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: var(--wl-frame-bg);
}

.media-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  background: var(--wl-frame-bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cs-media-frame video + .media-placeholder { display: none; }

/* ─── PAGE LAYOUT (sidebar + content) ────────────────────────── */

.cs-layout {
  width: min(100%, 1240px);
  margin: auto;
  padding: var(--space-32) var(--space-8) 0;
  display: grid;
  grid-template-columns: var(--wl-sidebar) minmax(0, var(--wl-content));
  gap: clamp(3rem, 8vw, 8rem);
  align-items: start;
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */

.cs-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-8));
  align-self: start;
}

.cs-sidebar__project {
  display: inline-block;
  margin-bottom: var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-primary);
}

.cs-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cs-sidebar__nav a {
  display: block;
  padding: 0.15rem 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-muted);
  transition: color var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
}

.cs-sidebar__nav a:hover,
.cs-sidebar__nav a.is-active {
  color: var(--text-primary);
}

.cs-sidebar__nav a.is-active { transform: translateX(5px); }

/* ─── CONTENT / SECTIONS ─────────────────────────────────────── */

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

.cs-section {
  padding-block: var(--space-24);
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-height) + var(--space-8));
}

.cs-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.cs-label {
  margin-bottom: var(--space-6);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cs-title {
  margin-bottom: var(--space-6);
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.045em;
}

/* ─── TL;DR TITLE ROW + LIVE-SITE BUTTON ─────────────────────────
   Highest-intent spot on the page: right where someone has just
   read one line and is deciding whether to go see the real thing.
   Styled stronger than a nav-bar link on purpose. ─────────────── */

.cs-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.cs-title-row .cs-title { margin-bottom: 0; }

.cs-live-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  transition:
    transform var(--duration-base) var(--ease-spring),
    box-shadow var(--duration-base) var(--ease-out);
}

.cs-live-btn svg {
  transition: transform var(--duration-base) var(--ease-out);
}

.cs-live-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.cs-live-btn:hover svg {
  transform: translate(2px, -2px);
}

.cs-heading {
  max-width: 720px;
  margin-bottom: var(--space-8);
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.035em;
}

.cs-intro {
  max-width: 680px;
  margin-bottom: var(--space-12);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.5;
  color: var(--text-secondary);
}

.cs-section > p:not(.cs-label):not(.cs-intro) {
  max-width: 680px;
  margin-top: var(--space-6);
}

/* ─── META STRIP (single row: Role · Timeline · Tools · Skills) ─ */

.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: var(--space-16);
  border-top: 1px solid var(--border);
}

.cs-meta > div {
  padding: var(--space-5) var(--space-5) var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}

.cs-meta > div:not(:first-child) {
  padding-left: var(--space-5);
  border-left: 1px solid var(--border);
}

.cs-meta span {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.cs-meta strong {
  display: block;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.5;
}

/* ─── PLAIN MEDIA SLOTS ──────────────────────────────────────────
   Deliberately undecorated. This is just a placeholder outline so
   you can see where an image goes. No card, no shadow, no fill.
   Once a real image is dropped in, the dashed border can be
   removed entirely if you want zero framing around it. ────────── */

.media-slot {
  margin-top: var(--space-10);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Empty slot: dashed placeholder outline, for anything not yet filled */
.media-slot:not(:has(img)) {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-slot--wide:not(:has(img)) { min-height: 420px; }

/* Populated slot: no border, no forced crop, image sizes at its own
   natural aspect ratio so nothing gets cropped oddly on narrow screens */
.media-slot img {
  display: block;
  width: 100%;
  height: auto;
}

/* ─── RESEARCH: REFERENCE LOGOS ──────────────────────────────── */

.reference-list {
  margin-top: var(--space-10);
  border-top: 1px solid var(--border);
}

.reference {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--space-5);
  align-items: center;
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.reference__logo {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.reference__logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.reference h3 {
  margin-bottom: 0.2rem;
  font-size: var(--text-md);
  font-weight: 500;
}

.reference p { font-size: var(--text-sm); }

/* ─── PROCESS: NUMBERED STEPS ────────────────────────────────── */

.cs-steps {
  margin-top: var(--space-10);
  border-top: 1px solid var(--border);
  counter-reset: step;
}

.cs-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--space-5);
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.cs-steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.cs-steps li p {
  max-width: 560px;
  margin: 0;
}

/* ─── SOLUTION: VIDEO BLOCK ──────────────────────────────────── */

.cs-video-block {
  margin-top: var(--space-12);
  padding: var(--space-8);
  background-image:
    linear-gradient(to bottom,
      color-mix(in srgb, var(--wl-hero-tint) 18%, transparent),
      color-mix(in srgb, var(--wl-hero-tint) 38%, transparent)),
    var(--wl-hero-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-color: var(--wl-hero-tint); /* fallback shade until hero-bg.jpg exists */
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.cs-video-block .cs-media-frame { box-shadow: none; }

/* Same as the hero, deliberately no [data-theme="light"] override.
   This shares the hero image and stays the same dark tint always. */

/* ─── NEXT PROJECT ───────────────────────────────────────────── */

.cs-next {
  padding-block: var(--space-24);
  border-top: 1px solid var(--border);
}

.cs-next__link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.2rem var(--space-5);
}

.cs-next__label {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cs-next__link strong {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.035em;
}

.cs-next__arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
}

.cs-next__link:hover .cs-next__arrow { transform: translateX(6px); }

/* ─── MOBILE JUMP NAV (hidden until <980px) ──────────────────── */

.cs-mobile-jump,
.cs-mobile-panel { display: none; }

@media (max-width: 980px) {
  .cs-layout {
    display: block;
    padding-top: var(--space-20);
  }

  .cs-sidebar { display: none; }

  .cs-mobile-jump {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 300;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 500;
  }

  .cs-mobile-jump__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-primary);
  }

  .cs-mobile-panel {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: block;
    padding: var(--space-6);
    background: var(--bg-primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition:
      opacity var(--duration-base) var(--ease-out),
      transform var(--duration-base) var(--ease-out),
      visibility var(--duration-base);
  }

  .cs-mobile-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .cs-mobile-panel__inner {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .cs-mobile-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--nav-height);
  }

  .cs-mobile-panel__head button {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.62rem;
  }

  .cs-mobile-panel nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: auto 0;
  }

  .cs-mobile-panel nav a {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 6vw, 2rem);
    font-weight: 500;
  }

  .cs-mobile-panel nav a.is-active { color: var(--text-primary); }
}

/* ─── MOBILE HERO ─────────────────────────────────────────────────
   The frame stays contained with padding, same as the video blocks
   further down the page, so the shared background shows around it
   instead of being hidden edge-to-edge.
   ─────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .cs-hero {
    min-height: auto;
    grid-template-rows: auto 1fr;
    padding: calc(var(--nav-height) + var(--space-4)) var(--space-4) var(--space-8);
  }

  .cs-hero__top {
    width: 100%;
    margin-bottom: var(--space-4);
  }

  .cs-hero__media {
    width: 100%;
  }

  .cs-media-frame--hero {
    width: 100%;
  }

  .cs-layout {
    padding-inline: var(--space-5);
  }

  .cs-section { padding-block: var(--space-20); }

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

  .cs-meta > div:nth-child(2n + 1) {
    padding-left: 0;
    border-left: 0;
  }

  .cs-meta > div:nth-child(2n) {
    padding-left: var(--space-5);
    border-left: 1px solid var(--border);
  }

  .media-slot:not(:has(img)) { min-height: 240px; }
  .media-slot--wide:not(:has(img)) { min-height: 300px; }

  .cs-video-block { padding: var(--space-4); }

  .cs-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
}

/* ─── SMALL PHONES (≤400px) ───────────────────────────────────── */

@media (max-width: 400px) {
  .cs-hero { padding-inline: var(--space-3); }
  .cs-layout { padding-inline: var(--space-4); }
  .cs-section { padding-block: var(--space-16); }
  .cs-meta { grid-template-columns: 1fr; }
  .cs-meta > div,
  .cs-meta > div:nth-child(2n) {
    padding-left: 0;
    border-left: 0;
  }
  .reference { grid-template-columns: 44px 1fr; gap: var(--space-4); }
  .reference__logo { width: 44px; height: 44px; }
}