:root {
  --ink: #061d2f;
  --ink-2: #0b2e47;
  --gold: #c99145;
  --gold-soft: #e0b36d;
  --paper: #f3e4c7;
  --paper-2: #fff6df;
  --red: #612114;
  --text: #17202a;
  --muted: #5f523f;
  --line: rgba(201, 145, 69, 0.45);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(6, 29, 47, 0.94), rgba(6, 29, 47, 0.9)),
    radial-gradient(circle at 20% 10%, rgba(201, 145, 69, 0.18), transparent 28%),
    var(--ink);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  color: var(--paper-2);
  background: rgba(6, 29, 47, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--gold-soft);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--gold);
  border-radius: 50%;
  font-size: 0.85rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.top-nav a {
  padding: 0.65rem 0.75rem;
  border-bottom: 2px solid transparent;
  color: var(--paper-2);
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--gold-soft);
  border-color: var(--gold);
}

.top-nav .journey-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.35rem;
  border: 1px solid rgba(224, 179, 109, 0.72);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-2), #e9c98d);
  font-size: 0.9rem;
}

.top-nav .journey-nav-link:hover,
.top-nav .journey-nav-link:focus-visible {
  color: var(--ink);
  border-color: var(--paper-2);
}

.journey-home-link {
  position: fixed;
  z-index: 20;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-2), #e9c98d);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.journey-context-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  color: var(--paper-2);
  background:
    linear-gradient(145deg, rgba(7, 39, 60, 0.98), rgba(12, 58, 87, 0.96)),
    radial-gradient(circle at top right, rgba(224, 179, 109, 0.18), transparent 42%);
  box-shadow: var(--shadow);
}

.journey-context-card > p {
  margin: 0;
  color: var(--gold-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.journey-context-card h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 500;
}

.journey-context-actions {
  display: grid;
  gap: 0.55rem;
}

.journey-context-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(224, 179, 109, 0.65);
  border-radius: 0.35rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-2), #e9c98d);
  text-decoration: none;
  line-height: 1.25;
}

.journey-context-link:hover,
.journey-context-link:focus-visible,
.journey-home-link:hover,
.journey-home-link:focus-visible {
  outline: 3px solid var(--paper-2);
  outline-offset: 2px;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body[data-page="home"] {
  min-height: 100vh;
  background: #061d2f;
}

body[data-page="home"] main {
  width: min(100%, 1173px);
}

.index-replica {
  position: relative;
  margin: 0 auto;
  background: #061d2f;
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.45);
}

.index-replica-image {
  width: 100%;
  height: auto;
  user-select: none;
}

.hotspot {
  position: absolute;
  display: block;
  border-radius: 0.45rem;
  text-decoration: none;
}

.hotspot:focus-visible {
  outline: 3px solid var(--paper-2);
  outline-offset: 3px;
  background: rgba(255, 246, 223, 0.16);
}

.hs-home { left: 32%; top: 1.2%; width: 7%; height: 4%; }
.hs-lezioni { left: 40%; top: 1.2%; width: 9%; height: 4%; }
.hs-approfondimenti { left: 51%; top: 1.2%; width: 13%; height: 4%; }
.hs-mappe-nav { left: 65%; top: 1.2%; width: 8%; height: 4%; }
.hs-biografia { left: 74%; top: 1.2%; width: 8%; height: 4%; }
.hs-start { left: 82%; top: 1%; width: 16%; height: 4.5%; }
.hs-card-1 { left: 2.6%; top: 35%; width: 14.5%; height: 21.8%; }
.hs-card-2 { left: 18%; top: 35%; width: 14.5%; height: 21.8%; }
.hs-card-3 { left: 34%; top: 35%; width: 15%; height: 21.8%; }
.hs-card-4 { left: 50.5%; top: 35%; width: 14.5%; height: 21.8%; }
.hs-card-5 { left: 66%; top: 35%; width: 14.5%; height: 21.8%; }
.hs-card-6 { left: 82%; top: 35%; width: 14.5%; height: 21.8%; }
.hs-zante { left: 11%; top: 61%; width: 11%; height: 11.5%; border-radius: 50%; }
.hs-napoleone { left: 25%; top: 61%; width: 11%; height: 11.5%; border-radius: 50%; }
.hs-ortis { left: 38.5%; top: 61%; width: 11%; height: 11.5%; border-radius: 50%; }
.hs-sepolcri { left: 51.5%; top: 61%; width: 11%; height: 11.5%; border-radius: 50%; }
.hs-grazie { left: 65%; top: 61%; width: 11%; height: 11.5%; border-radius: 50%; }
.hs-illusioni { left: 79%; top: 61%; width: 11%; height: 11.5%; border-radius: 50%; }
.hs-mappe-panel { left: 2.7%; top: 73.6%; width: 30%; height: 15.2%; }
.hs-timeline-panel { left: 33.8%; top: 73.6%; width: 30%; height: 15.2%; }
.hs-quiz-panel { left: 64.5%; top: 73.6%; width: 31.5%; height: 15.2%; }

