/* ============================================================
   ATLASQ
   MedAtlas Learning Minds
   Presentation Layer
   ============================================================ */


/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  --bg: #071018;
  --bg-soft: #0b151f;

  --surface: rgba(14, 25, 36, 0.92);
  --surface-raised: rgba(19, 31, 43, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.035);

  --border: rgba(190, 205, 217, 0.13);
  --border-strong: rgba(190, 205, 217, 0.22);

  --ink: #f4f6f4;
  --ink-soft: #d9e0e4;
  --muted: #8e9ca8;

  --brand: #b8d1dc;
  --brand-strong: #d2e2e8;
  --brand-deep: #7595a5;

  --gold: #c6aa71;
  --gold-soft: rgba(198, 170, 113, 0.14);

  --success: #75c49a;
  --danger: #df8d8d;

  --shadow:
    0 28px 70px rgba(0, 0, 0, 0.30);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;

  --max-width: 1480px;
}


/* ============================================================
   DAY THEME
   ============================================================ */

html[data-theme="day"] {
  --bg: #f3f1eb;
  --bg-soft: #ebe8e0;

  --surface: rgba(255, 255, 255, 0.88);
  --surface-raised: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(20, 38, 51, 0.035);

  --border: rgba(31, 50, 62, 0.11);
  --border-strong: rgba(31, 50, 62, 0.18);

  --ink: #17232b;
  --ink-soft: #354651;
  --muted: #687985;

  --brand: #315363;
  --brand-strong: #203f4e;
  --brand-deep: #668594;

  --shadow:
    0 24px 60px rgba(32, 46, 54, 0.11);
}


/* ============================================================
   RESET
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--ink);

  background:
    radial-gradient(
      circle at 70% -10%,
      rgba(127, 158, 173, 0.14),
      transparent 36%
    ),
    linear-gradient(
      180deg,
      var(--bg-soft),
      var(--bg)
    );

  transition:
    background 0.25s ease,
    color 0.25s ease;

  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}


/* ============================================================
   TOP BAR
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;

  min-height: 78px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px max(24px, calc((100vw - var(--max-width)) / 2));

  border-bottom: 1px solid var(--border);

  background:
    color-mix(in srgb, var(--bg) 84%, transparent);

  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border: 1px solid var(--border-strong);
  border-radius: 50%;

  color: var(--brand-strong);
  background: var(--surface-soft);

  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 600;

  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.015);
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-parent {
  color: var(--muted);

  font-size: 10px;
  font-weight: 700;

  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.brand-copy strong {
  margin-top: 2px;

  color: var(--ink);
  font-size: 21px;
  letter-spacing: -0.025em;
}

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

.nav a,
.theme-btn {
  padding: 9px 12px;

  border: 1px solid transparent;
  border-radius: 11px;

  color: var(--muted);
  background: transparent;

  font-size: 13px;
  font-weight: 600;

  transition: 0.18s ease;
}

.nav a:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.theme-btn {
  margin-left: 5px;
  border-color: var(--border);
  color: var(--ink-soft);
}

.theme-btn:hover {
  background: var(--surface-soft);
}


/* ============================================================
   PAGE
   ============================================================ */

.wrap {
  width: min(
    var(--max-width),
    calc(100% - 42px)
  );

  margin: 0 auto;
  padding: 46px 0 80px;
}

.page-intro {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: flex-end;

  padding: 14px 2px 34px;
}

.eyebrow,
.section-kicker {
  display: block;

  color: var(--brand-deep);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.page-intro h1 {
  margin: 7px 0 8px;

  color: var(--ink);

  font-size: clamp(46px, 6vw, 78px);
  line-height: 0.96;

  letter-spacing: -0.055em;
}

.page-lead {
  max-width: 700px;

  margin: 0;

  color: var(--muted);

  font-size: 17px;
  line-height: 1.65;
}

.system-state {
  display: flex;
  align-items: center;
  gap: 9px;

  flex: none;

  padding: 10px 13px;

  border: 1px solid var(--border);
  border-radius: 999px;

  color: var(--ink-soft);
  background: var(--surface-soft);

  font-size: 12px;
  font-weight: 700;
}

.state-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;
  background: var(--success);

  box-shadow:
    0 0 10px rgba(117, 196, 154, 0.45);
}


/* ============================================================
   CARDS
   ============================================================ */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);

  background: var(--surface);

  box-shadow: var(--shadow);

  backdrop-filter: blur(20px);
}

.workspace {
  display: grid;

  grid-template-columns:
    minmax(330px, 410px)
    minmax(0, 1fr);

  gap: 24px;

  align-items: stretch;
}


/* ============================================================
   BUILDER
   ============================================================ */

