/* Lab + Nordic Tupi case study. Loaded after styles.css on lab pages only. */

/* ---------- Lab index ---------- */
.lab-hero .hero-meta p { max-width: 38ch; }
.lab-grid .card { grid-column: 1 / -1; }
.lab-grid .card .media { aspect-ratio: 16 / 9; }
.lab-grid .card .media video { opacity: 1; }
.lab-grid .card .media .wip { position: absolute; left: 14px; top: 14px; z-index: 2; }
.lab-grid .card:hover .media video { transform: scale(1.02); }
.lab-note { padding-block: 0 clamp(48px, 8vw, 120px); color: var(--muted); max-width: 52ch; }

/* ---------- Nordic Tupi page ---------- */
.nt { --chalk: #F5F2EB; --carbon: #211D22; --glacier: #A8CCF0; --ember: #A44725; --haze: #DCE7F2;
  --ls: "League Spartan", "Helvetica Neue", Arial, sans-serif; --in: "Inter", "Helvetica Neue", Arial, sans-serif; }
.nt-hero { position: relative; background: var(--carbon); }
.nt-hero video { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.cs-head .wip { margin-left: 12px; vertical-align: middle; }
.nt-tag { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

/* Polarity band */
.polarity { --h: 52; position: relative; color: var(--carbon); overflow: hidden;
  background: linear-gradient(180deg, var(--glacier) 0%, var(--haze) calc((var(--h) - 22) * 1%), #c9a596 calc((var(--h) - 4) * 1%), var(--ember) calc((var(--h) + 10) * 1%), #5a2516 calc((var(--h) + 30) * 1%), var(--carbon) 100%);
  min-height: clamp(420px, 62vw, 760px); display: flex; flex-direction: column; justify-content: space-between; }
.polarity-top, .polarity-bot { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-block: clamp(24px, 4vw, 48px); }
.polarity .ntx { margin: 0; font: 400 clamp(84px, 19vw, 300px)/0.8 var(--ls); letter-spacing: -0.02em; }
.polarity .ntx-sub { margin: 10px 0 0; font: 500 12px/1.3 var(--in); letter-spacing: .06em; text-transform: uppercase; }
.polarity-bot { color: var(--chalk); flex-direction: column; align-items: stretch; }
.polarity-read { display: flex; justify-content: space-between; font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.polarity-read b { font-weight: 600; }
.polarity input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: grab; }
.polarity input[type=range]::-webkit-slider-runnable-track { height: 1px; background: var(--chalk); }
.polarity input[type=range]::-moz-range-track { height: 1px; background: var(--chalk); }
.polarity input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--chalk); margin-top: -11px; box-shadow: 0 0 0 6px rgba(245,242,235,.18); }
.polarity input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--chalk); border: 0; }
.polarity input[type=range]:focus-visible { outline: 2px solid var(--chalk); outline-offset: 4px; }