.hero-home {
  min-height: min(760px, calc(100vh - 5rem));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(2rem, 5vw, 4.5rem) 0 2rem;
  color: var(--paper-2);
}

.hero-home::before {
  content: "";
  position: absolute;
  inset: 4.5rem 0 auto 0;
  height: min(62vh, 560px);
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(243, 228, 199, 0.94), rgba(243, 228, 199, 0.6), rgba(6, 29, 47, 0.12)),
    url("../immagini/index.png") center top / cover;
  opacity: 0.22;
}

.hero-copy {
  max-width: 670px;
  text-align: center;
}

.ornament {
  color: var(--gold-soft);
  font-size: 1.3rem;
}

.hero-copy h1 {
  margin: 0.35rem 0 1rem;
  color: var(--paper-2);
  font-size: clamp(3.4rem, 9vw, 7rem);
  line-height: 0.95;
  font-weight: 500;
}

.hero-copy p {
  width: min(620px, 100%);
  margin: 0 auto 1.5rem;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.55;
}

.primary-action,
.button-link,
.modal-close,
.media-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.7rem 1.05rem;
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-2), #e9c98d);
  box-shadow: 0 4px 0 rgba(77, 46, 18, 0.45);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.hero-portrait {
  margin: 0;
  border: 1px solid var(--gold);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--paper);
}

.hero-portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
}

.section-shell,
.key-themes,
.feature-panels,
.lesson-shell,
.map-page,
.video-page {
  margin: 0 0 2rem;
}

.section-heading {
  color: var(--paper-2);
  text-align: center;
}

.section-heading p {
  margin: 0;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.section-heading h2 {
  margin: 0.3rem 0 1.2rem;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 500;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 0.85rem;
}

.home-card {
  position: relative;
  min-height: 245px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-items: center;
  justify-items: center;
  gap: 0.65rem;
  padding: 1.1rem 0.9rem;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 246, 223, 0.9), rgba(243, 228, 199, 0.96)),
    radial-gradient(circle at 20% 20%, rgba(201, 145, 69, 0.18), transparent 35%);
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.home-card:hover {
  transform: translateY(-3px);
}

.card-number {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  color: var(--paper-2);
  background: var(--ink);
  border: 1px solid var(--gold);
  font-size: 1.4rem;
}

.card-icon {
  min-height: 3rem;
  color: var(--gold);
  font-size: 2.6rem;
}

.home-card strong {
  font-size: 1.45rem;
  line-height: 1.05;
}

.home-card span:last-child {
  color: #372718;
  line-height: 1.25;
}

.theme-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: rgba(8, 42, 65, 0.9);
}

.theme-strip a {
  display: grid;
  place-items: center;
  min-height: 5rem;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--paper-2);
  text-align: center;
  text-decoration: none;
  background: rgba(243, 228, 199, 0.08);
}

