/* Shared stylesheet for the Italian teaching workspace. Tufte-ish: quiet, readable, print-friendly. */

:root {
  --ink: #1f322f;
  --ink-soft: #55726c;
  --paper: #e3f3f0;
  --paper-raised: #d0eae5;
  --rule: #b3d8d1;
  --accent: #a8452f;      /* warm rust, pops against teal */
  --accent-soft: #cfa093;
  --good: #2f6b53;         /* muted teal-green */
  --good-bg: #d3ece1;
  --bad: #a8402e;
  --bad-bg: #f5ddd4;
  --code-bg: #c9e8e1;
  --grammar-bg: #e9eaf9;
  --grammar-raised: #dadcf3;
  --grammar-border: #b7bce4;
  --grammar-label: #4b4fa3;
  --grammar-rule: #c7cbec;
  --max-width: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #dff2ee;
    --ink-soft: #9bc1ba;
    --paper: #0d1b19;
    --paper-raised: #163330;
    --rule: #2c4c46;
    --accent: #e28e70;
    --accent-soft: #8a5646;
    --good: #7fc7ab;
    --good-bg: #1c3730;
    --bad: #e0937e;
    --bad-bg: #3a2018;
    --code-bg: #17332e;
    --grammar-bg: #1c1e3c;
    --grammar-raised: #262952;
    --grammar-border: #40447e;
    --grammar-label: #a8adf0;
    --grammar-rule: #3a3e70;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 3rem 1.5rem 6rem;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.65;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
}

header.lesson-header {
  max-width: var(--max-width);
  margin: 0 auto 2.5rem;
}

.eyebrow {
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
}

h1, h2, h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

h1 {
  font-size: 2rem;
  margin: 0.3rem 0 0.5rem;
}

h2 {
  font-size: 1.35rem;
  margin-top: 2.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
}

p { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.subtitle {
  color: var(--ink-soft);
  font-size: 1.05rem;
  font-style: italic;
  margin: 0;
}

.it {
  font-style: italic;
  color: var(--ink);
}

.gloss {
  color: var(--ink-soft);
}

code, .term {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 0.25em;
  font-size: 0.92em;
}

blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1.25rem;
  border-left: 3px solid var(--accent-soft);
  color: var(--ink-soft);
  font-style: italic;
}

ul, ol {
  padding-left: 1.4rem;
}

li { margin-bottom: 0.4rem; }

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

/* --- Hub cards (index.html) --- */

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.hub-card {
  display: block;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0.6rem;
  padding: 1.5rem 1.75rem;
  text-decoration: none;
  color: inherit;
}

.hub-card:hover { border-color: var(--accent-soft); }

.hub-card h2 {
  margin-top: 0.3rem;
  border-bottom: none;
  padding-bottom: 0;
}

.hub-card p { color: var(--ink-soft); margin-bottom: 0; }

/* --- Callouts --- */

.callout {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.callout .callout-label {
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 0.4rem;
}

.callout.source { border-left: 4px solid var(--accent); }
.callout.ask    { border-left: 4px solid var(--ink-soft); }

/* --- Recipe photo --- */

.recipe-photo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 0.6rem;
  border: 1px solid var(--rule);
  margin: 1.5rem 0;
}

/* Callouts that hold a video get to break out of the text column and grow */
.callout:has(.video-embed) {
  width: min(92vw, 52rem);
  max-width: 52rem;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* --- Grammar section: visually separates formal-grammar explanations from practical vocab --- */

.grammar-box {
  background: var(--grammar-bg);
  border: 1px solid var(--grammar-border);
  border-radius: 0.6rem;
  padding: 0.25rem 1.5rem 1.5rem;
  margin: 2rem 0;
}

.grammar-box .eyebrow.grammar-label {
  color: var(--grammar-label);
  padding-top: 1.25rem;
  margin-bottom: 0.25rem;
  display: block;
}

.grammar-box h2,
.grammar-box h3 {
  color: var(--ink);
}

.grammar-box .grammar-label + h2,
.grammar-box .grammar-label + h3 {
  margin-top: 0.25rem;
}

.grammar-box h2 {
  border-bottom-color: var(--grammar-border);
}

.grammar-box table.vocab th,
.grammar-box table.vocab td {
  border-bottom-color: var(--grammar-rule);
}

.grammar-box code,
.grammar-box .term {
  background: var(--grammar-raised);
}

.grammar-box blockquote {
  border-left-color: var(--grammar-label);
}

.grammar-box .callout {
  background: var(--grammar-raised);
  border-color: var(--grammar-border);
}

.grammar-box .callout .callout-label {
  color: var(--grammar-label);
}

/* --- Vocab table --- */

table.vocab {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 1rem;
}

table.vocab th {
  text-align: left;
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding: 0.4rem 0.6rem 0.4rem 0;
}

table.vocab td {
  padding: 0.55rem 0.6rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

table.vocab td.it-word { font-weight: 600; white-space: nowrap; }

/* --- Quiz widget --- */

.quiz {
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  border-radius: 0.5rem;
  padding: 1.25rem 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.quiz .quiz-prompt { font-weight: 600; margin-bottom: 0.75rem; }

.quiz input[type="text"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.7rem;
  width: 100%;
  max-width: 20rem;
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  background: var(--paper);
  color: var(--ink);
}

.quiz .quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.quiz label.choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  cursor: pointer;
  background: var(--paper);
}

.quiz label.choice:hover { border-color: var(--accent-soft); }

.quiz button {
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.quiz button:hover { opacity: 0.9; }

.quiz-feedback {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.35rem;
  font-size: 0.95rem;
  display: none;
}

.quiz-feedback.show { display: block; }
.quiz-feedback.correct { background: var(--good-bg); color: var(--good); }
.quiz-feedback.incorrect { background: var(--bad-bg); color: var(--bad); }

/* --- Video embed --- */

.video-embed {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin: 0.75rem 0 0;
  border-radius: 0.4rem;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Lesson nav footer --- */

nav.lesson-nav {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

/* --- Review page: stats dashboard --- */

.stat-tiles {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.stat-tile {
  flex: 1 1 8rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label {
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}

.lesson-progress-list {
  margin: 1.5rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lesson-progress-row {
  display: grid;
  grid-template-columns: 10rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.lesson-progress-label {
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-progress-label:hover { text-decoration: underline; }

.lesson-progress-bar {
  height: 0.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
}

.lesson-progress-fill {
  height: 100%;
  background: var(--good);
}

.lesson-progress-count {
  color: var(--ink-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

@media (max-width: 30rem) {
  .lesson-progress-row { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* --- Review page: queue --- */

#due-section, #empty-due, #empty-none { display: none; }
#due-section.show, #empty-due.show, #empty-none.show { display: block; }

.review-card {
  margin: 1.5rem 0;
}

.lesson-tag {
  display: inline-block;
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 0.4rem;
}
.lesson-tag:hover { text-decoration: underline; }

/* --- Review link + due badge (used on index.html and lesson nav) --- */

.review-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.due-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--paper);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

@media print {
  body { padding: 0; background: white; color: black; }
  .quiz button { display: none; }
}
