/* Silvio Orlandi — refactor static site */

@import url("https://fonts.googleapis.com/css2?family=Megrim&family=Raleway:ital,wght@0,400;0,700;1,400&family=Open+Sans:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --color-bg: #f5f5f5;
  --color-surface: #fff;
  --color-text: #333;
  --color-muted: #666;
  --color-nav-bg: #222;
  --color-nav-text: #9d9d9d;
  --color-nav-hover: #fff;
  --color-accent: #c9a227;
  --container: 1170px;
  --font-body: "Raleway", "Open Sans", system-ui, sans-serif;
  --font-display: "Megrim", cursive;
  --space: 1rem;
  --radius: 4px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: #1a6b8a;
}

a:hover {
  text-decoration: underline;
}

.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;
}

.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* —— Top nav —— */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-nav-bg);
  border-bottom: 1px solid #080808;
}

.site-nav__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  gap: 0;
}

.site-nav__panel {
  display: flex;
  flex: 0 1 auto;
  justify-content: center;
}

.site-nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.site-nav__toggle-bar {
  width: 22px;
  height: 2px;
  background: #888;
  border-radius: 1px;
}

.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.site-nav__list > li {
  position: relative;
}

.site-nav__list a {
  display: block;
  padding: 12px 14px;
  color: var(--color-nav-text);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav__list a:hover,
.site-nav__list a:focus-visible {
  color: var(--color-nav-hover);
  background: rgba(255, 255, 255, 0.06);
}

.site-nav__list a[aria-current="page"] {
  color: var(--color-nav-hover);
  background: #080808;
}

.site-nav__caret {
  margin-left: 0.25em;
  font-size: 0.7em;
}

.site-nav__sub {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
  display: none;
  z-index: 10;
}

.site-nav__list li:hover > .site-nav__sub,
.site-nav__list li:focus-within > .site-nav__sub {
  display: block;
}

.site-nav__sub a {
  color: #333;
  padding: 8px 16px;
}

.site-nav__sub a:hover {
  background: #f0f0f0;
  color: #111;
}

@media (max-width: 900px) {
  .site-nav__toggle {
    display: flex;
  }

  .site-nav__panel {
    display: none;
    width: 100%;
    flex-basis: 100%;
    order: 3;
    border-top: 1px solid #333;
    padding-bottom: 0.5rem;
    justify-content: stretch;
  }

  .site-nav__panel.is-open {
    display: block;
  }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav__list a {
    padding: 12px 8px;
  }

  .site-nav__sub {
    position: static;
    display: block;
    box-shadow: none;
    border: 0;
    background: #2a2a2a;
    border-radius: 0;
    padding-left: 1rem;
  }

  .site-nav__sub a {
    color: #ccc;
  }
}

/* —— Hero / title card —— */
.hero {
  position: relative;
  padding: clamp(4.5rem, 10vw, 6.5rem) var(--space) clamp(2.5rem, 7vw, 4rem);
  margin-top: 0;
  background-color: #1a1a1a;
  background-image: url("../images/hero.png");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  min-height: min(72vh, 640px);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.32));
  z-index: 0;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
}

.hero__text {
  flex: 1 1 280px;
}

.hero .site-title {
  color: #fff;
}

.hero .site-title a {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-title a:hover {
  opacity: 0.85;
}

.site-tagline {
  margin: 0rem 0 0;
  font-style: italic;
  color: var(--color-muted);
}

.in-progress {
  color: var(--color-muted);
  opacity: 1;
}

.hero .site-tagline {
  color: rgba(255, 255, 255, 0.9);
}

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.55rem 1.25rem;
  font-size: 1rem;
  text-decoration: none;
  color: #333;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn:hover {
  background: #eee;
}

.hero .btn {
  color: #222;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.hero .btn:hover {
  background: #fff;
}

/* Home (index): sfondo a tutto viewport, titolo centrato */
.hero--full {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  margin: 0;
  padding: max(4.5rem, env(safe-area-inset-top, 0px) + 2.75rem) var(--space)
    max(1.5rem, env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.hero--full .hero__inner {
  flex: 0 1 auto;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero--full .hero__text {
  flex: 0 1 auto;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

/* —— Main layout —— */
main {
  flex: 1;
}

/* Nav fissa: spazio in alto sulle pagine senza hero */
header:not(:has(.hero)) + main {
  padding-top: 3.75rem;
}

.layout {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem var(--space) 3rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.content {
  background: var(--color-surface);
  padding: 1.75rem 2rem;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.content h1 {
  margin-top: 0;
  font-size: 1.85rem;
  font-weight: 600;
}

.content h2 {
  margin-top: 1.75rem;
  font-size: 1.35rem;
}

.content p,
.content li {
  max-width: 65ch;
}

.content ul {
  padding-left: 1.25rem;
}

.sidebar {
  background: #fafafa;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid #e8e8e8;
}

.sidebar h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  text-transform: lowercase;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar a {
  display: block;
  padding: 0.35rem 0;
  color: var(--color-text);
  text-decoration: none;
}

.sidebar a:hover {
  color: #1a6b8a;
}

.sidebar a[aria-current="page"] {
  font-weight: 600;
  color: #111;
}

/* Media & embeds */
.figure {
  margin: 1.5rem 0;
}

.figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.figure-gallery {
  margin-top: 1.5rem;
}

/* Galleria foto: immagine grande + miniature; lightbox su click */
.photo-gallery {
  margin-top: 1.75rem;
}

.photo-gallery__main {
  margin: 0;
}

.photo-gallery__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  border-radius: var(--radius);
  overflow: hidden;
}

.photo-gallery__open:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.photo-gallery__open img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70vh, 900px);
  object-fit: contain;
  margin: 0 auto;
  border-radius: var(--radius);
  background: #eee;
}

.photo-gallery__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: flex-start;
}

.photo-gallery__thumb {
  flex: 0 0 auto;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  line-height: 0;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.photo-gallery__thumb:hover {
  border-color: #ccc;
}

.photo-gallery__thumb:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.photo-gallery__thumb.is-active {
  border-color: var(--color-accent);
}

.photo-gallery__thumb img {
  display: block;
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .photo-gallery__thumb img {
    width: 72px;
    height: 54px;
  }
}

.photo-gallery__lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem 1rem;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
  box-sizing: border-box;
}

.photo-gallery__lightbox[hidden] {
  display: none !important;
}

.photo-gallery__lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default;
  border-radius: var(--radius);
}

.photo-gallery__lightbox-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 3001;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.photo-gallery__lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.caption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  background: #000;
}

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

/* Video 4:3 (es. incorporamenti storici) */
.embed--4-3 {
  padding-bottom: 75%;
}

/* —— Footer —— */
.site-footer {
  margin-top: auto;
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  padding: 1.5rem var(--space);
  font-size: 0.9rem;
}

.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}