.builder {
  padding: 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;

  align-items: flex-start;
}

.builder h2,
.runtime h2,
.analytics-card h3 {
  margin: 5px 0 0;

  color: var(--ink);
  letter-spacing: -0.025em;
}

.builder h2 {
  font-size: 27px;
}

.section-copy {
  margin: 13px 0 26px;

  color: var(--muted);

  font-size: 14px;
  line-height: 1.6;
}

.field {
  margin-bottom: 17px;
}

.field label {
  display: block;

  margin-bottom: 7px;

  color: var(--muted);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

select,
input {
  width: 100%;

  padding: 13px 14px;

  border: 1px solid var(--border);
  border-radius: 13px;

  outline: none;

  color: var(--ink);
  background: var(--surface-soft);

  transition: 0.18s ease;
}

select:focus,
input:focus {
  border-color: var(--brand-deep);

  box-shadow:
    0 0 0 3px rgba(117, 149, 165, 0.10);
}

select option {
  color: #17232b;
  background: #ffffff;
}

.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.primary-btn,
.secondary-btn,
.complete-btn {
  border: 0;
  border-radius: 13px;

  font-weight: 800;

  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    background 0.18s ease;
}

.primary-btn {
  width: 100%;

  padding: 14px 18px;

  color: #10212a;

  background:
    linear-gradient(
      135deg,
      #dce8ec,
      #a8c0cb
    );
}

html[data-theme="day"] .primary-btn {
  color: #ffffff;

  background:
    linear-gradient(
      135deg,
      #315363,
      #527586
    );
}

.primary-btn:hover,
.secondary-btn:hover,
.complete-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.secondary-btn {
  padding: 13px 18px;

  color: var(--ink);

  border: 1px solid var(--border-strong);

  background: var(--surface-soft);
}

.complete-btn {
  padding: 13px 18px;

  color: var(--gold);

  border: 1px solid rgba(198, 170, 113, 0.32);

  background: var(--gold-soft);
}


/* ============================================================
   QAVA
   ============================================================ */

.qava-stage {
  position: relative;

  min-height: 590px;

  display: grid;

  grid-template-columns:
    minmax(260px, 0.85fr)
    minmax(340px, 1.15fr);

  align-items: center;

  gap: 20px;

  padding: 42px;

  overflow: hidden;
}

.qava-stage::before {
  content: "";

  position: absolute;

  width: 560px;
  height: 560px;

  right: -150px;
  top: -190px;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(166, 198, 210, 0.12),
      transparent 68%
    );
}

.qava-copy {
  position: relative;
  z-index: 3;
}

.qava-copy h2 {
  margin: 8px 0 12px;

  font-size: clamp(60px, 8vw, 106px);

  line-height: 0.9;
  letter-spacing: -0.075em;
}

.qava-copy p {
  max-width: 470px;

  margin: 0;

  color: var(--muted);

  line-height: 1.7;
}

.engine-status {
  margin-top: 28px;

  padding: 13px 15px;

  border-left: 2px solid var(--brand-deep);

  color: var(--ink-soft);
  background: var(--surface-soft);

  font-size: 13px;
  line-height: 1.5;
}

.qava-visual {
  position: relative;

  width: min(100%, 420px);
  aspect-ratio: 1;

  margin: auto;

  display: grid;
  place-items: center;
}

.qava-core {
  position: relative;
  z-index: 4;

  width: 280px;
  height: 280px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background:
    radial-gradient(
      circle at 34% 26%,
      rgba(255,255,255,0.92),
      rgba(203, 220, 226, 0.76) 12%,
      rgba(105, 139, 154, 0.76) 36%,
      rgba(29, 49, 60, 0.98) 72%
    );

  box-shadow:
    0 24px 70px rgba(0,0,0,0.30),
    inset -30px -36px 65px rgba(0,0,0,0.34);

  animation:
    qavaPulse 5s ease-in-out infinite;
}

.qava-inner {
  text-align: center;
}

.qava-inner > span {
  color: rgba(255,255,255,0.82);

  font-size: 13px;
  font-weight: 800;

  letter-spacing: 0.18em;
}

.qava-inner .score {
  margin-top: 5px;

  color: #ffffff;

  font-size: 74px;
  font-weight: 800;

  line-height: 0.94;

  letter-spacing: -0.07em;
}

