/* ============================================================
   Lingadoo Reading Worksheets — Shared Stylesheet
   A4, print-first, Reading Comprehension format
   Extends the Lingadoo grammar-worksheet design language.
   ============================================================ */

/* --- CSS Variables ----------------------------------------- */

:root {
  --ws-ink:          #111111;
  --ws-ink-2:        #333333;
  --ws-muted:        #555555;
  --ws-light:        #888888;
  --ws-rule:         #cccccc;
  --ws-rule-light:   #dddddd;
  --ws-bg-soft:      #f4f4f4;
  --ws-bg-notice:    #f8f8f8;
  --ws-accent:       #2F6BFF; /* Lingadoo blue — toolbar/reveal only */

  --ws-font:         'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ws-mono:         'Courier New', Courier, monospace;

  --ws-body-size:    10.5pt;
  --ws-text-size:    9.5pt;   /* article body slightly smaller */
  --ws-small:        9pt;
  --ws-tiny:         7.5pt;
  --ws-label-size:   7.5pt;

  --ws-lh:           1.55;
  --ws-lh-text:      1.65;   /* reading text needs slightly more air */

  --ws-gap-section:  14px;
  --ws-gap-item:     10px;
  --ws-page-pad-v:   1.8cm;
  --ws-page-pad-h:   1.9cm;
  --ws-page-pad-bot: 1.6cm;
}

/* --- Page setup ------------------------------------------- */

@page {
  size: A4;
  margin: 0;
}

/* --- Reset & base ----------------------------------------- */

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

html {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body {
  font-family: var(--ws-font);
  font-size: var(--ws-body-size);
  color: var(--ws-ink);
  line-height: var(--ws-lh);
  background-color: #FBF6E9;
  background-image:
    repeating-linear-gradient(2deg, rgba(115, 91, 59, .018) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg, rgba(255,255,255,.15) 0 1px, transparent 1px 11px),
    radial-gradient(ellipse at 16% 19%, rgba(230, 174, 47, .055) 0 1px, transparent 1.7px),
    radial-gradient(ellipse at 78% 67%, rgba(91, 70, 43, .04) 0 .8px, transparent 1.5px),
    linear-gradient(105deg, rgba(255,255,255,.08), transparent 38%, rgba(126,98,62,.025));
  background-repeat: repeat, repeat, repeat, repeat, no-repeat;
  background-size: auto, auto, 23px 21px, 31px 29px, 100% 100%;
  background-attachment: fixed;
}

/* --- A4 page simulation (screen) -------------------------- */

@media screen {
  .page {
    width: 210mm;
    min-height: 297mm;
    margin: 24px auto;
    padding: var(--ws-page-pad-v) var(--ws-page-pad-h) var(--ws-page-pad-bot);
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  }

  body {
    padding: 70px 0 48px; /* room for fixed toolbar */
  }
}

@media print {
  body {
    background: white;
  }

  .page {
    width: 100%;
    height: 297mm;
    overflow: hidden;
    margin: 0;
    padding: var(--ws-page-pad-v) var(--ws-page-pad-h) var(--ws-page-pad-bot);
    box-shadow: none;
  }

  .no-print {
    display: none;
  }
}

/* ============================================================
   TEACHER TOOLBAR  (screen only)
   ============================================================ */

.ws-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: #f0f6ff;
  border-bottom: 1px solid #dce8f8;
  height: 42px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ws-font);
}

.ws-toolbar-label {
  font-size: 8pt;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-right: 4px;
}

.ws-toolbar-hint {
  margin-left: auto;
  font-size: 8pt;
  color: #94a3b8;
}

.ws-toolbar-btn {
  padding: 5px 13px;
  font-size: 9pt;
  font-weight: 600;
  font-family: inherit;
  border-radius: 3px;
  border: 1px solid #c7d8f0;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.ws-toolbar-btn:hover {
  background: #e8f0fc;
  border-color: #a8c0e8;
  color: #1e3a5f;
}