.feature-panels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.feature-panel {
  min-height: 160px;
  padding: 1.4rem;
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.feature-panel strong {
  display: block;
  margin-bottom: 0.7rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.feature-panel span {
  line-height: 1.45;
}

.panel-blue {
  color: var(--paper-2);
  background: linear-gradient(135deg, #082a41, #0c3a57);
}

.panel-paper {
  color: var(--ink);
  background: linear-gradient(135deg, var(--paper-2), #e6c58d);
}

.panel-red {
  color: var(--paper-2);
  background: linear-gradient(135deg, var(--red), #7b2d1d);
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 5vw, 4rem);
  flex-wrap: wrap;
  margin-top: 2rem;
  padding: 1.4rem;
  color: var(--paper-2);
  border-top: 1px solid var(--line);
  background: rgba(6, 29, 47, 0.98);
}

.lesson-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: clamp(1.2rem, 4vw, 2.5rem);
  align-items: start;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

.lesson-article,
.map-index,
.video-index {
  min-width: 0;
  padding: clamp(1.15rem, 3vw, 2rem);
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  background:
    linear-gradient(rgba(255, 246, 223, 0.96), rgba(243, 228, 199, 0.98)),
    radial-gradient(circle at 10% 5%, rgba(201, 145, 69, 0.16), transparent 28%);
  box-shadow: var(--shadow);
}

.lesson-article h1 {
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  line-height: 1;
  font-weight: 500;
}

.lesson-kicker {
  margin: 0 0 0.55rem;
  color: #755322;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.84rem;
}

.lesson-subtitle {
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.45;
}

.lesson-article h2 {
  margin: 1.7rem 0 0.7rem;
  color: #173750;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.16;
}

.lesson-article p,
.lesson-note p,
.video-card p {
  font-size: 1.05rem;
  line-height: 1.72;
}

.lesson-note {
  margin: 1.1rem 0;
  padding: 1rem;
  border-left: 4px solid var(--gold);
  background: rgba(255, 255, 255, 0.38);
}

.lesson-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.2rem 0;
}

.lesson-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.3);
}

.lesson-table th,
.lesson-table td {
  min-width: 9rem;
  padding: 0.75rem;
  border: 1px solid rgba(95, 82, 63, 0.28);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.lesson-table th {
  color: var(--ink);
  background: rgba(201, 145, 69, 0.18);
}

.lesson-sidebar {
  position: sticky;
  top: 5rem;
  min-width: 0;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
  display: grid;
  gap: 1rem;
  scrollbar-color: var(--gold) rgba(255, 246, 223, 0.18);
  scrollbar-width: thin;
}

.foscolo-media,
.lesson-map-card,
.video-card {
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  background: var(--paper);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.foscolo-media {
  position: relative;
}

.image-panel {
  position: relative;
}

.image-panel img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  cursor: pointer;
}

.is-video-missing .image-panel img {
  cursor: default;
}

.play-video {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  white-space: nowrap;
}

.video-panel {
  padding: 0.8rem;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

.media-caption,
.lesson-map-card figcaption {
  padding: 0.75rem;
  color: var(--ink);
  line-height: 1.35;
}

.is-video-missing .media-caption::after {
  content: " Video non disponibile per questa sezione.";
  color: var(--muted);
}

.lesson-map-card {
  margin: 0;
}

.lesson-map-card img {
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

.map-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.map-grid,
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.map-index h1,
.video-index h1 {
  margin-top: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 500;
}

.map-tile {
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  overflow: hidden;
  background: var(--paper-2);
}

.map-tile button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.map-tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff8e8;
}

.map-tile strong,
.video-card strong {
  display: block;
  padding: 0.8rem;
  color: var(--ink);
  font-size: 1.1rem;
}

.video-card {
  padding-bottom: 1rem;
}

.video-card p {
  margin: 0;
  padding: 0 0.8rem 0.8rem;
}

.map-modal {
  width: min(96vw, 1280px);
  height: min(92vh, 900px);
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  background: var(--ink);
}

.map-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.modal-inner {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}

.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  color: var(--paper-2);
  border-bottom: 1px solid var(--line);
}

.modal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--paper-2);
}

.modal-close {
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
}

