/* ============================================================
   blatt.css — shared styles for interactive Sprachmut worksheets
   (Unterrichtsblätter). Extends styles.css design tokens; load
   AFTER styles.css on every /de/arbeitsblaetter/<slug>.html page.
   ============================================================ */

.sheet-wrap {
  background: var(--cream);
  padding: 32px 0 80px;
}

.sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Action bar ---------- */
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 28px;
}

.sheet-actions .btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-note {
  font-size: 0.84rem;
  color: #655c7c;
  margin-bottom: 20px;
}

.sheet-note.save-error {
  display: none;
  color: var(--terracotta);
  font-weight: 600;
}

.sheet-note.save-error.is-visible {
  display: block;
}

.sheet-reset {
  background: none;
  border: 1px solid rgba(30, 18, 51, 0.18);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease;
}

.sheet-reset:hover {
  background: rgba(30, 18, 51, 0.06);
}

/* ---------- Header ---------- */
.sheet-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sheet-logo-img {
  width: 52px;
  height: auto;
  flex-shrink: 0;
  border-radius: 10px;
}

.sheet-title-bubble {
  background: var(--purple);
  border-radius: 18px;
  padding: 14px 22px 16px;
  transform: rotate(-1.2deg);
  box-shadow: 0 6px 0 0 var(--purple-deep);
  display: inline-block;
}

.sheet-title-bubble h1 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: #FBF7FF;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.15;
}

.sheet-meta-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sheet-meta-pill {
  background: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: #FBF7FF;
}

/* ---------- Blocks ---------- */
.block {
  margin-bottom: 32px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.block-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 16px;
  padding: 8px 18px;
  margin-bottom: 14px;
}

.block-header.c-purple { background: var(--purple); transform: rotate(-0.8deg); }
.block-header.c-lime { background: var(--lime); transform: rotate(0.6deg); }
.block-header.c-terracotta { background: var(--terracotta); transform: rotate(-0.6deg); }
.block-header.c-ink { background: var(--ink); transform: rotate(0.6deg); }

.block-header .num {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FBF7FF;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.block-header h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
}

.block-header.c-purple h2,
.block-header.c-ink h2,
.block-header.c-terracotta h2 { color: #FBF7FF; }
.block-header.c-lime h2 { color: var(--ink); }

.block-body p {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 10px;
}

.hint {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--purple-deep);
  margin-top: 4px;
}

/* ---------- Chips / prompts ---------- */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  background: var(--purple-10);
  color: var(--purple-deep);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
}

.prompt-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-item {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--purple-deep);
}

/* ---------- Example / write-in fields ---------- */
.example-box {
  background: var(--paper);
  border: 2px dashed var(--lime);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.example-tag,
.tag-ex {
  display: inline-block;
  background: var(--lime);
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 3px 10px;
  margin-left: 8px;
  vertical-align: middle;
}

.write-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-top: 10px;
}

.field-row {
  display: flex;
  flex-direction: column;
}

.field-row label {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--purple-deep);
  margin-bottom: 4px;
}

.write-input,
.write-textarea {
  width: 100%;
  border: none;
  border-bottom: 2px dotted #9c94b8;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--ink);
  padding: 6px 2px;
  resize: none;
  overflow: hidden;
}

.write-input:focus-visible,
.write-textarea:focus-visible {
  outline: none;
  border-bottom-color: var(--purple);
}

.filled-example {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--purple-deep);
  display: block;
  padding: 6px 2px;
  border-bottom: 2px solid var(--lime);
}

.poss-note {
  background: var(--purple-10);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.5;
}

.poss-note strong {
  color: var(--purple-deep);
}

/* ---------- Link card (replaces print QR code) ---------- */
.qr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 10px;
  text-decoration: none;
  max-width: 420px;
}

.qr-card::before {
  content: "▶";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--purple-10);
  color: var(--purple);
  font-size: 1rem;
}

.qr-card .qr-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--ink);
}

.qr-card .qr-sub {
  font-size: 0.84rem;
  color: var(--purple);
  text-decoration: underline;
}

