/* ScholarBridge — academic research instrument
   Palette: ink (deep blue), sage (care/health), amber (alert/signal),
   paper (cool off-white), slate (text). Display: Fraunces. Body: Inter. */

:root {
  --ink:    #1b2a4a;
  --ink-2:  #2f4373;
  --sage:   #4f7d6e;
  --sage-2: #6fa493;
  --amber:  #c98a3a;
  --paper:  #f4f3ee;
  --paper-2:#ebe9e0;
  --slate:  #2a2d34;
  --muted:  #6b7280;
  --line:   #d9d6cb;
  --white:  #ffffff;

  --r: 14px;
  --shadow: 0 1px 2px rgba(27,42,74,.06), 0 8px 28px rgba(27,42,74,.08);
  --shadow-sm: 0 1px 2px rgba(27,42,74,.08);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--slate);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink-2); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display);
  font-weight: 600; font-size: 1.25rem; color: var(--ink); letter-spacing: -.01em; }
.brand .mark { width: 34px; height: 34px; }
.topbar nav a { margin-left: 22px; text-decoration: none; color: var(--ink); font-weight: 500;
  font-size: .95rem; }
.topbar nav a:hover { color: var(--sage); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--white); border: none;
  font-family: var(--font-body); font-weight: 600; font-size: 1rem;
  padding: 14px 26px; border-radius: var(--r); cursor: pointer;
  text-decoration: none; transition: transform .15s ease, background .2s ease;
}
.btn:hover { background: var(--ink-2); transform: translateY(-1px); }
.btn.sage { background: var(--sage); }
.btn.sage:hover { background: var(--sage-2); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; }

/* ---------- Hero ---------- */
.hero { padding: 86px 0 60px; }
.eyebrow { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--sage); font-weight: 600; margin-bottom: 18px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.7rem); line-height: 1.05;
  color: var(--ink); letter-spacing: -.02em; max-width: 16ch;
}
.hero h1 em { font-style: italic; color: var(--sage); }
.hero p.lede { font-size: 1.2rem; color: var(--ink-2); margin-top: 24px; max-width: 56ch; }
.hero .actions { margin-top: 36px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- Bridge signature ---------- */
.bridge-figure { margin: 64px auto 0; max-width: 880px; }
.bridge-figure svg { width: 100%; height: auto; display: block; }
.bridge-caption { text-align: center; color: var(--muted); font-size: .9rem;
  margin-top: 14px; font-style: italic; }

/* ---------- Cards / principles ---------- */
.section { padding: 64px 0; }
.section h2 { font-family: var(--font-display); font-size: 2rem; color: var(--ink);
  font-weight: 600; letter-spacing: -.01em; margin-bottom: 10px; }
.section .sub { color: var(--muted); max-width: 60ch; margin-bottom: 36px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r); padding: 28px; box-shadow: var(--shadow-sm);
}
.card .num { font-family: var(--font-display); font-size: 1.1rem; color: var(--sage);
  font-weight: 600; }
.card h3 { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink);
  margin: 10px 0 8px; font-weight: 600; }
.card p { color: var(--slate); font-size: .96rem; }

/* ---------- Ethics banner ---------- */
.ethics { background: var(--sage); color: #eef5f1; border-radius: var(--r);
  padding: 30px 34px; display: flex; gap: 20px; align-items: flex-start; }
.ethics svg { flex: none; margin-top: 2px; }
.ethics h3 { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 6px; }
.ethics p { font-size: .98rem; opacity: .95; }

/* ---------- Survey ---------- */
.survey-head { padding: 48px 0 8px; }
.survey-head h1 { font-family: var(--font-display); font-size: 2.3rem; color: var(--ink);
  font-weight: 600; }
.survey-head p { color: var(--muted); margin-top: 10px; }

.progress-rail { position: sticky; top: 73px; background: var(--paper); z-index: 10;
  padding: 16px 0; border-bottom: 1px solid var(--line); }
.progress-bar { height: 6px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--sage); transition: width .35s ease; }
.progress-label { font-size: .82rem; color: var(--muted); margin-top: 8px; }