.study-panel {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid rgba(201, 145, 69, 0.5);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.34);
}

.study-heading p {
  margin: 0 0 0.25rem;
  color: #755322;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.study-heading h2 {
  margin-top: 0;
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.vocab-card,
.quiz-question,
.report-row,
.notes-tool {
  border: 1px solid rgba(95, 82, 63, 0.22);
  border-radius: 0.45rem;
  background: rgba(255, 246, 223, 0.72);
}

.vocab-card {
  padding: 0.85rem;
}

.vocab-card strong {
  display: block;
  color: var(--ink);
  font-size: 1.08rem;
}

.vocab-card p {
  margin: 0.35rem 0 0;
}

.lesson-quiz {
  display: grid;
  gap: 0.9rem;
}

.quiz-question {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.9rem;
}

.quiz-question legend {
  padding: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.quiz-question label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  line-height: 1.45;
}

.quiz-report {
  margin-top: 1rem;
}

.quiz-report h3 {
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-size: 1.45rem;
}

.score-line {
  margin: 0 0 0.9rem;
  font-weight: 700;
}

.report-row {
  margin-top: 0.75rem;
  padding: 0.9rem;
}

.report-row.is-correct {
  border-color: rgba(42, 112, 70, 0.45);
  background: rgba(231, 246, 231, 0.72);
}

.report-row.is-wrong {
  border-color: rgba(133, 48, 28, 0.45);
  background: rgba(255, 236, 219, 0.78);
}

.notes-tool {
  padding: 0.9rem;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.notes-tool h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 500;
}

.notes-tool p {
  margin: 0 0 0.75rem;
  line-height: 1.35;
}

.notes-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.student-highlight {
  padding: 0.05em 0.12em;
  border-radius: 0.18rem;
  background: #ffe277;
  color: inherit;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.notes-tool textarea {
  width: 100%;
  min-height: 220px;
  max-height: 45vh;
  resize: vertical;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid rgba(95, 82, 63, 0.35);
  border-radius: 0.4rem;
  color: var(--text);
  background: #fffaf0;
  font: 1rem/1.5 Georgia, "Times New Roman", serif;
}

.notes-clear {
  margin-top: 0.6rem;
  padding: 0;
  border: 0;
  color: #6b2c1f;
  background: transparent;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.notes-status {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 980px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    width: 100%;
  }

  .hero-home,
  .lesson-shell {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    order: 2;
  }

  .hero-portrait {
    width: min(420px, 100%);
    margin: 0 auto;
  }

  .lesson-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-strip,
  .feature-panels,
  .map-grid,
  .video-grid,
  .vocab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 1rem, 1180px);
  }

  .brand {
    font-size: 0.95rem;
  }

  .hero-home {
    min-height: auto;
    padding-top: 1.2rem;
  }

  .hero-copy {
    text-align: left;
  }

  .hero-copy h1 {
    font-size: 3.2rem;
  }

  .hero-copy p {
    margin-left: 0;
  }

  .lesson-grid,
  .theme-strip,
  .feature-panels,
  .map-grid,
  .video-grid,
  .vocab-grid,
  .notes-actions {
    grid-template-columns: 1fr;
  }

  .home-card {
    min-height: 190px;
  }

  .site-footer {
    justify-content: flex-start;
  }

  .journey-home-link {
    left: max(0.75rem, env(safe-area-inset-left));
    right: max(0.75rem, env(safe-area-inset-right));
    justify-content: center;
  }
}


.section-index {
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.section-card {
  min-height: 210px;
  display: grid;
  gap: 0.65rem;
  align-content: start;
  padding: 1.1rem;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 246, 223, 0.92), rgba(243, 228, 199, 0.98)),
    radial-gradient(circle at 20% 20%, rgba(201, 145, 69, 0.18), transparent 35%);
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.section-card:hover {
  transform: translateY(-2px);
}

.section-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff8e8;
  border: 1px solid var(--line);
}

.section-card strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

.section-card span {
  line-height: 1.35;
}

