/* Virtu Studio.
 *
 * Visual language follows the Ice Cut Studio prototype: an indigo-violet
 * gradient field with white cards floating on it, generous radii, soft
 * shadows. Refined rather than copied — the prototype leaned on Bootstrap
 * defaults, so the greys are warmed, the type scale tightened, and the
 * shadows layered instead of flat.
 *
 * Constraints from the domain: this gets used rinkside on a phone in bad
 * light, so contrast stays high, hit targets stay large, and every state is
 * carried by text as well as colour.
 */

:root {
  --indigo: #5b6ee1;
  --violet: #7c4fd4;
  --field: linear-gradient(140deg, #5b6ee1 0%, #7c4fd4 55%, #8b45c9 100%);

  --card: #ffffff;
  --ink: #1d2030;
  --ink-soft: #5a5f75;
  --ink-faint: #8b90a6;
  --line: #e7e9f2;
  --wash: #f7f8fc;

  --ok: #0f9d6b;
  --ok-wash: #e7f7f1;
  --warn: #d64545;
  --warn-wash: #fdeceb;
  --amber: #b7791f;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;

  --lift-1: 0 1px 2px rgba(23, 26, 48, 0.06), 0 4px 12px rgba(23, 26, 48, 0.06);
  --lift-2: 0 2px 4px rgba(23, 26, 48, 0.07), 0 12px 32px rgba(23, 26, 48, 0.12);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--field);
  background-attachment: fixed;
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 28px;
  max-width: 1040px;
  margin: 0 auto;
}

.brand {
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.015em;
  color: #fff;
  text-decoration: none;
  margin-right: auto;
}
.brand span { opacity: 0.72; font-weight: 500; }

.topbar nav { display: flex; align-items: center; gap: 6px; }

.topbar nav a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 99px;
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar nav a:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.topbar nav a.current { background: rgba(255, 255, 255, 0.22); color: #fff; }

.whoami {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  padding-left: 6px;
}

main { max-width: 1040px; margin: 0 auto; padding: 8px 20px 72px; }

/* ----------------------------------------------------------------- cards */

.panel {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-1);
  padding: 26px 28px;
  margin-bottom: 22px;
}

