/* leggiopasqua.com — plain CSS, system fonts, no build step. */

:root {
  --bg: #faf8f4;
  --fg: #1d1d1b;
  --muted: #55524c;
  --accent: #1f4a6b;
  --rule: #d9d4c8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141516;
    --fg: #e9e6df;
    --muted: #a9a59c;
    --accent: #8db7d8;
    --rule: #33363a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
}

/* ---- Language switching -------------------------------------------------
   Both languages are in the markup. <html lang> is set by the inline script
   in index.html; the :target rules make the language links work without JS. */

body > [lang="it"] { display: none; }

html[lang="it"] body > [lang="it"] { display: block; }
html[lang="it"] body > [lang="en"] { display: none; }

html:has(#it:target) body > [lang="it"] { display: block; }
html:has(#it:target) body > [lang="en"] { display: none; }

html:has(#en:target) body > [lang="en"] { display: block; }
html:has(#en:target) body > [lang="it"] { display: none; }

#it, #en { position: absolute; top: 0; left: 0; }

/* ---- Layout ------------------------------------------------------------ */

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}

.masthead p { margin: 0; }

.name {
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.where {
  margin-top: 0.15rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
}

.switch {
  flex: none;
  font-size: 0.875rem;
  padding: 0.35rem 0.6rem;
  margin: -0.35rem -0.6rem 0 0;
}

.book {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.book:hover,
.book:focus-visible {
  background: var(--accent);
  color: var(--bg);
}

/* ---- Type -------------------------------------------------------------- */

h1 {
  margin: 2.25rem 0 1.25rem;
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h2 {
  margin: 3rem 0 0.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h3 {
  margin: 1.5rem 0 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
}

p { margin: 0.6rem 0 0; }

.lede {
  font-size: 1.25rem;
  line-height: 1.55;
}

.intro p:last-child { color: var(--muted); }

/* ---- Stats --------------------------------------------------------------
   A few figures pulled out of the prose below, for a reader skimming
   before they commit to reading the case study. */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 1rem;
  margin: 1.75rem 0 0.5rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--rule);
  list-style: none;
}

.stats__n {
  display: block;
  font-family: var(--sans);
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stats__l {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted);
}

@media (min-width: 30em) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 150ms ease;
}

a:hover { text-decoration-thickness: 2px; }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Contact ----------------------------------------------------------- */

.contact {
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.contact li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
}

.contact li:last-child { border-bottom: 1px solid var(--rule); }

.label {
  min-width: 5.5rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: baseline;
}

.contact a { overflow-wrap: anywhere; }

/* ---- Footer ------------------------------------------------------------ */

footer {
  margin-top: 3rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
}

footer p { margin: 0; }

@media (min-width: 40em) {
  .page { padding-top: 2.5rem; }
  h1 { margin-top: 3.5rem; }
}

@media print {
  .switch { display: none; }
  body { background: #fff; color: #000; }
}

/* ---- Motion --------------------------------------------------------------
   A quiet entrance for the top of the page on load, and — in browsers that
   support scroll-driven animation — a gentle rise for each section as it's
   scrolled to. Both are CSS only, no JS, and switched off entirely if the
   reader prefers reduced motion; older browsers just see static sections. */

@media (prefers-reduced-motion: no-preference) {
  .masthead, .intro h1, .intro .lede, .intro p:not(.lede), .stats {
    animation: rise 0.6s cubic-bezier(.2, .7, .3, 1) both;
  }
  .masthead            { animation-delay: 0s; }
  .intro h1            { animation-delay: 0.08s; }
  .intro .lede         { animation-delay: 0.16s; }
  .intro p:not(.lede)  { animation-delay: 0.24s; }
  .stats               { animation-delay: 0.32s; }

  @supports (animation-timeline: view()) {
    main section:not(.intro) {
      animation: rise 0.5s ease-out both;
      animation-timeline: view();
      animation-range: entry 0% cover 30%;
    }
  }

  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