.ws-toolbar-btn.primary {
  background: var(--ws-accent);
  border-color: var(--ws-accent);
  color: #fff;
}

.ws-toolbar-btn.primary:hover {
  background: #1a54e8;
  border-color: #1a54e8;
}

@media print {
  .ws-toolbar { display: none; }
}

/* --- Page break helpers ----------------------------------- */

.page-break-before { page-break-before: always; break-before: page; }
.page-break-after  { page-break-after:  always; break-after:  page; }
.avoid-break       { page-break-inside: avoid;  break-inside: avoid; }

/* ============================================================
   HEADER
   ============================================================ */

.ws-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2.5px solid var(--ws-ink);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.ws-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ws-logo img {
  height: 30px;
  display: block;
}

.ws-logo-fallback {
  font-size: 16pt;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ws-ink);
  line-height: 1;
}

.ws-logo-fallback span {
  color: var(--ws-light);
  font-weight: 400;
}

.ws-title-block {
  text-align: right;
  flex: 1;
}

.ws-worksheet-label {
  font-size: var(--ws-label-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ws-light);
  margin-bottom: 2px;
}

.ws-title {
  font-size: 14pt;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ws-ink);
}

.ws-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.ws-badge {
  font-size: 7.5pt;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 2px;
  line-height: 1.4;
  white-space: nowrap;
}

.ws-badge-level {
  background: var(--ws-ink);
  color: #fff;
}

.ws-badge-focus {
  background: transparent;
  color: var(--ws-ink);
  border: 1px solid #777;
}

.ws-badge-topic {
  background: transparent;
  color: var(--ws-muted);
  border: 1px solid var(--ws-rule);
}

.ws-badge-time {
  background: transparent;
  color: var(--ws-muted);
  border: 1px solid var(--ws-rule);
}

/* ============================================================
   SECTIONS — generic container
   ============================================================ */

.ws-section {
  margin-bottom: var(--ws-gap-section);
}

.ws-section-title {
  font-size: var(--ws-label-size);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #444;
  border-left: 3px solid var(--ws-ink);
  padding-left: 6px;
  margin-bottom: 7px;
  line-height: 1.2;
}

/* ============================================================
   BEFORE YOU READ  (warm-up section)
   ============================================================ */

.ws-warmup {
  margin-bottom: var(--ws-gap-section);
}

.ws-warmup-intro {
  font-size: var(--ws-small);
  color: var(--ws-muted);
  font-style: italic;
  margin-bottom: 7px;
}

.ws-warmup-list {
  list-style: none;
  padding: 0;
}

.ws-warmup-item {
  margin-bottom: 12px;
  break-inside: avoid;
}

.ws-warmup-q {
  font-size: var(--ws-body-size);
  line-height: 1.45;
  color: var(--ws-ink);
  padding-left: 20px;
  position: relative;
}

.ws-warmup-q::before {
  content: attr(data-num) '.';
  position: absolute;
  left: 0;
  font-weight: 700;
}

.ws-warmup-q .ans-line {
  margin-top: 5px;
}

.ws-warmup-q .ans-line + .ans-line {
  margin-top: 7px;
}

/* ============================================================
   KEY VOCABULARY TABLE
   ============================================================ */