.qava-inner .status {
  margin-top: 12px;

  color: #cfe7da;

  font-size: 11px;
  font-weight: 800;

  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.qava-ring {
  position: absolute;

  border-radius: 50%;
}

.qava-ring-one {
  inset: 34px;

  border:
    1px solid
    rgba(156, 187, 199, 0.18);

  animation:
    rotateQava 22s linear infinite;
}

.qava-ring-two {
  inset: 6px;

  border:
    1px dashed
    rgba(156, 187, 199, 0.14);

  animation:
    rotateQava 34s linear infinite reverse;
}


/* ============================================================
   METRICS
   ============================================================ */

.validator-row {
  margin-top: 22px;

  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px;
}

.metric-card {
  min-height: 112px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  padding: 19px 20px;

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  background: var(--surface);
}

.metric-label {
  color: var(--muted);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-card b {
  color: var(--ink);

  font-size: 25px;
  letter-spacing: -0.035em;
}


/* ============================================================
   QUESTION RUNTIME
   ============================================================ */

.runtime {
  margin-top: 24px;
  padding: 30px;
}

.runtime-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;

  align-items: flex-start;

  padding-bottom: 21px;

  border-bottom: 1px solid var(--border);
}

.runtime h2 {
  font-size: 25px;
}

.timer-display {
  padding: 9px 12px;

  border: 1px solid var(--border);
  border-radius: 999px;

  color: var(--gold);
  background: var(--gold-soft);

  font-size: 12px;
  font-weight: 800;
}

.question-meta {
  margin-top: 24px;

  color: var(--muted);

  font-size: 12px;
  font-weight: 700;
}

.question {
  max-width: 1080px;

  margin-top: 15px;

  color: var(--ink);

  font-size: 21px;
  line-height: 1.58;
}

.answers {
  margin-top: 26px;

  display: grid;
  gap: 11px;
}

.answer {
  position: relative;

  padding: 16px 17px;

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  color: var(--ink-soft);
  background: var(--surface-soft);

  cursor: pointer;

  transition: 0.16s ease;
}

.answer:hover {
  color: var(--ink);

  border-color: var(--border-strong);

  background:
    rgba(126, 158, 173, 0.08);
}

.answer.selected {
  border-color: var(--brand-deep);

  background:
    rgba(117, 149, 165, 0.14);
}

.answer.correct {
  border-color:
    rgba(117, 196, 154, 0.50);

  background:
    rgba(117, 196, 154, 0.10);
}

.answer.incorrect {
  border-color:
    rgba(223, 141, 141, 0.50);

  background:
    rgba(223, 141, 141, 0.09);
}

.runtime-btn {
  margin-top: 22px;
}

.rationale-box {
  margin-top: 26px;

  padding: 23px;

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  background: var(--surface-soft);
}

.answer-result {
  margin-bottom: 20px;

  color: var(--ink);
  line-height: 1.65;
}

.rationale-box h3 {
  margin: 0 0 9px;

  color: var(--gold);

  font-size: 15px;

  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rationale-box p {
  margin: 0;

  color: var(--ink-soft);

  line-height: 1.7;
}

.reference {
  margin-top: 18px;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.6;
}

.runtime-actions {
  margin-top: 24px;

  display: flex;
  gap: 11px;

  flex-wrap: wrap;
}


/* ============================================================
   ANALYTICS
   ============================================================ */

.analytics {
  margin-top: 24px;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.analytics-card {
  padding: 24px;
}

.analytics-card h3 {
  margin-top: 5px;

  font-size: 20px;
}

.analytics-card ul {
  margin: 20px 0 0;

  padding-left: 19px;

  color: var(--muted);

  line-height: 1.85;
}


/* ============================================================
   MOTION
   ============================================================ */

@keyframes rotateQava {
  to {
    transform: rotate(360deg);
  }
}

@keyframes qavaPulse {
  50% {
    transform: scale(1.025);
  }
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {

  .workspace {
    grid-template-columns: 1fr;
  }

  .qava-stage {
    min-height: auto;

    grid-template-columns: 1fr 1fr;
  }

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

  .analytics {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 760px) {

  .topbar {
    position: relative;

    align-items: flex-start;

    gap: 16px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .nav a {
    display: none;
  }

  .wrap {
    width: min(
      100% - 24px,
      var(--max-width)
    );

    padding-top: 28px;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    gap: 15px;
  }

  .qava-stage {
    grid-template-columns: 1fr;

    padding: 28px 22px;
  }

  .qava-visual {
    width: 320px;
    max-width: 100%;
  }

  .qava-core {
    width: 220px;
    height: 220px;
  }

  .qava-inner .score {
    font-size: 59px;
  }

  .builder-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .validator-row {
    grid-template-columns: 1fr;
  }

  .runtime {
    padding: 22px;
  }

  .runtime-top {
    flex-direction: column;
  }

  .question {
    font-size: 18px;
  }

  .runtime-actions {
    flex-direction: column;
  }

  .secondary-btn,
  .complete-btn {
    width: 100%;
  }
}
