/* teaching: stile condiviso.
   Le classi tg-* servono all'indice e alla barra iniettata nelle attività:
   non toccano lo stile interno delle singole pagine. */

:root {
  --tg-bg: #f6f4ef;
  --tg-paper: #ffffff;
  --tg-ink: #1d2433;
  --tg-mute: #5d6474;
  --tg-line: #e3dfd5;
  --tg-acc: #2f5bea;
  --tg-hl: #f2b632;
  --tg-shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 6px 18px rgba(29, 36, 51, .06);
  --tg-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tg-mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tg-home, :root:not([data-theme="light"]) body.tg-home {
    --tg-bg: #14171d; --tg-paper: #1c2028; --tg-ink: #e8eaf0; --tg-mute: #a2a8b6;
    --tg-line: #2c313c; --tg-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] body.tg-home {
  --tg-bg: #14171d; --tg-paper: #1c2028; --tg-ink: #e8eaf0; --tg-mute: #a2a8b6;
  --tg-line: #2c313c; --tg-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .25);
}

/* ---------- pagine indice ---------- */

body.tg-home {
  margin: 0; background: var(--tg-bg); color: var(--tg-ink);
  font-family: var(--tg-sans); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.tg-home *, .tg-home *::before, .tg-home *::after { box-sizing: border-box; }
.tg-wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.tg-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0; }
.tg-logo { font-family: var(--tg-mono); font-weight: 700; font-size: 18px; color: var(--tg-ink); text-decoration: none; letter-spacing: -.01em; }
.tg-logo span { display: inline-block; width: .6em; height: .14em; margin-left: .08em; background: var(--tg-hl); vertical-align: baseline; animation: tg-blink 1.1s steps(1) infinite; }
@keyframes tg-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tg-logo span { animation: none; } }

.tg-iconbtn {
  border: 1px solid var(--tg-line); background: var(--tg-paper); color: var(--tg-ink);
  border-radius: 999px; padding: 7px 12px; font: 500 14px var(--tg-sans); cursor: pointer;
}
.tg-iconbtn:hover { border-color: var(--tg-mute); }

.tg-hero { padding: 36px 0 26px; }
.tg-hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 12px; max-width: 18ch; }
.tg-hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--tg-hl) 55%, transparent) 62%); }
.tg-hero p { margin: 0; color: var(--tg-mute); font-size: 17px; max-width: 60ch; }
.tg-crumb { font-family: var(--tg-mono); font-size: 13px; color: var(--tg-mute); margin-bottom: 10px; }
.tg-crumb a { color: inherit; }

.tg-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0 22px; }
.tg-chip {
  border: 1px solid var(--tg-line); background: var(--tg-paper); color: var(--tg-ink);
  border-radius: 999px; padding: 7px 14px; font: 500 14px var(--tg-sans); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.tg-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--tg-mute)); }
.tg-chip[aria-pressed="true"] { background: var(--tg-ink); color: var(--tg-bg); border-color: var(--tg-ink); }
.tg-search {
  margin-left: auto; min-width: 220px; flex: 0 1 280px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--tg-line); background: var(--tg-paper); color: var(--tg-ink); font: 15px var(--tg-sans);
}
.tg-search:focus, .tg-chip:focus-visible, .tg-card:focus-visible, .tg-iconbtn:focus-visible {
  outline: 2px solid var(--tg-acc); outline-offset: 2px;
}

.tg-course { margin: 8px 0 34px; }
.tg-course > h2 { display: flex; align-items: baseline; gap: 10px; font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
.tg-course > h2 a { color: inherit; text-decoration: none; }
.tg-course > h2 small { font: 500 13px var(--tg-mono); color: var(--tg-mute); }
.tg-course > h2::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--c); align-self: center; }
.tg-unit { font: 600 12px var(--tg-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--tg-mute); margin: 18px 0 10px; }
.tg-unit a { color: inherit; text-decoration: none; }
.tg-unit a:hover { color: var(--tg-ink); }

.tg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tg-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 150px;
  background: var(--tg-paper); border: 1px solid var(--tg-line); border-radius: 14px;
  padding: 16px 16px 14px 20px; color: inherit; text-decoration: none; box-shadow: var(--tg-shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.tg-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.tg-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 45%, var(--tg-line)); }
.tg-card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.tg-card p { margin: 0; color: var(--tg-mute); font-size: 14px; flex: 1; }
.tg-meta { display: flex; justify-content: space-between; align-items: center; font: 500 12px var(--tg-mono); color: var(--tg-mute); padding-top: 6px; }
.tg-meta b { font-weight: 500; color: var(--c); }
.tg-empty { color: var(--tg-mute); padding: 30px 0; }

.tg-foot { border-top: 1px solid var(--tg-line); margin-top: 30px; padding: 22px 0 40px; color: var(--tg-mute); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.tg-foot a { color: inherit; }

/* ---------- barra nelle pagine delle attività ---------- */

.tg-bar {
  display: flex; align-items: center; gap: 12px; padding: 0 14px; height: 40px;
  background: #1d2433; color: #cfd5e2; font: 13px/1 var(--tg-sans); position: relative; z-index: 50;
}
.tg-bar a { color: inherit; text-decoration: none; }
.tg-bar a:hover { color: #fff; }
.tg-bar .tg-logo { color: #fff; font-size: 15px; }
.tg-bar .tg-path { display: flex; gap: 6px; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tg-bar .tg-path span { opacity: .5; }
.tg-bar button {
  margin-left: auto; background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px; padding: 5px 11px; font: 12px var(--tg-sans); cursor: pointer; white-space: nowrap;
}
.tg-bar button:hover { color: #fff; border-color: rgba(255, 255, 255, .55); }
@media (max-width: 560px) { .tg-bar .tg-path { display: none; } }
@media print { .tg-bar { display: none; } }

@media (max-width: 560px) { .tg-search { flex: 1 1 100%; margin-left: 0; min-width: 0; } }