.panel > h2 {
  margin: 0 0 4px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.panel > .sub {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.panel > h2 + *:not(.sub) { margin-top: 18px; }

/* ------------------------------------------------------------------ hero */

.hero { padding: 56px 0 44px; text-align: center; color: #fff; }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  text-shadow: 0 2px 18px rgba(23, 20, 60, 0.22);
}
.hero .lede {
  margin: 0 auto;
  max-width: 34rem;
  font-size: 1.14rem;
  color: rgba(255, 255, 255, 0.92);
}

.cta-row { display: flex; gap: 12px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

.cta {
  display: inline-block;
  padding: 14px 30px;
  border-radius: var(--r-md);
  font-weight: 650;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.cta-primary { background: #fff; color: var(--violet); box-shadow: var(--lift-2); }
.cta-primary:hover { transform: translateY(-2px); }
.cta-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.cta-ghost:hover { background: rgba(255, 255, 255, 0.24); }

.features {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  margin-bottom: 26px;
}
.feature {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-1);
  padding: 24px;
}
.feature .icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
  font-size: 1.05rem;
  margin-bottom: 13px;
}
.feature h3 { margin: 0 0 6px; font-size: 1.03rem; letter-spacing: -0.01em; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 0.93rem; }

/* -------------------------------------------------------- page headings */

.page-head { padding: 26px 0 20px; color: #fff; }
.page-head h1 {
  margin: 0 0 5px;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  text-shadow: 0 2px 14px rgba(23, 20, 60, 0.2);
}
.page-head p { margin: 0; color: rgba(255, 255, 255, 0.86); font-size: 0.97rem; }

/* ------------------------------------------------------ duration readout */

/* The single most important element in the product: a program outside its
   tolerance is a deduction or a disqualification. State is spelled out in
   words as well as colour, so it survives bad light and colour blindness. */
.duration-panel { padding: 0; overflow: hidden; }

.duration {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  padding: 24px 28px;
  border-left: 5px solid var(--line);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.duration .big {
  font-size: 3.15rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.duration .delta { font-size: 1rem; font-weight: 650; }
.duration .target { margin-left: auto; color: var(--ink-faint); font-size: 0.88rem; }

.duration.idle { border-left-color: var(--line); }
.duration.idle .big { color: var(--ink-faint); }
.duration.idle .delta { color: var(--ink-faint); font-weight: 500; }

.duration.ok { background: var(--ok-wash); border-left-color: var(--ok); }
.duration.ok .big, .duration.ok .delta { color: var(--ok); }

.duration.over { background: var(--warn-wash); border-left-color: var(--warn); }
.duration.over .big, .duration.over .delta { color: var(--warn); }

/* ------------------------------------------------------------ step flow */

/* Numbered steps, because the first question a newcomer has is "where do I
   start?". Panels alone gave no reading order. */
.step-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.step-head h2 { margin: 0 0 3px; font-size: 1.12rem; letter-spacing: -0.015em;
                text-transform: none; color: var(--ink); font-weight: 650; }
.step-head .sub { margin: 0; }

.step-num {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
}

/* A step that cannot be used yet is dimmed rather than hidden, so the whole
   path stays visible from the first screen. */
.step.is-waiting { opacity: 0.62; }
.step.is-waiting .step-num { background: #c9cde4; }

.inline-empty {
  padding: 22px;
  border-radius: var(--r-md);
  background: var(--wash);
  border: 1.5px dashed var(--line);
  color: var(--ink-faint);
  font-size: 0.92rem;
  text-align: center;
}

/* Advanced controls, folded away by default. Most people want the official
   length; the few who need a custom one can open this. */
.tweak { margin-top: 14px; }
.tweak summary {
  cursor: pointer;
  color: var(--violet);
  font-size: 0.89rem;
  font-weight: 550;
  padding: 5px 0;
  user-select: none;
}
.tweak summary:hover { text-decoration: underline; }
.tweak[open] summary { margin-bottom: 12px; }

/* Drop zone: a large obvious target, with the native input hidden behind a
   label so it can be styled and still keyboard-accessible. */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 34px 22px;
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--wash);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--indigo); background: #f3f4fd; }
.dropzone strong { font-size: 1rem; color: var(--ink); }
.dropzone span { font-size: 0.87rem; color: var(--ink-faint); }
.dropzone button {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  color: #fff;
  border: 0;
  border-radius: var(--r-sm);
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  box-shadow: 0 2px 8px rgba(91, 110, 225, 0.26);
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(91, 110, 225, 0.32); }
button:disabled { background: #d9dced; color: #9297ae; cursor: not-allowed; box-shadow: none; }

button.secondary {
  background: #fff;
  color: var(--violet);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
button.secondary:hover:not(:disabled) { border-color: var(--violet); background: var(--wash); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.check input { accent-color: var(--indigo); width: 16px; height: 16px; cursor: pointer; }

.hint { color: var(--ink-faint); font-size: 0.87rem; margin: 11px 0 0; }
.hint.error { color: var(--warn); font-weight: 500; }
.muted { color: var(--ink-soft); }
.unit { color: var(--ink-faint); font-size: 0.89rem; }

/* --------------------------------------------------------------- sources */

.sources { display: grid; gap: 9px; margin-top: 15px; }
.source {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  padding: 13px 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--wash);
}
.source strong { font-size: 0.95rem; font-weight: 600; }
.source .meta { color: var(--ink-faint); font-size: 0.86rem; margin-right: auto; }

.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eef0fb;
  color: var(--violet);
}

/* -------------------------------------------------------------- timeline */

.timeline {
  position: relative;
  display: flex;
  height: 52px;
  margin-bottom: 16px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--wash);
  border: 1.5px solid var(--line);
}
.tl-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(91, 110, 225, 0.82), rgba(124, 79, 212, 0.82));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 650;
  min-width: 2px;
  border-right: 2px solid #fff;
}
.tl-seg:last-of-type { border-right: 0; }
.tl-target {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--warn);
}
.tl-target::after {
  content: '';
  position: absolute;
  top: 0; left: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--warn);
}

/* -------------------------------------------------------------- segments */

.segments { display: grid; gap: 11px; margin-bottom: 15px; }
.segment {
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px;
  background: var(--wash);
}
.seg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}
.seg-head strong { font-size: 0.95rem; }
.seg-head button {
  background: transparent;
  color: var(--ink-faint);
  font-size: 1.15rem;
  line-height: 1;
  padding: 3px 9px;
  box-shadow: none;
}
.seg-head button:hover:not(:disabled) {
  color: var(--warn);
  background: var(--warn-wash);
  transform: none;
  box-shadow: none;
}
/* A miniature of the whole track with the kept part shaded. Two time
   fields alone gave no sense of WHERE in the song a section sits, or how
   much was being left out. */