.lesson-video-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--gold);
  border-radius: 0.45rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.lesson-video-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 500;
}

.lesson-video-card video,
.lesson-video-card iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

.video-link-row {
  margin: 0;
}

.notes-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.notes-actions .media-button {
  width: 100%;
}

.final-shell {
  display: block;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

@media (max-width: 620px) {
  .notes-actions {
    grid-template-columns: 1fr;
  }
}

/* Ambiente di studio 2026 ------------------------------------------------ */

:root {
  --study-topbar-h: 4.5rem;
  --study-bottom-h: 3.75rem;
  --study-panel: #fffaf0;
  --study-panel-2: #f2e4c9;
  --study-text: #241c15;
  --study-muted: #68584a;
  --study-border: #c49550;
  --study-focus: #087ea4;
  --study-highlight: #ffe268;
}

html[data-study-theme="dark"] {
  --study-panel: #172838;
  --study-panel-2: #21394d;
  --study-text: #fff8e8;
  --study-muted: #d7c9b4;
  --study-border: #d3a963;
  --study-highlight: #8c6f00;
}

html[data-study-font="large"] .lesson-content { font-size: 1.16rem; }
html[data-study-font="extra"] .lesson-content { font-size: 1.3rem; }

body.study-active {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  color: var(--study-text);
  background: #061d2f;
}

body.study-active > .site-header,
body.study-active > .site-footer {
  display: none;
}

.leopardi-study-app,
.leopardi-study-app * {
  box-sizing: border-box;
}

.leopardi-study-app {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: var(--study-topbar-h) minmax(0, 1fr) var(--study-bottom-h);
  width: 100%;
  height: 100dvh;
  color: var(--study-text);
  background: #061d2f;
}

.study-topbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) minmax(0, 3fr) minmax(12rem, 1fr);
  align-items: center;
  gap: .75rem;
  min-height: var(--study-topbar-h);
  padding: max(.4rem, env(safe-area-inset-top)) max(.8rem, env(safe-area-inset-right)) .4rem max(.8rem, env(safe-area-inset-left));
  color: #fff8e8;
  border-bottom: 1px solid rgba(211, 169, 99, .75);
  background: #061d2f;
}

.study-home {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  width: max-content;
  min-height: 44px;
  padding: .55rem .8rem;
  color: #fff8e8;
  border: 1px solid #c49550;
  border-radius: .5rem;
  text-decoration: none;
}

.study-heading {
  min-width: 0;
  text-align: center;
}

.study-heading small,
.visual-panel header small,
.notebook-panel header small,
.study-dialog header small {
  display: block;
  color: #a55a38;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.study-topbar .study-heading small { color: #e7c98d; }

.study-heading h1 {
  overflow: hidden;
  margin: .1rem 0 0;
  color: #fff8e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-actions {
  display: flex;
  justify-content: flex-end;
  gap: .4rem;
}

.study-actions button,
.reading-tools button,
.visual-choices button,
.notebook-actions button,
.study-bottombar button,
.study-dialog button,
.study-quiz > button,
.quiz-summary button {
  min-width: 44px;
  min-height: 44px;
  padding: .55rem .75rem;
  color: inherit;
  border: 1px solid var(--study-border);
  border-radius: .48rem;
  background: var(--study-panel);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.study-actions button {
  color: #241c15;
}

.study-actions button:focus-visible,
.reading-tools button:focus-visible,
.visual-choices button:focus-visible,
.notebook-actions button:focus-visible,
.study-bottombar button:focus-visible,
.study-dialog button:focus-visible,
.study-home:focus-visible,
.full-index a:focus-visible,
.lesson-content :focus-visible,
.notebook-panel textarea:focus-visible {
  outline: 3px solid var(--study-focus);
  outline-offset: 2px;
}

.study-actions button:disabled,
.reading-tools button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.mobile-study-tabs {
  display: none;
}

.study-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(20rem, 1fr);
  overflow: hidden;
  background: #e8dcc6;
}

.reading-pane {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  color: var(--study-text);
  background: var(--study-panel);
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.reading-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(12rem, 1.5fr) repeat(4, auto);
  align-items: center;
  gap: .45rem;
  padding: .55rem clamp(.75rem, 2vw, 1.4rem);
  border-bottom: 1px solid var(--study-border);
  background: color-mix(in srgb, var(--study-panel) 94%, transparent);
  backdrop-filter: blur(10px);
}

.reading-tools p {
  overflow: hidden;
  margin: 0;
  color: var(--study-muted);
  font-size: .82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-tools button {
  min-height: 40px;
  padding: .45rem .62rem;
  font-size: .78rem;
}

.reading-tools button:not(.quiet) {
  color: #fff;
  background: #7b2d1d;
}

.reading-tools #newHighlightCount {
  display: inline-grid;
  place-items: center;
  min-width: 1.45rem;
  height: 1.45rem;
  margin-left: .25rem;
  color: #7b2d1d;
  border-radius: 999px;
  background: #fff8e8;
}

.lesson-content {
  width: min(70rem, 100%);
  margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 3.2rem) 5rem;
  font-size: 1.04rem;
  line-height: 1.76;
}

