/* ==========================================================================
   PTNS · ODTÜ araştırma anketi — main.css
   Character: a university research instrument. Quiet paper, academic
   navy for actions, METU red only for signals, a serif for reading and a
   four-step progress rail so participants always know where they are.
   ========================================================================== */

/* ---------------------------------- Tokens ------------------------------- */
:root {
  /* Color */
  --canvas:      #f6f5f2;
  --surface:     #ffffff;
  --ink:         #1c1f24;
  --ink-mute:    #5b616b;
  --accent:      #1f3b5a;
  --accent-ink:  #ffffff;
  --accent-soft: #e8eef5;
  --signal:      #e31937;
  --pick:        #fff4cf;
  --pick-edge:   #d9a400;
  --hairline:    #e2e0da;
  --success:     #1f7a45;
  --error:       #b3261e;
  --focus:       #2f6db3;

  /* Type */
  --font-display: "IBM Plex Serif", Georgia, serif;
  --font-body:    "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --size-body:    17px;

  /* Space */
  --space-xs:   8px;
  --space-sm:   12px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-xxl:  48px;
  --space-huge: 72px;

  /* Shape */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-pill: 999px;

  /* Layout */
  --column: 820px;
  --column-wide: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------------------------------- Reset -------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, dl, dd, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------- Typography ------------------------------ */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.display--lg { font-size: clamp(28px, 3.6vw, 38px); line-height: 1.2; }
.display--md { font-size: 22px; line-height: 1.3; }
.display--sm { font-size: 18px; line-height: 1.35; }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal);
}

.lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-mute);
}
.lead strong { color: var(--ink); font-weight: 600; }

.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------- Button -------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 13px 24px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:hover { background: #15293f; border-color: #15293f; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.btn--success { background: var(--success); border-color: var(--success); }
.btn--success:hover { background: #17603a; border-color: #17603a; }

/* ---------------------------------- Nav ---------------------------------- */
.nav {
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  max-width: var(--column-wide);
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
}
.nav__logo { height: 40px; width: auto; }
.nav__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-mute);
  text-align: right;
}

/* ------------------------------ Step rail -------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xs);
  max-width: var(--column);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) 0;
  counter-reset: step;
}
.steps__item {
  counter-increment: step;
  padding-top: var(--space-sm);
  border-top: 3px solid var(--hairline);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mute);
}
.steps__item::before {
  content: counter(step) ". ";
}
.steps__item.is-done { border-top-color: var(--accent); color: var(--accent); }
.steps__item.is-current { border-top-color: var(--signal); color: var(--ink); }

/* --------------------------------- Bands --------------------------------- */
.band {
  padding: var(--space-xl) var(--space-lg) var(--space-huge);
}
.band__inner {
  max-width: var(--column);
  margin: 0 auto;
}
.band__inner > * + * { margin-top: var(--space-lg); }
.band__inner--wide { max-width: var(--column-wide); }

/* ---------------------------------- Sheet -------------------------------- */
/* The paper page every step sits on */
.sheet {
  padding: var(--space-xxl);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.sheet > * + * { margin-top: var(--space-lg); }

.prose { font-family: var(--font-display); font-size: 18px; line-height: 1.75; }
.prose > * + * { margin-top: 1em; }
.prose h2 {
  margin-top: 1.6em;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
}

.contact {
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-family: var(--font-body);
  font-size: 16px;
}

/* --------------------------------- Forms --------------------------------- */
.form > * + * { margin-top: var(--space-lg); }
.divider { border: 0; border-top: 1px solid var(--hairline); }

.field > * + * { margin-top: 6px; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.label {
  display: block;
  font-size: 16px;
  font-weight: 600;
}
.label abbr,
.required { color: var(--signal); text-decoration: none; }

.fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 6px; }
.hint { font-size: 14px; color: var(--ink-mute); }

.input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #cfccc4;
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 109, 179, 0.16);
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.6; }

