/* Palette e tipografia allineate a lib/main.dart (ThemeData light/dark). */

@font-face {
  font-family: "Cinzel";
  src: url("/fonts/Cinzel-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cinzel";
  src: url("/fonts/Cinzel-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #f5efe0;
  --bg-tint: #efe6d2;
  --surface: #ffffff;
  --surface-border: #ebdcc1;
  --ink: #2d1810;
  --ink-soft: #4a3728;
  --ink-faint: #7a6552;
  --gold: #8b6914;
  --gold-bright: #b8860b;
  --rule: rgba(212, 160, 23, 0.32);
  --bar: #3e2723;
  --bar-ink: #f5e6cc;
  --shadow: 0 2px 10px rgba(45, 24, 16, 0.08);
  --radius: 16px;
  --display: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --body: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-tint: #161310;
    --surface: #191613;
    --surface-border: #332a1d;
    --ink: #f0e6d2;
    --ink-soft: #d8cbb4;
    --ink-faint: #9b8b74;
    --gold: #d4a017;
    --gold-bright: #daa520;
    --rule: rgba(218, 165, 32, 0.28);
    --bar: #17130f;
    --bar-ink: #f0e6d2;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background-color: var(--bg);
  /* Sfumatura calda "pergamena", come lo sfondo delle schermate di preghiera. */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-tint), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, var(--bg-tint), transparent 70%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: min(100% - 2.5rem, 780px);
  margin-inline: auto;
}

/* ---------- Barra superiore (ispirata all'AppBar dell'app) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar);
  border-bottom: 1px solid rgba(212, 160, 23, 0.25);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
  padding-block: 0.5rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--bar-ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: block;
}

.topbar nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.topbar nav a {
  color: var(--bar-ink);
  text-decoration: none;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  opacity: 0.82;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.topbar nav a:hover {
  opacity: 1;
  border-color: rgba(218, 165, 32, 0.5);
}

.topbar nav a[aria-current="page"] {
  opacity: 1;
  border-color: rgba(218, 165, 32, 0.65);
  color: #f0d9a8;
}

/* ---------- Intestazione di pagina ---------- */

.page-head {
  padding: 3.25rem 0 1.5rem;
  text-align: center;
}

.page-head .eyebrow {
  font-family: var(--display);
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.75rem;
}

h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--ink);
}

.page-head .lede {
  max-width: 46ch;
  margin: 1rem auto 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

.updated {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* Filetto ornamentale con rombo centrale. */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 2rem 0 2.5rem;
  color: var(--gold-bright);
}

.rule::before,
.rule::after {
  content: "";
  height: 1px;
  flex: 1;
  max-width: 180px;
  background: linear-gradient(to right, transparent, var(--rule), transparent);
}

.rule span {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: currentColor;
  opacity: 0.75;
}

/* ---------- Contenuto ---------- */

main {
  padding-bottom: 4rem;
}

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.32rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  color: var(--ink);
}

h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  margin: 1.75rem 0 0.5rem;
  color: var(--gold);
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
}

li {
  margin-bottom: 0.45rem;
}

li::marker {
  color: var(--gold-bright);
}

a {
  color: var(--gold);
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--gold-bright);
  text-decoration-color: currentColor;
}

strong {
  color: var(--ink);
  font-weight: 700;
}

/* Sezione numerata: il numero vive nel margine come una miniatura. */
.section {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem 1.6rem 0.9rem;
  margin-bottom: 1.1rem;
}

.section > :last-child {
  margin-bottom: 1rem;
}

.section .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  font-family: var(--display);
  font-size: 0.85rem;
  color: var(--gold);
}

.note {
  border-left: 3px solid var(--gold-bright);
  background: color-mix(in srgb, var(--gold-bright) 7%, transparent);
  border-radius: 0 10px 10px 0;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.note p:last-child {
  margin-bottom: 0;
}

/* ---------- Indice ---------- */

.toc {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.toc h2 {
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.3rem;
  columns: 2;
  column-gap: 2rem;
  font-size: 0.94rem;
}

.toc li {
  margin-bottom: 0.3rem;
  break-inside: avoid;
}

@media (max-width: 560px) {
  .toc ol {
    columns: 1;
  }
}

/* ---------- FAQ ---------- */

.faq {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.faq details {
  border-bottom: 1px solid var(--surface-border);
}

.faq details:last-child {
  border-bottom: none;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.05rem 3rem 1.05rem 1.4rem;
  position: relative;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.4rem;
  top: 50%;
  translate: 0 -50%;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--gold-bright);
  transition: rotate 0.2s ease;
}

.faq details[open] summary::after {
  rotate: 45deg;
}

.faq summary:hover {
  background: color-mix(in srgb, var(--gold-bright) 6%, transparent);
}

.faq .answer {
  padding: 0 1.4rem 1.2rem;
  color: var(--ink-soft);
  font-size: 0.97rem;
}

.faq .answer > :last-child {
  margin-bottom: 0;
}

/* ---------- Riquadro contatto / call to action ---------- */

.contact {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
}

.contact h2 {
  margin-bottom: 0.5rem;
}

.contact p {
  color: var(--ink-soft);
  max-width: 44ch;
  margin-inline: auto;
}

.btn {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.7rem 1.6rem;
  border-radius: 12px;
  background: var(--gold-bright);
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(139, 105, 20, 0.32);
  transition: translate 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  color: #fff;
  translate: 0 -1px;
  box-shadow: 0 5px 14px rgba(139, 105, 20, 0.4);
}

/* ---------- Home ---------- */

.hero {
  text-align: center;
  padding: 3.5rem 0 0;
}

.hero img {
  width: 104px;
  height: 104px;
  border-radius: 24px;
  box-shadow: 0 8px 26px rgba(45, 24, 16, 0.22);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card-link {
  display: block;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  text-decoration: none;
  color: inherit;
  transition: translate 0.15s ease, border-color 0.15s ease;
}

.card-link:hover {
  translate: 0 -2px;
  border-color: var(--rule);
  color: inherit;
}

.card-link h2 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.card-link p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-faint);
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--rule);
  padding: 1.75rem 0 2.5rem;
  color: var(--ink-faint);
  font-size: 0.87rem;
}

footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
}

footer nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