.lesson-content .lesson-article {
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.lesson-content .lesson-article > h1 {
  margin-top: .25rem;
  color: inherit;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.05;
}

.lesson-content .lesson-article h2,
.lesson-content .lesson-article h3 {
  color: inherit;
  scroll-margin-top: 5rem;
}

.lesson-content .lesson-article p {
  max-width: 76ch;
}

.lesson-content .lesson-subtitle {
  color: var(--study-muted);
}

mark.student-highlight {
  color: inherit;
  background: var(--study-highlight);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.study-sidebar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(15rem, .9fr) minmax(18rem, 1.1fr);
  overflow: hidden;
  border-left: 1px solid var(--study-border);
  background: var(--study-panel-2);
}

.visual-panel,
.notebook-panel {
  min-height: 0;
  padding: .75rem;
  color: var(--study-text);
  background: var(--study-panel-2);
}

.visual-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: .45rem;
  overflow: hidden;
  border-bottom: 1px solid var(--study-border);
}

.visual-panel header,
.notebook-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
}

.visual-panel h2,
.notebook-panel h2 {
  margin: 0;
  color: inherit;
  font-size: 1.1rem;
}

.visual-stage {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--study-border);
  border-radius: .55rem;
  background: var(--study-panel);
  -webkit-overflow-scrolling: touch;
}

.visual-stage > * {
  width: 100%;
  margin: 0;
  color: inherit;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.visual-stage img,
.visual-stage iframe,
.visual-stage video {
  display: block;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.visual-stage iframe,
.visual-stage video {
  min-height: 13rem;
  aspect-ratio: 16 / 9;
}

.visual-stage .journey-context-card {
  padding: 1rem;
}

.visual-caption {
  margin: 0;
  color: var(--study-muted);
  font-size: .78rem;
  line-height: 1.25;
}

.visual-choices {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  padding-bottom: .15rem;
}

.visual-choices button {
  min-height: 38px;
  padding: .35rem .6rem;
  font-size: .72rem;
  white-space: nowrap;
}

.visual-choices button.active {
  color: #fff;
  background: #7b2d1d;
}

.notebook-panel {
  display: grid;
  grid-template-rows: auto auto minmax(5.5rem, .72fr) minmax(7rem, 1fr) auto;
  gap: .45rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.notebook-panel header span {
  color: var(--study-muted);
  font-size: .7rem;
}

.notebook-panel > label {
  font-size: .78rem;
  font-weight: 800;
}

.notebook-panel textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  padding: .7rem;
  color: var(--study-text);
  border: 1px solid var(--study-border);
  border-radius: .5rem;
  background: var(--study-panel);
  font: inherit;
  line-height: 1.45;
}

.citation-area {
  min-height: 0;
  overflow: auto;
  padding: .55rem;
  border: 1px solid var(--study-border);
  border-radius: .5rem;
  background: var(--study-panel);
  -webkit-overflow-scrolling: touch;
}

.citation-area h3 {
  position: sticky;
  top: -.55rem;
  z-index: 1;
  margin: -.55rem -.55rem .45rem;
  padding: .55rem;
  color: inherit;
  border-bottom: 1px solid var(--study-border);
  background: var(--study-panel);
  font-size: .86rem;
}

.citation-area blockquote {
  position: relative;
  margin: 0;
  padding: .65rem 2.5rem .65rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--study-border) 55%, transparent);
}

