/* WriteReady links page: a WriteReady answer sheet on a desk. */

:root {
  --desk: #e9ecf2;
  --sheet: #ffffff;
  --ink: #4f46e5;
  --ink-fg: #ffffff;
  --ink-sub: rgba(255, 255, 255, 0.88);
  --wash: #eef2ff;
  --wash-fg: #4f46e5;
  --wash-soft: #f5f6ff;
  --gold: #f59e0b;
  --text: #0f172a;
  --text-2: #475569;
  --hair: #e2e8f0;
  --hair-strong: #cbd5e1;
  --rule: rgba(79, 70, 229, 0.16);
  --margin-rule: rgba(79, 70, 229, 0.3);
  --reg: #0f172a;
  --inset: #f8fafc;
  --player: #120f2e;
  --sheet-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 18px 48px -12px rgba(15, 23, 42, 0.18);
  --lift: 0 4px 16px rgba(15, 23, 42, 0.1);
  --primary-well: rgba(255, 255, 255, 0.16);
  --primary-shadow: 0 6px 16px -8px rgba(15, 23, 42, 0.35);
  --primary-shadow-hover: 0 10px 22px -10px rgba(15, 23, 42, 0.4);

  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --hand: "Kalam", "Inter", cursive;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--hair-strong) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--ink);
  overflow-x: hidden;
}

::selection { background: var(--wash); color: var(--wash-fg); }

a { color: inherit; }

h1, h2, p, dl, dd, ol { margin: 0; }
ol { padding: 0; list-style: none; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

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

/* ---------- Desk and sheet ---------- */

.desk {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  z-index: 0;
}

.sheet {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100% - 16px));
  margin: 132px auto 0;
  padding: 18px 16px 28px;
  background: var(--sheet);
  border-radius: 4px;
  box-shadow: var(--sheet-shadow);
}

@media (min-width: 480px) {
  .sheet { padding: 20px 28px 36px; }
}

@media (min-width: 1180px) {
  .sheet {
    margin-top: 56px;
    padding: 24px 48px 44px;
  }
}

/* OMR registration marks, the black squares every answer sheet carries */
.reg {
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--reg);
}
.reg--tl { top: 10px; left: 10px; }
.reg--tr { top: 10px; right: 10px; }
.reg--bl { bottom: 10px; left: 10px; }
.reg--br { bottom: 10px; right: 10px; }

.sheet-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* ---------- Header: logo, name, candidate fields ---------- */

.head {
  text-align: center;
  padding-top: 20px;
}

.logo {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0 auto 14px;
}
.logo-flat {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 25px;
  box-shadow: 0 10px 24px -10px rgba(15, 23, 42, 0.45);
  transition: opacity 300ms var(--ease-out);
}
.logo-3d {
  position: absolute;
  left: -40px;
  top: -40px;
  width: 192px;
  height: 192px;
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
  cursor: pointer;
  touch-action: manipulation;
}
.logo.is-3d .logo-flat { opacity: 0; }
.logo.is-3d .logo-3d { opacity: 1; }

h1 {
  font-size: clamp(30px, 7.4vw, 42px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.lede {
  max-width: 34ch;
  margin: 10px auto 0;
  color: var(--text-2);
  font-size: 16px;
  text-wrap: balance;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin-top: 26px;
  text-align: left;
}
.field--date { grid-column: 1 / -1; }

@media (min-width: 560px) {
  .fields { grid-template-columns: 1fr 1fr auto; }
  .field--date { grid-column: auto; }
}

.field dt {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.box {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--hair-strong);
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
}
.box--hand {
  font-family: var(--hand);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  padding-top: 4px;
}

.digits {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 44px;
}
.digits span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 44px;
  border: 1px solid var(--hair-strong);
  border-radius: 4px;
  font-family: var(--hand);
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  padding-top: 3px;
}
.digits i {
  width: 6px;
  height: 1px;
  margin: 0 2px;
  background: var(--hair-strong);
}

/* ---------- Answer lines ---------- */

.answers { margin-top: 30px; }

.lines { border-top: 1px solid var(--rule); }

.line {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  min-height: 72px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.line:focus-visible { outline: none; }

.line-no {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--margin-rule);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.tick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -16px 0 0 -13px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset 420ms var(--ease-out), opacity 0s linear 420ms;
}

.line-body {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 8px 8px;
  padding: 10px 10px 10px 8px;
  border-radius: 10px;
  transition: background-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.well {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--wash);
  color: var(--wash-fg);
  flex: none;
}

.line-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.line-title {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.line-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.arrow {
  margin-left: auto;
  color: var(--text-2);
  transition: transform 180ms var(--ease-out);
}

.line--primary .line-body {
  background: var(--ink);
  color: var(--ink-fg);
  box-shadow: var(--primary-shadow);
}
.line--primary .well { background: var(--primary-well); color: var(--ink-fg); }
.line--primary .line-sub,
.line--primary .arrow { color: var(--ink-sub); }

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

@media (hover: hover) {
  .line:not(.line--primary):hover .line-body { background: var(--wash-soft); }
  .line--primary:hover .line-body { transform: translateY(-1px); box-shadow: var(--primary-shadow-hover); }
  .line:hover .arrow { transform: translate(2px, -2px); }
  .line:hover .tick { stroke-dashoffset: 0; opacity: 1; transition: stroke-dashoffset 420ms var(--ease-out), opacity 0s; }
}
.line:focus-visible .tick,
.line:active .tick,
.line.is-ticked .tick { stroke-dashoffset: 0; opacity: 1; transition: stroke-dashoffset 420ms var(--ease-out), opacity 0s; }

@media (min-width: 480px) {
  .line { grid-template-columns: 40px 1fr; }
  .line-body { gap: 14px; margin-left: 10px; padding: 10px 14px 10px 10px; }
  .well { width: 38px; height: 38px; }
}
.line:active .line-body { transform: scale(0.99); }

/* ---------- Tasks ---------- */

.task { margin-top: 44px; }

.task h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.task-no {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin-right: 10px;
  padding: 0 10px;
  border-radius: 4px;
  vertical-align: 3px;
  background: var(--text);
  color: var(--sheet);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.instr {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-2);
}
.num {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.task-box {
  margin-top: 16px;
  padding: 8px;
  border: 1px solid var(--hair-strong);
  border-radius: 14px;
}

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--player);
}
.player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--player);
}

