/* casestudy.css — JuNu hi-fi case-study dialog (center version + fullscreen) */
/* ATOMIC LAYER: organisms (the dialog is a top-level assembly) */
@layer organisms {

.cs-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(14,14,13,0.55);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 4.2vh 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .26s ease;
}
.cs-scrim.open { opacity: 1; pointer-events: auto; }

.cs-dialog {
  position: relative; width: min(1080px, 92vw); height: 88vh;
  background: var(--paper); color: var(--ink);
  border-radius: var(--r-card); overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.42), 0 0 0 1px rgba(14,14,13,0.06);
  display: flex; flex-direction: column;
  transform: translateY(26px) scale(0.99); opacity: 0;
  transition: transform .38s cubic-bezier(.2,.7,.2,1), opacity .26s ease,
              width .34s cubic-bezier(.2,.7,.2,1), height .34s cubic-bezier(.2,.7,.2,1), border-radius .34s ease;
}
.cs-scrim.open .cs-dialog { transform: none; opacity: 1; }

/* full-screen state */
body.cs-full .cs-scrim { padding: 0; background: rgba(14,14,13,0.9); }
body.cs-full .cs-dialog { width: 100vw; height: 100vh; border-radius: 0; }

/* ---------------- top bar ---------------- */
.cs-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 16px;
  padding: 16px 22px; border-bottom: 1px solid var(--hair);
  background: var(--paper); position: relative; z-index: 3;
}
.cs-bar .cs-eyebrow { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--tr-label); color: var(--ink-55); }
.cs-bar .cs-title-sm { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: var(--tr-tight); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-bar .cs-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cs-bar .cs-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.cs-count { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--ink-55); letter-spacing: var(--tr-label); white-space: nowrap; }
.cs-navpair { display: flex; gap: 6px; }
.cs-ic {
  width: 34px; height: 34px; border-radius: 999px; border: 1.5px solid var(--ink-30);
  background: transparent; color: var(--ink); cursor: pointer; font-family: var(--font-mono);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.cs-ic:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cs-ic:disabled { opacity: .32; cursor: default; }
.cs-ic:disabled:hover { background: transparent; color: var(--ink); border-color: var(--ink-30); }

/* secondary fullscreen toggle (ghost, YouTube-style) */
.cs-fs { width: 32px; height: 32px; border: none; background: transparent; color: var(--ink-55); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .14s ease, color .14s ease; }
.cs-fs:hover { background: rgba(14,14,13,0.06); color: var(--ink); }
.cs-fs .material-symbols-outlined { font-size: 20px; }

/* round nav/close icon buttons */
.cs-ic .material-symbols-outlined { font-size: 18px; }

/* ---------------- scroll body ---------------- */
.cs-body { flex: 1; overflow-y: auto; scroll-behavior: smooth; scrollbar-width: thin; }
.cs-body::-webkit-scrollbar { width: 9px; }
.cs-body::-webkit-scrollbar-thumb { background: var(--ink-14); border-radius: 999px; }
.cs-body::-webkit-scrollbar-thumb:hover { background: var(--ink-30); }

.cs-inner { max-width: 880px; margin: 0 auto; padding: 0 0 80px; }
body.cs-full .cs-inner { max-width: 1080px; }

/* hero */
.cs-hero { width: 100%; height: clamp(320px, 46vh, 560px); display: block; background: var(--paper-2); }
/* real hero media — whole frame, natural aspect, no crop */
.cs-hero-media { display: block; width: 100%; height: auto; }
.cs-hero-wrap { position: relative; }

/* head block */
.cs-head { padding: 36px 40px 0; }
.cs-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.cs-tag { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--tr-label); border: 1.5px solid var(--ink); border-radius: var(--r-pill); padding: 4px 11px; }
.cs-h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(38px, 4.6vw, 68px); line-height: 1.0; letter-spacing: var(--tr-display); margin: 0; text-wrap: balance; }
.cs-impact { margin-top: 16px; font-family: var(--font-mono); font-size: var(--fs-body); line-height: 1.5; color: var(--blue); max-width: 60ch; }

.cs-meta { margin: 30px 40px 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px 22px; padding: 22px 0; border-top: 1.5px solid var(--hair); border-bottom: 1.5px solid var(--hair); }
.cs-meta .k { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--tr-label); color: var(--ink-55); margin-bottom: 7px; }
.cs-meta .v { font-family: var(--font-display); font-weight: 500; font-size: 16px; line-height: 1.35; }

/* generic blocks */
.cs-block { padding: 0 40px; margin-top: 38px; }
.cs-label { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--tr-label); color: var(--ink-55); margin-bottom: 14px; }
.cs-text { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink-80); max-width: 64ch; }
.cs-slot { width: 100%; background: var(--paper-2); }
/* real published media — natural aspect ratio, full width, no crop, seamless
   (transparent PNG edges blend into the page, no background fill) */