.citation-area blockquote:last-child { border-bottom: 0; }
.citation-area blockquote p { margin: 0; font-size: .86rem; line-height: 1.45; }

.citation-area blockquote button {
  position: absolute;
  top: .35rem;
  right: 0;
  min-width: 38px;
  min-height: 38px;
  padding: .25rem;
  color: #7b2d1d;
  border: 0;
  background: transparent;
  font-size: .68rem;
}

.citation-area #emptyCitations {
  margin: .25rem 0;
  color: var(--study-muted);
  font-size: .82rem;
  line-height: 1.35;
}

.notebook-actions {
  position: sticky;
  bottom: -.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
  padding: .4rem 0 max(.2rem, env(safe-area-inset-bottom));
  background: var(--study-panel-2);
}

.notebook-actions .danger { color: #fff; background: #7b2d1d; }

.study-bottombar {
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  padding: .4rem max(.8rem, env(safe-area-inset-right)) max(.4rem, env(safe-area-inset-bottom)) max(.8rem, env(safe-area-inset-left));
  border-top: 1px solid var(--study-border);
  background: #061d2f;
}

.study-bottombar button {
  min-height: 42px;
  color: #fff8e8;
  background: #183b55;
}

.study-dialog {
  width: min(54rem, calc(100% - 2rem));
  max-height: min(82dvh, 52rem);
  overflow: auto;
  padding: clamp(1rem, 3vw, 2rem);
  color: var(--study-text);
  border: 1px solid var(--study-border);
  border-radius: .8rem;
  background: var(--study-panel);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .45);
}

.study-dialog::backdrop { background: rgba(1, 13, 22, .76); }

.study-dialog .dialog-close {
  position: sticky;
  top: 0;
  z-index: 3;
  float: right;
  border-radius: 50%;
  font-size: 1.35rem;
}