/* Palette, Nordic Tupi colours on Carbon */
.nt .palette { --navy: var(--carbon); --on-navy: var(--chalk); --on-navy-muted: #b9b2ab; }
.nt .palette .hint { color: var(--glacier); }
.nt .sw { color: var(--carbon); }
.nt .sw.dark { color: var(--chalk); }
.nt .sw.grad { background: var(--g); }
.nt .sw:focus-visible { outline-color: var(--glacier); }
.nt-pal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: clamp(24px, 4vw, 56px); align-items: start; }
.nt-mock { aspect-ratio: 3 / 4; position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 7%;
  background: var(--mbg, linear-gradient(180deg, #A8CCF0, #DCE7F2 30%, #A44725 68%, #211D22)); color: var(--mink, #A44725);
  transition: background .6s, color .4s; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.nt-mock .wm { font: 400 clamp(18px, 2vw, 26px)/1 var(--ls); color: var(--mwm, #211D22); transition: color .4s; }
.nt-mock .hl { font: 400 clamp(34px, 4.2vw, 58px)/0.98 var(--ls); letter-spacing: -0.03em; margin-top: 10%; flex: 1; }
.nt-mock .ft { display: flex; justify-content: space-between; font: 500 10px/1 var(--in); letter-spacing: .06em; color: var(--chalk); }
.nt-mock-meta { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.nt-mock-meta span:last-child { color: var(--on-navy-muted); font-size: 13px; }
.balance { display: flex; height: 34px; gap: 2px; }
.balance span { display: flex; align-items: flex-end; padding: 6px 8px; font: 500 10px/1 var(--mono); letter-spacing: .06em; }
.pair-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 40px; }
.pair-rules p { margin: 0; color: var(--on-navy-muted); max-width: 48ch; }
.pair-rules b { color: var(--on-navy); font-weight: 600; }
@media (max-width: 860px) { .nt-pal, .pair-rules { grid-template-columns: 1fr; } .nt-mock { max-width: 360px; } }

/* Live tool */
.nt-tool { background: var(--carbon); color: var(--chalk); padding-block: clamp(40px, 6vw, 80px); }
.nt-tool .label { color: #b9b2ab; }
.nt-tool-head { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; align-items: end; margin-bottom: clamp(20px, 3vw, 36px); }
.nt-tool-head > div { grid-column: 1 / span 8; }
.nt-tool-head h2 { margin: 8px 0 0; font: 800 clamp(32px, 4.6vw, 68px)/0.95 var(--display); font-stretch: 125%; letter-spacing: -0.04em; text-transform: uppercase; }
.nt-tool-head p { margin: 14px 0 0; max-width: 56ch; color: #cfc8c0; }
.nt-tool-head .actions { grid-column: 9 / -1; justify-content: flex-end; }
.nt-tool .btn { background: var(--chalk); color: var(--carbon); border-color: var(--chalk); }
.nt-tool .btn:hover { background: transparent; color: var(--chalk); }
.nt-frame { position: relative; height: min(86vh, 900px); min-height: 620px; background: #f5f2eb; border-radius: 4px; overflow: hidden; }
.nt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.nt-frame .nt-frame-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nt-frame .nt-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.nt-tool .spec-note { color: #b9b2ab; margin-top: 12px; }
@media (max-width: 860px) {
  .nt-tool-head > div, .nt-tool-head .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .nt-frame { height: auto; min-height: 0; aspect-ratio: 4 / 5; }
}

/* Galleries */
.nt-row { display: grid; gap: clamp(8px, 1.2vw, 16px); padding-block: clamp(12px, 1.6vw, 20px); }
.nt-row figure { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nt-row img, .nt-row video { width: 100%; height: auto; background: var(--tile); }
.nt-row figcaption { display: flex; justify-content: space-between; gap: 8px; }
.nt-row figcaption .label:last-child { opacity: .7; }
.r7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.r6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.r5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.r3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r-sw { grid-template-columns: 9fr 16fr; align-items: start; }
@media (max-width: 980px) { .r7 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .r6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .r7, .r5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r3 { grid-template-columns: 1fr; }
  .r-sw, .r2 { grid-template-columns: 1fr; }
}
.nt-sub { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding-top: clamp(28px, 4vw, 56px); border-top: 1px solid var(--line); margin-top: clamp(28px, 4vw, 56px); }
.nt-sub h3 { margin: 0; font: 600 clamp(20px, 2vw, 28px)/1.15 var(--display); letter-spacing: -0.01em; }
.nt-sub p { margin: 0; color: var(--muted); max-width: 52ch; }
@media (max-width: 760px) { .nt-sub { flex-direction: column; } }

.nt-boards figure { display: flex; flex-direction: column; gap: 10px; }
.nt .palette-head .hint { grid-column: 1 / -1; }
.nt .sw.dark { box-shadow: inset 0 0 0 1px rgba(245, 242, 235, .22); }