.ws-vocab-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.ws-vocab-table thead th {
  font-size: var(--ws-label-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #444;
  padding: 3px 10px 5px 0;
  border-bottom: 1.5px solid var(--ws-ink);
  text-align: left;
}

.ws-vocab-table tbody td {
  font-size: 10pt;
  padding: 5px 10px 5px 0;
  vertical-align: top;
  border-bottom: 1px dotted var(--ws-rule-light);
  line-height: 1.4;
}

.ws-vocab-table tbody tr:last-child td {
  border-bottom: none;
}

.ws-vocab-table .vc-word {
  font-weight: 700;
  width: 18%;
  color: var(--ws-ink);
}

.ws-vocab-table .vc-def {
  width: 38%;
  color: var(--ws-ink-2);
}

.ws-vocab-table .vc-ex {
  color: var(--ws-muted);
  font-style: italic;
}

/* ============================================================
   READING ARTICLE BOX
   ============================================================ */

.ws-reading-article {
  border: 1.5px solid var(--ws-ink);
  padding: 10px 14px 14px;
  margin-top: 2px;
}

.ws-article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ws-article-type {
  font-size: var(--ws-label-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ws-light);
}

.ws-article-wordcount {
  font-size: var(--ws-label-size);
  color: #bbb;
}

.ws-article-title {
  font-size: 12pt;
  font-weight: 800;
  color: var(--ws-ink);
  margin-bottom: 8px;
  line-height: 1.2;
  border-bottom: 1px solid var(--ws-rule-light);
  padding-bottom: 6px;
}

.ws-article-body p {
  font-size: var(--ws-text-size);
  line-height: var(--ws-lh-text);
  margin-bottom: 7px;
  color: var(--ws-ink);
}

.ws-article-body p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   NOTICE THE GRAMMAR  (post-text grammar awareness box)
   ============================================================ */

.ws-notice-grammar {
  border: 1.5px dashed #aaa;
  background: var(--ws-bg-notice);
  padding: 9px 13px 10px;
  margin-top: 10px;
  break-inside: avoid;
}

@media print {
  .ws-notice-grammar { background: var(--ws-bg-soft); }
}

.ws-notice-grammar-title {
  font-size: 7.5pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #444;
  margin-bottom: 4px;
}

.ws-notice-grammar p {
  font-size: 10pt;
  color: var(--ws-ink-2);
  margin-bottom: 5px;
  line-height: 1.5;
}

.ws-notice-grammar ol {
  padding-left: 18px;
  margin-bottom: 0;
}

.ws-notice-grammar li {
  font-size: 10pt;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* ============================================================
   EXERCISES — shared structure (same as grammar worksheets)
   ============================================================ */

.ws-exercises {
  margin-bottom: 2px;
}

.ws-exercise {
  margin-bottom: 14px;
  break-inside: avoid;
}

.ws-exercise-header {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 3px;
}

.ex-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  background: var(--ws-ink);
  color: #fff;
  font-size: 8.5pt;
  font-weight: 800;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.ex-name {
  font-weight: 800;
  font-size: 10.5pt;
}

.ex-instruction {
  font-size: var(--ws-small);
  color: #444;
  font-style: italic;
  margin-bottom: 7px;
  padding-left: 24px;
}

.ws-exercise ol {
  padding-left: 20px;
}

.ws-exercise li {
  font-size: var(--ws-body-size);
  line-height: 1.45;
  margin-bottom: 14px;
}

/* ============================================================
   ANSWER ELEMENTS
   ============================================================ */

/* Inline answer blank */
.ans {
  display: inline-block;
  border-bottom: 1px solid var(--ws-muted);
  min-width: 90px;
  min-height: 1.2em;
  line-height: 1.2;
  vertical-align: baseline;
  margin: 0 2px;
  padding: 0 3px 2px;
}

.ans:empty {
  height: 1.2em;
  padding-bottom: 3px;
}

/* Full-width answer line below item */
.ans-line {
  display: block;
  border-bottom: 1px solid var(--ws-muted);
  width: 100%;
  height: 18px;
  margin-top: 5px;
}

.ans-line + .ans-line {
  margin-top: 8px;
}

/* Short right-aligned answer blank (for T/F/NG) */
.ans-short {
  display: inline-block;
  border-bottom: 1px solid var(--ws-muted);
  width: 45px;
  min-height: 1.2em;
  line-height: 1.2;
  vertical-align: baseline;
  margin-left: 6px;
  padding: 0 3px 2px;
}

/* Multiple choice option — inline */
.mc-option {
  margin-right: 18px;
  font-size: var(--ws-body-size);
  display: inline;
}

/* ============================================================
   REVEAL ANSWER BUTTON  (screen only)
   ============================================================ */

.reveal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  background: #f0f0f0;
  border: 1px solid #bbb;
  border-radius: 3px;
  cursor: pointer;
  font-size: 9pt;
  line-height: 1;
  color: #aaa;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
  margin-right: 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.reveal-btn:hover {
  background: #e8eeff;
  border-color: var(--ws-accent);
  color: var(--ws-accent);
}

li.revealed .reveal-btn {
  background: var(--ws-accent);
  border-color: var(--ws-accent);
  color: #fff;
}

li.revealed .ans {
  min-height: 1.2em;
  line-height: 1.2;
  vertical-align: baseline;
  padding: 0 3px 2px;
  color: #3d5fc0;
  font-style: italic;
  font-weight: 600;
  border-bottom-color: var(--ws-accent);
}

li.revealed .ans-line {
  height: auto;
  min-height: 18px;
  line-height: 1.35;
  padding-left: 2px;
  padding-bottom: 4px;
  color: #3d5fc0;
  font-style: italic;
  border-bottom-color: var(--ws-accent);
}

li.revealed .ans-short {
  min-height: 1.2em;
  line-height: 1.2;
  vertical-align: baseline;
  padding: 0 3px 2px;
  color: #3d5fc0;
  font-style: italic;
  border-bottom-color: var(--ws-accent);
}

@media print {
  .reveal-btn { display: none; }
}

/* ============================================================
   PERSONAL RESPONSE  (discussion / writing section)
   ============================================================ */

.ws-personal-response {
  border: 1.5px dashed #777;
  padding: 10px 14px;
  margin-bottom: var(--ws-gap-section);
  break-inside: avoid;
}

.ws-personal-response-header {
  font-weight: 800;
  font-size: var(--ws-label-size);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #444;
  margin-bottom: 4px;
}

.ws-personal-response p {
  font-size: 10pt;
  margin-bottom: 4px;
  color: var(--ws-muted);
  font-style: italic;
}

.ws-personal-response ol {
  padding-left: 18px;
}

.ws-personal-response li {
  font-size: var(--ws-body-size);
  margin-bottom: 8px;
  line-height: 1.45;
}

/* ============================================================
   FOOTER
   ============================================================ */

.ws-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--ws-rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8pt;
  color: var(--ws-light);
}

.ws-footer a {
  color: var(--ws-light);
  text-decoration: none;
}

/* ============================================================
   ANSWER KEY PAGE
   ============================================================ */

.ws-answer-key {
  page-break-before: always;
  break-before: page;
}

@media screen {
  .ws-answer-key {
    page-break-before: auto;
    break-before: auto;
  }
}

.ws-answer-key-banner {
  background: var(--ws-ink);
  color: #fff;
  padding: 9px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.ws-answer-key-banner h2 {
  font-size: 12pt;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ws-answer-key-banner .ak-subtitle {
  font-size: 9pt;
  opacity: 0.7;
  font-style: italic;
}

.ws-ak-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.ws-ak-section {
  margin-bottom: 14px;
  break-inside: avoid;
}

.ws-ak-section h3 {
  font-size: 8.5pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #444;
  border-bottom: 1px solid var(--ws-rule-light);
  padding-bottom: 3px;
  margin-bottom: 6px;
}

.ws-ak-section ol {
  padding-left: 18px;
}

.ws-ak-section li {
  font-size: 10pt;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ws-ak-section li strong {
  font-weight: 700;
}

.ws-ak-inline {
  font-size: 10pt;
  line-height: 1.8;
}

.ws-ak-note {
  font-size: 9pt;
  color: var(--ws-muted);
  font-style: italic;
  margin-top: 4px;
}

.ws-ak-span-2 {
  grid-column: 1 / -1;
}