.study-dialog header h2 {
  margin: .2rem 0 1rem;
  color: inherit;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.full-index {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.full-index a {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  align-items: center;
  gap: .65rem;
  min-height: 3.5rem;
  padding: .55rem;
  color: inherit;
  border: 1px solid var(--study-border);
  border-radius: .5rem;
  text-decoration: none;
}

.full-index a span {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  color: #fff;
  border-radius: 50%;
  background: #7b2d1d;
}

.full-index a[aria-current="page"] { background: var(--study-panel-2); }

.essentials-list {
  display: grid;
  gap: .55rem;
}

.essentials-list p {
  margin: 0;
  padding: .75rem 1rem;
  border-left: 4px solid #7b2d1d;
  background: var(--study-panel-2);
  line-height: 1.5;
}

.vocabulary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.vocabulary-list div {
  padding: .75rem;
  border: 1px solid var(--study-border);
  border-radius: .5rem;
}

.vocabulary-list dt { font-weight: 800; }
.vocabulary-list dd { margin: .3rem 0 0; color: var(--study-muted); line-height: 1.45; }

.study-quiz {
  display: grid;
  gap: .8rem;
}

.study-quiz fieldset {
  display: grid;
  gap: .45rem;
  padding: .85rem;
  border: 1px solid var(--study-border);
  border-radius: .55rem;
}

.study-quiz fieldset.is-correct { border-color: #2d7d46; }
.study-quiz fieldset.is-wrong { border-color: #a33b2c; }
.study-quiz legend { padding: 0 .4rem; font-weight: 800; }

.study-quiz label {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .45rem;
  border-radius: .4rem;
  background: var(--study-panel-2);
  cursor: pointer;
}

.study-quiz input { width: 1.15rem; height: 1.15rem; }

.question-feedback {
  padding: .65rem;
  border-radius: .4rem;
  background: color-mix(in srgb, var(--study-panel-2) 78%, #fff);
  line-height: 1.45;
}

.grade-formula { margin: 0; color: var(--study-muted); font-size: .85rem; }

.quiz-summary {
  padding: .85rem;
  border: 1px solid var(--study-border);
  border-radius: .55rem;
  background: var(--study-panel-2);
}

@media (max-width: 1120px) {
  .reading-tools {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .reading-tools p { grid-column: 1 / -1; }
  .reading-tools button { white-space: normal; }
}

@media (max-width: 900px) {
  :root { --study-topbar-h: 7.85rem; }

  .study-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 4rem 3.35rem;
  }

  .mobile-study-tabs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .4rem;
  }

  .mobile-study-tabs button {
    min-height: 44px;
    color: #fff8e8;
    border: 1px solid #c49550;
    border-radius: .45rem;
    background: #183b55;
    font: inherit;
    font-weight: 700;
  }

  .mobile-study-tabs button.active { color: #241c15; background: #fff8e8; }

  .study-grid { display: block; }
  .reading-pane,
  .study-sidebar { width: 100%; height: 100%; }
  .study-sidebar { border-left: 0; }
  .study-grid[data-visible-panel="read"] .study-sidebar { display: none; }
  .study-grid[data-visible-panel="visual"] .reading-pane,
  .study-grid[data-visible-panel="notes"] .reading-pane { display: none; }
  .study-grid[data-visible-panel="visual"] .study-sidebar { grid-template-rows: 1fr; }
  .study-grid[data-visible-panel="visual"] .notebook-panel { display: none; }
  .study-grid[data-visible-panel="notes"] .study-sidebar { grid-template-rows: 1fr; }
  .study-grid[data-visible-panel="notes"] .visual-panel { display: none; }

  .notebook-panel { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 620px) {
  :root { --study-topbar-h: 7.7rem; --study-bottom-h: 4.15rem; }
  .study-topbar { gap: .35rem; padding-inline: .45rem; }
  .study-home span { display: none; }
  .study-actions button { padding: .4rem; font-size: .75rem; }
  .study-heading h1 { font-size: .95rem; }
  .reading-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-content { padding-inline: 1rem; }
  .full-index,
  .vocabulary-list { grid-template-columns: 1fr; }
  .study-bottombar { gap: .25rem; padding-inline: .35rem; }
  .study-bottombar button { padding: .35rem; font-size: .72rem; line-height: 1.1; }
}

@media (prefers-reduced-motion: reduce) {
  .leopardi-study-app *,
  .leopardi-study-app *::before,
  .leopardi-study-app *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}


/* Revisione editoriale e recupero guidato */
.technical-source { display: none !important; }
.lesson-brief {
  margin: 2rem 0 0;
  padding: 1.25rem 1.4rem;
  border-left: 4px solid #b98636;
  border-radius: 0.75rem;
  background: rgba(185, 134, 54, 0.12);
}
.lesson-brief small {
  display: block;
  color: #8a5d1f;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lesson-brief h2 { margin: 0.2rem 0 0.65rem; }
.lesson-brief p { margin: 0; }
.citation-source {
  display: block;
  margin: 0.45rem 0 0.6rem;
  color: #6c5638;
  font-weight: 700;
}
.recovery-link {
  margin-top: 0.7rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #b98636;
  border-radius: 0.55rem;
  background: #fff6df;
  color: #4a2f10;
  font-weight: 800;
  cursor: pointer;
}
.recovery-focus {
  outline: 4px solid rgba(185, 134, 54, 0.55);
  outline-offset: 6px;
  border-radius: 0.4rem;
  transition: outline-color 0.5s ease;
}
.conclusion-next {
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(185, 134, 54, 0.65);
  border-radius: 0.75rem;
  background: rgba(6, 29, 47, 0.06);
}
.conclusion-next a { font-weight: 800; }