.suffix {
  display: flex;
}
.suffix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.suffix__unit {
  display: grid;
  place-items: center;
  padding: 0 var(--space-md);
  border: 1px solid #cfccc4;
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--canvas);
  font-size: 15px;
  color: var(--ink-mute);
}

.choices { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 9px 16px;
  border: 1px solid #cfccc4;
  border-radius: var(--radius-pill);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
.choice input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.check {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  padding: var(--space-md);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  font-weight: 600;
  cursor: pointer;
}
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }

.field--invalid .input { border-color: var(--error); }
.field__error { font-size: 14px; font-weight: 600; color: var(--error); }
.field__error[hidden] { display: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding-top: var(--space-md);
}
.actions--end { justify-content: flex-end; }

.notice {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  background: var(--pick);
  font-size: 15px;
}
.notice--error { background: #fbe9e7; color: var(--error); }
.notice[hidden] { display: none; }

/* ------------------------------- Transcript ------------------------------ */
.transcript {
  border-top: 1px solid var(--hairline);
}

.line {
  display: grid;
  grid-template-columns: 110px 1fr 28px;
  gap: var(--space-md);
  align-items: start;
  padding: var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.65;
}
.line__who {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 2;
  color: var(--ink-mute);
}
.line--teacher .line__who { color: var(--accent); }
.line--fixed { color: var(--ink-mute); }

.line--pick {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s var(--ease);
}
.line--pick:hover { background: #faf8f2; }
.line__box {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  border: 1.5px solid #bdb8ad;
  border-radius: 5px;
  background: var(--surface);
}
.line--pick[aria-pressed="true"] {
  background: var(--pick);
  box-shadow: inset 3px 0 0 var(--pick-edge);
}
.line--pick[aria-pressed="true"] .line__box {
  border-color: var(--pick-edge);
  background: var(--pick-edge) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

/* Sticky bar under the transcript with the running count */
.tally {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -8px 24px -18px rgba(0, 0, 0, 0.35);
}
.tally__count { font-weight: 600; }

/* Detail blocks — one per selected line */
.detail {
  padding: var(--space-xl);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.detail > * + * { margin-top: var(--space-md); }
.detail__quote {
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--pick-edge);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--pick);
  font-family: var(--font-display);
  font-style: italic;
}
.term { color: var(--signal); font-weight: 600; }

/* ---------------------------------- Done --------------------------------- */
.done { text-align: center; }
.done__mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  background: #e5f3ea;
  color: var(--success);
}
.done__mark svg { width: 30px; height: 30px; }

/* ---------------------------------- Admin -------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.stat {
  padding: var(--space-lg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.stat__value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__label { font-size: 14px; color: var(--ink-mute); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: space-between;
}
.toolbar__group { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.toolbar .input { width: min(340px, 100%); }

.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
}
.table td { min-width: 110px; }
.table td.is-long { min-width: 280px; }
.table tbody tr:nth-child(even) { background: #fbfaf7; }

/* -------------------------------- Footer --------------------------------- */
.footer__inner {
  max-width: var(--column-wide);
  margin: 0 auto;
  padding: var(--space-lg);
  border-top: 1px solid var(--hairline);
  font-size: 14px;
  color: var(--ink-mute);
  text-align: center;
}

/* ------------------------------ Responsive ------------------------------- */
@media (max-width: 720px) {
  :root { --space-huge: 48px; }
  .band { padding-left: var(--space-md); padding-right: var(--space-md); }
  .sheet { padding: var(--space-lg); }
  .field-row { grid-template-columns: 1fr; }
  .nav__title { display: none; }
  .steps { padding-left: var(--space-md); padding-right: var(--space-md); }
  .steps__item { font-size: 11px; }
  .line { grid-template-columns: 1fr 24px; gap: 4px var(--space-sm); }
  .line__who { grid-column: 1 / -1; line-height: 1.4; }
  .stats { grid-template-columns: 1fr; }
  .detail { padding: var(--space-lg); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