.play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.play:focus-visible { outline-offset: -4px; border-radius: 8px; }

.play-btn {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 10px 30px -6px rgba(10, 8, 30, 0.55);
  transition: transform 220ms var(--ease-out);
}
.play-btn svg { width: 26px; height: 26px; fill: currentColor; margin-left: 4px; }
@media (hover: hover) {
  .play:hover .play-btn { transform: scale(1.06); }
}
.play:active .play-btn { transform: scale(0.96); }

.chip {
  position: absolute;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(10, 8, 30, 0.72);
  font-size: 12px;
  font-weight: 600;
}
.chip--time {
  left: 10px;
  font-family: var(--mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.chip--lang { right: 10px; }

.player.is-playing .play { display: none; }

.task-note {
  max-width: 62ch;
  margin-top: 14px;
  font-size: 15px;
  color: var(--text-2);
}

.task-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent);
  transition: text-decoration-color 160ms var(--ease-out);
}
.task-link .icon { width: 16px; height: 16px; }
.task-link:hover { text-decoration-color: currentColor; }

/* ---------- Examiner box ---------- */

.examiner {
  margin-top: 48px;
  padding: 20px;
  border: 1px solid var(--hair-strong);
  border-radius: 14px;
  background: var(--inset);
}
@media (min-width: 560px) {
  .examiner { padding: 24px 28px 28px; }
}

.examiner-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.examiner-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--sheet);
  border: 1px solid var(--hair);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.marks {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
@media (min-width: 560px) {
  .marks { grid-template-columns: 1fr 148px; gap: 20px; }
}

.criteria { display: grid; gap: 8px; }
.crit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding-left: 12px;
  border-radius: 8px;
  background: var(--sheet);
  border: 1px solid var(--hair);
}
.crit dt { font-size: 14px; font-weight: 500; }
.crit dd {
  display: grid;
  place-items: center;
  align-self: stretch;
  flex: none;
  width: 60px;
  border-left: 1px solid var(--hair);
}

.hand {
  display: inline-block;
  font-family: var(--hand);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  padding-top: 4px;
}

.overall {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  padding: 12px;
  border-radius: 8px;
  background: var(--sheet);
  border: 1px solid var(--hair);
}
.overall-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.overall-score {
  position: relative;
  display: grid;
  place-items: center;
  width: 120px;
  height: 80px;
}
.hand--big { font-size: 46px; }
.ring {
  position: absolute;
  inset: 0;
  width: 120px;
  height: 80px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.examiner-note {
  max-width: 52ch;
  margin-top: 18px;
  font-size: 15px;
  color: var(--text-2);
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  margin-top: 18px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--ink-fg);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--primary-shadow);
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
@media (min-width: 560px) {
  .cta { display: inline-flex; padding: 0 22px; }
}
@media (hover: hover) {
  .cta:hover { transform: translateY(-1px); box-shadow: var(--primary-shadow-hover); }
}
.cta:active { transform: scale(0.99); }

/* Marks are written in when the box scrolls into view (JS only, motion allowed) */
@media (prefers-reduced-motion: no-preference) {
  .js .examiner:not(.is-marked) .hand { clip-path: inset(-10% 100% -10% 0); }
  .js .examiner:not(.is-marked) .ring { stroke-dashoffset: 1; opacity: 0; }
  .js .examiner .hand {
    transition: clip-path 520ms var(--ease-out);
    transition-delay: calc(var(--i) * 220ms + 150ms);
  }
  .js .examiner .ring {
    transition: stroke-dashoffset 700ms var(--ease-out) 1300ms, opacity 0s linear 1300ms;
  }
}

/* ---------- Footer ---------- */

.foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 28px 16px 160px;
  font-size: 13px;
  color: var(--text-2);
}
.foot a { text-underline-offset: 3px; text-decoration-color: var(--hair-strong); }
.foot a:hover { color: var(--text); }

@media (min-width: 1180px) {
  .foot { padding-bottom: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
}