/* ---------- Grammar table ---------- */
.grammar-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.grammar-table th,
.grammar-table td {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.92rem;
  border-bottom: 1px solid rgba(90, 23, 224, 0.14);
}

.grammar-table th {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--purple);
}

.grammar-table td.hl {
  color: var(--purple-deep);
  font-weight: 600;
}

.sent {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sent span {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.94rem;
}

.sent .plus {
  border: 0;
  background: none;
  padding: 0;
  color: #9c94b8;
}

.sent .v { background: var(--purple); color: #fff; border-color: var(--purple); font-weight: 600; }
.sent .p { background: var(--lime); color: var(--ink); border-color: var(--lime); font-weight: 600; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.info-card {
  background: var(--purple-10);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink);
}

.info-card h5 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--purple);
  margin-bottom: 4px;
}

/* ---------- Timeline ---------- */
.timeline {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 14px;
}

.tl-axis {
  position: relative;
  height: 20px;
  margin-left: 90px;
  font-size: 0.76rem;
  color: #6b6388;
}

.tl-axis span {
  position: absolute;
  transform: translateX(-50%);
}

.tl-row {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.tl-lab {
  width: 90px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--purple-deep);
}

.tl-track {
  position: relative;
  flex: 1;
  height: 24px;
  background: var(--purple-10);
  border-radius: 12px;
  border-right: 2px dashed var(--purple);
}

.tl-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 6px;
}

.tl-note {
  margin-left: 90px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: #6b6388;
  font-style: italic;
  line-height: 1.4;
}

/* ---------- Exercises ---------- */
.exercise {
  margin-bottom: 20px;
}

.exercise-label {
  display: inline-block;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--purple-deep);
  margin-bottom: 10px;
}

.ex-item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ex-item .arrow {
  color: var(--lime-deep);
  font-weight: 700;
  flex-shrink: 0;
}

.ex-item .src {
  font-size: 0.96rem;
  color: var(--ink);
  flex-shrink: 0;
  min-width: 140px;
}

.ex-item .src.wide {
  min-width: 220px;
}

.ex-item .write-input {
  flex: 1;
  min-width: 140px;
}

.gap-text {
  font-size: 0.98rem;
  line-height: 2.2;
  color: var(--ink);
}

.gap-text .write-input.gap {
  display: inline-block;
  width: 110px;
  margin: 0 4px;
}

.reading {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-top: 10px;
}

.q-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-top: 12px;
}

.q-grid .q {
  font-size: 0.96rem;
  margin-bottom: 4px;
}

/* ---------- Final challenge ---------- */
.final-text-area {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip {
  background: var(--terracotta);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  transform: rotate(-0.6deg);
}

.tip p {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.2rem;
  color: #FBF7FF;
  line-height: 1.3;
}

.sheet-footer-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(90, 23, 224, 0.14);
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-footer-inline .logo-big {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--purple);
}

.sheet-footer-inline .tagline {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .write-grid,
  .two-col,
  .q-grid {
    grid-template-columns: 1fr;
  }

  .sheet-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  /* Percentage-positioned timeline bars collide with their labels once the
     track gets this narrow, so fall back to a simple stacked legend. */
  .tl-axis {
    display: none;
  }

  .tl-row {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 14px;
  }

  .tl-lab {
    width: auto;
    margin-bottom: 6px;
  }

  .tl-track {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    background: none;
    border-right: none;
  }

  .tl-bar {
    position: static;
    left: auto !important;
    width: auto !important;
    display: inline-flex;
    height: auto;
    white-space: normal;
    padding: 6px 10px;
  }

  .tl-note {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-reset {
    transition: none;
  }
}

/* ---------- Print ---------- */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #FBF7FF;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sheet-wrap {
    padding: 0;
    background: #FBF7FF;
  }

  .sheet {
    max-width: 100%;
    padding: 0 8mm;
  }

  .block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .write-input,
  .write-textarea {
    border-bottom: 0.4mm dotted #9c94b8;
  }

  .write-input:focus-visible,
  .write-textarea:focus-visible {
    outline: none;
  }

  @page {
    size: A4;
    margin: 14mm 10mm;
  }
}
