/* Emad ELT – shared styles. No external fonts or scripts. */
:root {
  --paper: #f4f6fa;
  --ink: #18212f;
  --muted: #586377;
  --line: #d5dbe6;
  --red: #c62836;
  --hi: #ffe66d;
  --blue: #2a4bc7;
  --ok: #176b3f;
  --serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}
a { color: var(--blue); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .5rem 2rem; padding: 1.25rem 0 1rem; border-bottom: 1px solid var(--line);
}
.brand { font: 700 1.4rem/1 var(--serif); color: var(--ink); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.site-header nav a { color: var(--muted); text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover { color: var(--ink); border-bottom-color: var(--hi); }
.site-header nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }

/* ---------- page headings ---------- */
main { padding: clamp(2rem, 6vw, 4rem) 0 3rem; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 700; letter-spacing: -.01em; }
.lead { max-width: 38rem; margin: 1rem 0 0; font-size: 1.15rem; color: var(--muted); }

/* ---------- home: the correction demo ---------- */
.specimen {
  position: relative;
  margin: clamp(1.75rem, 5vw, 3rem) 0 clamp(2.5rem, 6vw, 4rem);
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 3vw, 2rem) 1.5rem clamp(2.75rem, 7vw, 4.5rem);
  background: #fff;
  border: 1px solid var(--line);
}
.specimen::before { /* the red margin line of an exercise book */
  content: ""; position: absolute; top: 0; bottom: 0; left: clamp(1.5rem, 4.5vw, 3rem);
  width: 1px; background: var(--red); opacity: .9;
}
.sentence {
  margin: 0; max-width: 24ch;
  font: 400 clamp(1.9rem, 5.4vw, 3.4rem)/1.25 var(--serif);
}
.w {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer;
  background-image: linear-gradient(var(--red), var(--red));
  background-repeat: no-repeat; background-position: left 58%; background-size: 0 .09em;
  transition: background-size .3s ease, color .3s ease;
}
.w:hover { text-decoration: underline dotted var(--muted); text-underline-offset: .2em; }
.w.struck { background-size: 100% .09em; color: var(--red); cursor: default; text-decoration: none; }
.fix {
  display: inline-block; margin-left: .15em; padding: 0 .2em; border-radius: 2px;
  background: var(--hi); color: var(--ink); font-style: italic;
  animation: appear .25s ease-out;
}
@keyframes appear { from { opacity: 0; transform: translateY(.15em); } to { opacity: 1; transform: none; } }
.demo-note { min-height: 3.2em; margin: 1.25rem 0 0; max-width: 34rem; color: var(--muted); }
.demo-note strong { color: var(--ink); }
.demo-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .75rem; }

.btn {
  font: 600 .95rem/1 var(--sans); padding: .7rem 1.1rem; cursor: pointer;
  background: #fff; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 6px;
}
.btn:hover { background: var(--hi); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--blue); border-color: var(--blue); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn[disabled]:hover { background: #fff; }

/* ---------- home: the three sections ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row > a {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: .25rem 2rem;
  padding: 1.6rem 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none;
}
.row h2 { font-size: 1.7rem; }
.row h2 span { background: linear-gradient(transparent 62%, transparent 62%); transition: background .15s; }
.row > a:hover h2 span, .row > a:focus-visible h2 span { background: linear-gradient(transparent 62%, var(--hi) 62%); }
.row p { margin: 0; color: var(--muted); max-width: 34rem; }
.soon { font-style: italic; color: var(--ink); }

/* ---------- homework page ---------- */
.tool-intro { margin: .75rem 0 1.25rem; color: var(--muted); max-width: 40rem; }
.tool-frame {
  display: block; width: 100%; height: max(46rem, calc(100vh - 9rem));
  border: 1px solid var(--line); background: #fff;
}

/* ---------- exercises ---------- */
.set-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.set-tabs button {
  font: 600 .95rem/1.2 var(--sans); padding: .6rem 1rem; cursor: pointer;
  background: transparent; color: var(--ink); border: 1.5px solid var(--line); border-radius: 6px;
}
.set-tabs button:hover { border-color: var(--ink); }
.set-tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.set-head { margin: 2rem 0 .25rem; }
.set-head h2 { font-size: 1.7rem; }
.set-head p { margin: .35rem 0 0; color: var(--muted); max-width: 38rem; }
.quiz { margin-top: 1.25rem; max-width: 44rem; }
.q { margin: 0 0 1.5rem; padding: 0 0 1.5rem; border: 0; border-bottom: 1px solid var(--line); }
.q legend, .q > label.qtext { font: 600 1.2rem/1.4 var(--serif); padding: 0; margin: 0 0 .6rem; display: block; }
.blank { display: inline-block; min-width: 3.2ch; border-bottom: 2px solid var(--ink); margin: 0 .15em; }
.opt { display: flex; gap: .6rem; align-items: center; padding: .4rem 0; cursor: pointer; }
.opt input { width: 1.15rem; height: 1.15rem; accent-color: var(--blue); }
.q input[type="text"] {
  font: inherit; padding: .55rem .7rem; width: min(100%, 18rem);
  border: 1.5px solid var(--ink); border-radius: 6px; background: #fff; color: var(--ink);
}
.fb { margin: .6rem 0 0; font-size: .98rem; }
.fb.ok strong { color: var(--ok); }
.fb.bad strong { color: var(--red); }
.fb .why { display: block; color: var(--muted); margin-top: .15rem; }
.result { margin: 0 0 1rem; font: 700 1.5rem/1.3 var(--serif); }
.quiz-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- plain pages ---------- */
.plain { max-width: 38rem; }
.plain p { margin: 1rem 0 0; }
.plain ul { margin: 1rem 0 0; padding-left: 1.2rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 1.25rem 0 2.5rem; color: var(--muted); font-size: .92rem; }
.site-footer p { margin: 0; max-width: 40rem; }

@media (max-width: 640px) {
  .site-header nav { gap: .25rem 1rem; font-size: .92rem; }
  .row > a { grid-template-columns: 1fr; }
  .sentence { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .w, .fix { transition: none; animation: none; }
}