.cs-img, .cs-vid { display: block; width: 100%; height: auto; border-radius: 14px; }
.cs-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cs-cap { margin-top: 9px; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--tr-label); color: var(--ink-55); }

/* phases */
.cs-phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1.5px solid var(--ink); }
.cs-phase { min-width: 0; padding: 18px 20px 22px 0; border-right: 1px solid var(--hair); }
.cs-phase + .cs-phase { padding-left: 20px; }
.cs-phase:last-child { border-right: none; padding-right: 0; }
.cs-phase .ph-n { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.cs-phase .ph-d { flex: 0 0 auto; width: 11px; height: 11px; border: 2px solid var(--blue); transform: rotate(45deg); }
.cs-phase .ph-k { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: var(--tr-tight); }
.cs-phase .ph-note { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; color: var(--ink-55); min-width: 0; overflow-wrap: break-word; }

/* metric */
.cs-metric { padding: 0 40px; margin-top: 44px; }
.cs-metric .mval { font-family: var(--font-display); font-weight: 600; font-size: clamp(52px, 8vw, 104px); line-height: 0.92; letter-spacing: var(--tr-display); color: var(--ink); }
.cs-metric .mnote { margin-top: 12px; font-family: var(--font-mono); font-size: var(--fs-small); line-height: 1.5; color: var(--ink-55); max-width: 56ch; }

.cs-hint { position: absolute; right: 18px; bottom: 14px; z-index: 3; font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: var(--tr-label); color: var(--ink-30); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .cs-dialog { transition: opacity .2s ease; transform: none; }
}

@media (max-width: 720px) {
  .cs-scrim { padding: 0; }
  .cs-dialog { width: 100vw; height: 100vh; border-radius: 0; }
  .cs-inner { max-width: 100%; }
  .cs-head, .cs-block, .cs-metric { padding-left: 22px; padding-right: 22px; }
  .cs-meta { margin-left: 22px; margin-right: 22px; grid-template-columns: 1fr 1fr; }
  .cs-duo { grid-template-columns: 1fr; }
  .cs-phases { grid-template-columns: 1fr 1fr; }
  .cs-phase { border-right: none; border-bottom: 1px solid var(--hair); padding-right: 0; }
  .cs-phase + .cs-phase { padding-left: 0; }
  .cs-phase:nth-child(odd) { padding-right: 20px; }
  .cs-bar .cs-title-sm { font-size: 15px; }
}

/* phone: full-screen sheet that slides up; easy in/out (close + swipe-down) */
@media (max-width: 640px) {
  .cs-scrim { padding: 0; }
  .cs-dialog { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; transform: translateY(100%); flex-direction: column-reverse; }
  .cs-scrim.open .cs-dialog { transform: none; }
  .cs-fs { display: none; } /* desktop fullscreen toggle redundant — sheet is already full */

  /* phone: floating frosted pill toolbar at the bottom (Lumy-style) */
  .cs-bar { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); gap: 10px; background: transparent; border: none; box-shadow: none; align-items: center; }
  .cs-left {
    flex: 1; min-width: 0; height: 52px; overflow: hidden;
    flex-direction: row; justify-content: center; align-items: center;
    background: rgba(241,236,227,0.74);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border: 1px solid rgba(14,14,13,0.07);
    border-radius: 999px;
    padding: 0 20px;
    box-shadow: 0 1px 3px rgba(14,14,13,0.09);
  }
  .cs-left .cs-eyebrow { display: none; }
  .cs-left .cs-title-sm { display: block; min-width: 0; max-width: 100%; font-size: 15px; text-align: center; }
  .cs-right {
    height: 52px; gap: 4px; padding: 0 6px;
    flex: 0 0 auto; align-items: center;
    background: rgba(241,236,227,0.74);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border: 1px solid rgba(14,14,13,0.07);
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(14,14,13,0.09);
  }
  .cs-count { display: none; }
  .cs-navpair { gap: 4px; }
  .cs-ic { width: 40px; height: 40px; border: none; background: transparent; color: var(--ink); }
  .cs-ic:hover { background: rgba(14,14,13,0.08); color: var(--ink); }
  .cs-ic .material-symbols-outlined { font-size: 22px; }
  .cs-hint { display: none; }
  .cs-hero { height: clamp(240px, 40vh, 400px); }
  .cs-h1 { font-size: clamp(30px, 9vw, 46px); }
  .cs-impact { font-size: var(--fs-small); }
  .cs-inner { padding-bottom: 32px; }
  /* sheet follows the finger while dragging to dismiss */
  .cs-dialog.cs-dragging { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-dialog { transform: none !important; }
}

} /* @layer organisms */