.q-block { background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  padding: 26px 28px; margin: 20px 0; box-shadow: var(--shadow-sm); }
.q-block legend, .q-block .q-text {
  font-family: var(--font-body); font-weight: 600; font-size: 1.05rem; color: var(--ink);
  margin-bottom: 16px; display: block;
}
.q-block .hint { font-weight: 400; color: var(--muted); font-size: .9rem; display: block; margin-top: 4px; }

.likert { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.likert label {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 14px 8px;
  cursor: pointer; text-align: center; font-size: .82rem; color: var(--slate);
  transition: all .15s ease; background: var(--paper);
}
.likert input { position: absolute; opacity: 0; width: 0; height: 0; }
.likert label:hover { border-color: var(--sage-2); }
.likert input:checked + .dot { background: var(--sage); border-color: var(--sage); }
.likert .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted);
  display: inline-block; transition: all .15s ease; }
.likert label:has(input:checked) { border-color: var(--sage); background: #eef5f1; color: var(--ink); font-weight: 600; }
.likert label:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice-row label { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 18px;
  cursor: pointer; background: var(--paper); font-weight: 500; transition: all .15s ease; }
.choice-row label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: var(--white); }
.choice-row input { position: absolute; opacity: 0; }
.choice-row label:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

.field { margin-bottom: 18px; }
.field label.lbl { display: block; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--slate);
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--white);
}
textarea { min-height: 96px; resize: vertical; }
select:focus, textarea:focus { outline: none; border-color: var(--sage); }

.submit-row { margin: 28px 0 80px; display: flex; align-items: center; gap: 16px; }
.note-inline { color: var(--muted); font-size: .85rem; }

/* ---------- Dashboard ---------- */
.dash-head { padding: 40px 0 20px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.dash-head h1 { font-family: var(--font-display); font-size: 2.1rem; color: var(--ink); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 8px 0 30px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow-sm); }
.kpi .val { font-family: var(--font-display); font-size: 2.4rem; color: var(--ink); font-weight: 600; line-height: 1; }
.kpi .lbl { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.kpi.alert .val { color: var(--amber); }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  padding: 26px; box-shadow: var(--shadow-sm); margin-bottom: 22px; }
.panel h3 { font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); margin-bottom: 4px; font-weight: 600; }
.panel .panel-sub { color: var(--muted); font-size: .88rem; margin-bottom: 18px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

.comment-item { border-left: 3px solid var(--sage); padding: 10px 0 10px 16px; margin-bottom: 14px; }
.comment-item .role { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sage); font-weight: 600; }
.comment-item p { color: var(--slate); font-size: .94rem; margin-top: 4px; }

footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); font-size: .88rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .likert { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .likert label { padding: 10px 2px; font-size: .68rem; }
  .section { padding: 44px 0; }
  .hero { padding: 56px 0 40px; }
}

/* Phone layout — the primary target for respondents */
@media (max-width: 600px) {
  .wrap { padding: 0 18px; }

  /* Header: stack the brand and nav cleanly instead of overlapping */
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 18px; }
  .topbar nav { display: flex; gap: 0; }
  .topbar nav a { margin-left: 0; margin-right: 20px; font-size: .9rem; }
  .brand { font-size: 1.15rem; }

  /* Sticky progress sits just under a taller stacked header */
  .progress-rail { top: 0; position: relative; }

  .hero h1 { font-size: 2rem; }
  .hero p.lede { font-size: 1.05rem; }
  .hero .actions { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; width: 100%; padding: 15px 20px; }

  .survey-head h1 { font-size: 1.7rem; }
  .q-block { padding: 20px 16px; }

  /* Likert as full-width stacked rows: big, thumb-friendly tap targets */
  .likert { grid-template-columns: 1fr; gap: 8px; }
  .likert label { flex-direction: row; justify-content: flex-start; gap: 14px;
    padding: 14px 16px; font-size: .95rem; min-height: 52px; }

  .choice-row label { flex: 1 1 100%; text-align: center; padding: 14px; }

  .kpis { grid-template-columns: 1fr; gap: 12px; }
  .ethics { flex-direction: column; gap: 12px; padding: 24px 22px; }
  .dash-head { flex-direction: column; align-items: stretch; }
  .dash-head .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