.seg-map {
  position: relative;
  height: 40px;
  margin: 4px 0 5px;
  border-radius: 6px;
  background: repeating-linear-gradient(
    90deg, #e9ebf5 0 6px, #eef0f8 6px 12px);
  overflow: hidden;
}
.seg-map-fill {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border-radius: 5px;
  cursor: grab;
  touch-action: none; /* let pointer drags through instead of scrolling */
}
.seg-map-fill:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
  box-shadow: 0 0 0 3px rgba(91, 110, 225, 0.5);
}
.seg-map.dragging .seg-map-fill { cursor: grabbing; }

/* Edge handles. Wider than they look, because trimming on a phone with a
   thumb needs a target far bigger than the 3px line it appears to be. */
.grip {
  position: absolute;
  top: 0; bottom: 0;
  width: 18px;
  cursor: ew-resize;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.grip::after {
  content: '';
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.92);
}
.grip-start { left: -9px; }
.grip-end { right: -9px; }
.grip:hover::after, .seg-map.dragging .grip::after { height: 24px; }
.seg-map-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--ink-faint);
  margin-bottom: 11px;
}

.seg-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.seg-row + .seg-row { margin-top: 8px; }
.seg-row input[type="text"] { width: 6em; }
.seg-len { color: var(--ink-faint); font-size: 0.86rem; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- projects */

.project-list { display: grid; gap: 13px; }
.project {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-1);
  padding: 20px 22px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project:hover { transform: translateY(-2px); box-shadow: var(--lift-2); }
.project h3 { margin: 0 0 6px; font-size: 1.06rem; letter-spacing: -0.012em; }
.project .meta {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.89rem;
  display: flex;
  gap: 11px;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 650;
}
.badge.ok { background: var(--ok-wash); color: var(--ok); }
.badge.warn { background: var(--warn-wash); color: var(--warn); }

.empty {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-1);
  padding: 52px 28px;
  text-align: center;
}
.empty h3 { margin: 0 0 7px; font-size: 1.1rem; }
.empty p { margin: 0 0 20px; color: var(--ink-soft); }

/* --------------------------------------------------------------- loading */

.spinner {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(91, 110, 225, 0.22);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
  vertical-align: -3px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; gap: 12px; flex-wrap: wrap; }
  .whoami { display: none; }
  main { padding: 4px 16px 56px; }
  .panel { padding: 20px 18px; border-radius: 14px; }
  .hero { padding: 38px 0 32px; }
  .duration { padding: 20px 18px; }
  .duration .big { font-size: 2.5rem; }
  .duration .target { margin-left: 0; width: 100%; }
  /* Comfortable touch targets at the boards. */
  button { padding: 12px 18px; }
}
