/* Study session: full-bleed video background, frosted panels, ring timer.
   Study page mounts a subject-scoped .study container. The floating
   cross-page pill (rendered on other U6 pages) uses .study-crosspage-pill. */

/* The [hidden] HTML attribute must beat our class-level display rules. */
.study [hidden],
.study-crosspage-pill[hidden] { display: none !important; }

/* ---- Study page container ---- */
.study {
  --study-accent: #1e73ff;
  --study-accent-ink: #0b4fc4;
  --study-glass: rgba(255, 255, 255, 0.72);
  --study-glass-border: rgba(255, 255, 255, 0.55);
  --study-glass-dark: rgba(15, 33, 71, 0.45);
  --study-ink: #0f1f33;
  position: relative;
  min-height: 100vh;
  color: var(--study-ink);
  font-family: 'DM Sans', sans-serif;
}
.study.u6-geo { --study-accent: #0f8a5f; --study-accent-ink: #0b6b49; }

/* Hide the site nav when a study page is showing focus/break; keep on setup */
.study[data-active-mode="focus"] ~ .nav,
.study[data-active-mode="break"] ~ .nav { display: none; }

/* ---- Full-bleed background ---- */
.study-bg {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: #0f1f33;
}
.study-bg .study-video, .study-bg .study-poster {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.study-poster { z-index: 1; }
.study-video  { z-index: 2; }
.study-overlay {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(135deg, rgba(15,33,71,.45) 0%, rgba(15,33,71,.25) 100%);
  pointer-events: none;
}

/* Site nav needs a translucent tweak so it doesn't crash the calm feel */
.study ~ * .nav, .study .nav { background: rgba(255,255,255,.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ---- Layout wrappers ---- */
.study-mode { min-height: calc(100vh - 56px); display: block; }
.study-wrap { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px; }
.study-wrap-centre { display: grid; place-items: center; min-height: calc(100vh - 56px); }

.study-crumb {
  display: inline-block; color: rgba(255,255,255,.85); text-decoration: none;
  font-size: 13px; margin-bottom: 20px; text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.study-crumb:hover { color: #fff; }

/* ---- Frosted panels ---- */
.study-panel {
  background: var(--study-glass);
  border: 1px solid var(--study-glass-border);
  border-radius: 22px;
  padding: 32px 34px;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(15,33,71,.18);
}
.study-panel-head { margin-bottom: 24px; }
.study-kicker {
  font-family: 'DM Mono', monospace; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--study-accent-ink); margin-bottom: 6px;
}
.study-title {
  font-family: 'DM Serif Display', serif; font-weight: 400;
  font-size: clamp(24px, 3.6vw, 36px); line-height: 1.15;
  margin: 0 0 8px;
}
.study-sub { font-size: 15px; color: rgba(15,33,71,.7); margin: 0; line-height: 1.5; }

/* ---- Form fields ---- */
.study-form { display: flex; flex-direction: column; gap: 18px; }
.study-field { display: flex; flex-direction: column; gap: 8px; }
.study-field > label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: rgba(15,33,71,.55);
}
.study-field select {
  font: inherit; font-size: 14px; padding: 10px 12px;
  border-radius: 10px; border: 1.5px solid rgba(15,33,71,.15);
  background: rgba(255,255,255,.7);
}
.study-field select:focus { outline: none; border-color: var(--study-accent); }

.study-radios { display: flex; gap: 10px; flex-wrap: wrap; }
.study-radios-tool { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.study-radio {
  flex: 1 1 160px; min-width: 140px; cursor: pointer;
  padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid rgba(15,33,71,.15); background: rgba(255,255,255,.7);
  transition: border-color .15s, background .15s;
}
.study-radio input { display: none; }
.study-radio span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: rgba(15,33,71,.7); }
.study-radio span strong { font-size: 14.5px; color: var(--study-ink); font-weight: 700; }
.study-radio:has(input:checked) {
  background: rgba(30,115,255,.10); border-color: var(--study-accent);
}
.study.u6-geo .study-radio:has(input:checked) { background: rgba(15,138,95,.10); }

/* ---- Sound controls ---- */
.study-sound { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.study-sound-layer {
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255,255,255,.55); border: 1.5px solid rgba(15,33,71,.10);
  display: flex; flex-direction: column; gap: 8px;
}
.study-sound-head {
  font-family: 'DM Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase; color: rgba(15,33,71,.55);
}
.study-sound-layer select { font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(15,33,71,.15); background: #fff; }
.study-sound-layer input[type="range"] { width: 100%; accent-color: var(--study-accent); }
.study-sound-note { font-size: 12.5px; color: rgba(15,33,71,.6); font-style: italic; margin: 6px 0 0; }

/* ---- Buttons ---- */
.study .btn {
  font-family: inherit; font-size: 14px; font-weight: 600; border-radius: 12px;
  padding: 12px 22px; border: 1.5px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform .1s, background .15s, border-color .15s;
}
.study .btn:active { transform: translateY(1px); }
.study .btn-primary { background: var(--study-accent); color: #fff; }
.study .btn-primary:hover { background: var(--study-accent-ink); }
.study .btn-ghost { background: rgba(255,255,255,.7); color: var(--study-ink); border-color: rgba(15,33,71,.15); }
.study .btn-ghost:hover { border-color: rgba(15,33,71,.4); }
.study-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* ---- Today's dots ---- */
.study-today {
  margin-top: 22px; padding: 12px 16px;
  background: rgba(255,255,255,.55); border-radius: 12px; border: 1px solid rgba(15,33,71,.10);
  display: flex; align-items: center; gap: 12px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.study-today-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(15,33,71,.55); }
.study-today-dots { display: flex; gap: 6px; }
.study-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--study-accent); box-shadow: inset 0 -2px rgba(0,0,0,.15); }

/* ---- Focus mode iframe ---- */
.study-focus-wrap {
  position: fixed; inset: 56px 0 0 0;
  padding: 20px 24px 92px;
  overflow: hidden;
}
.study-iframe {
  width: 100%; height: 100%;
  border-radius: 18px; border: 1px solid var(--study-glass-border);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 80px rgba(15,33,71,.28);
}

/* ---- Break mode big ring ---- */
.study-panel-break { text-align: center; max-width: 560px; }
.study-ring-big {
  position: relative; width: 260px; height: 260px; margin: 22px auto 0;
}
.study-ring-big svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.study-ring-big .ring-track { fill: none; stroke: rgba(15,33,71,.10); stroke-width: 14; }
.study-ring-big .ring-fill  { fill: none; stroke: var(--study-accent); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.study-ring-time {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums;
  font-size: 42px; font-weight: 600; color: var(--study-ink);
}

.study-panel-done { text-align: center; max-width: 560px; }

/* ---- Floating timer pill (on the study page) ---- */
.study-pill {
  position: fixed; bottom: 20px; right: 20px; z-index: 90;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 8px 8px;
  background: rgba(15,33,71,.85); color: #fff;
  border-radius: 999px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.study-pill-timer {
  position: relative; width: 44px; height: 44px;
  border: none; background: transparent; padding: 0; cursor: pointer;
}
.study-pill-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.study-pill-ring .pill-track { fill: none; stroke: rgba(255,255,255,.2); stroke-width: 3; }
.study-pill-ring .pill-fill  { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.study-pill-time {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums;
  font-size: 12.5px; font-weight: 600;
}
.study-pill-info { display: flex; flex-direction: column; line-height: 1.2; }
.study-pill-mode { font-family: 'DM Mono', monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; opacity: .7; }
.study-pill-topic { font-size: 13px; font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-pill-actions { display: flex; gap: 4px; margin-left: 4px; }
.study-pill-btn {
  background: rgba(255,255,255,.1); color: #fff; border: none;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 12px; cursor: pointer;
}
.study-pill-btn:hover { background: rgba(255,255,255,.2); }
.study-pill-end { background: rgba(220,60,60,.3); }
.study-pill-end:hover { background: rgba(220,60,60,.5); }

/* Reduce-motion helper text */
.study-reduce-note {
  position: fixed; bottom: 20px; left: 20px; z-index: 90;
  padding: 6px 12px; background: rgba(255,255,255,.85);
  border-radius: 8px; font-size: 12px; color: var(--study-ink);
}

/* ---- Study page footer ---- */
.study-footer {
  position: fixed; bottom: 12px; left: 20px;
  z-index: 50;
  font-size: 12px; color: rgba(255,255,255,.75);
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.study-footer a { color: rgba(255,255,255,.95); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.4); }
.study-footer a:hover { color: #fff; border-bottom-color: #fff; }

/* ---- Cross-page pill (on other U6 pages while a session runs) ---- */
.study-crosspage-pill {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; background: rgba(15,33,71,.9); color: #fff;
  border-radius: 999px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.study-crosspage-pill .cxp-mode { font-family: 'DM Mono', monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; opacity: .7; }
.study-crosspage-pill .cxp-time { font-family: 'DM Mono', monospace; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; }
.study-crosspage-pill .cxp-quiet { font-size: 11px; opacity: .6; font-style: italic; }
.study-crosspage-pill .cxp-back { color: #fff; text-decoration: none; font-weight: 600; padding: 4px 10px; background: rgba(255,255,255,.15); border-radius: 999px; }
.study-crosspage-pill .cxp-back:hover { background: rgba(255,255,255,.28); }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .study-radios-tool { grid-template-columns: 1fr; }
  .study-sound { grid-template-columns: 1fr; }
  .study-focus-wrap { padding: 12px 12px 90px; }
  .study-pill { bottom: 12px; right: 12px; }
  .study-pill-info { display: none; }
  .study-pill-time { font-size: 11px; }
  .study-crosspage-pill { bottom: 12px; right: 12px; font-size: 12px; }
  .study-crosspage-pill .cxp-quiet { display: none; }
}
