/*
Theme Name: Base
Description: Minimal starter theme.
Version: 0.1.0
Requires at least: 6.0
Requires PHP: 8.1
Text Domain: base
*/

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 6rem; }
body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--gold-ink); }
::selection { background: var(--gold); color: var(--navy); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
html { scrollbar-color: var(--navy) var(--stone); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 var(--space-2);
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
p { margin: 0 0 var(--space-2); }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 1rem; left: 1rem; z-index: 100; clip: auto; width: auto; height: auto;
  background: var(--white); color: var(--navy); padding: 0.75rem 1rem; border-radius: var(--radius);
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter, 1.5rem));
  margin-inline: auto;
  padding-inline: var(--gutter, 1.5rem);
}
@media (max-width: 600px) { :root { --gutter: 1.125rem; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font: 600 var(--step--1)/1 var(--sans);
  letter-spacing: 0.02em;
  padding: 1em 1.6em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn--gold { background: var(--gold); color: var(--navy); }
.btn--gold:hover { background: #c9a352; color: var(--navy); }
.btn--outline { border-color: currentColor; color: var(--white); background: transparent; }
.btn--outline:hover { background: var(--white); color: var(--navy); }
.btn--navy { background: var(--navy); color: var(--white); }
.btn--navy:hover { background: var(--navy-deep); color: var(--white); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 4.5rem; }
.site-brand { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--navy); }
.site-brand:hover { color: var(--navy); }
.site-brand small { display: block; font-family: var(--sans); font-weight: 400; font-size: 0.75rem; color: var(--text-soft); letter-spacing: 0.02em; }

.primary-nav { margin-left: auto; }
.gate-exit { display: inline-flex; align-items: center; gap: 0.4em; color: var(--gold-ink); font-weight: 600; font-size: 0.95rem; text-decoration: none; padding-block: 0.4rem; border-bottom: 1px solid transparent; }
.gate-exit svg { flex: none; }
.gate-exit:hover { color: var(--gold-ink); border-bottom-color: var(--gold); }
.primary-nav ul { display: flex; align-items: center; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.primary-nav a { text-decoration: none; font-size: 0.95rem; padding-block: 0.4rem; border-bottom: 1px solid transparent; }
.primary-nav a:hover { color: var(--navy); border-bottom-color: var(--gold); }
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a,
.primary-nav .current-menu-ancestor > a { border-bottom-color: var(--navy); }
.primary-nav .menu-area-clienti > a { color: var(--gold-ink); font-weight: 600; }
.primary-nav .menu-area-clienti > a::before {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.4em; vertical-align: -0.05em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 0.55rem 0.7rem; color: var(--navy); cursor: pointer; }
.nav-toggle svg { display: block; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .gate-exit { margin-left: auto; }
  .primary-nav { display: none; position: absolute; inset: 100% 0 auto; background: var(--white); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px -16px rgb(21 36 61 / .35); }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: var(--space-1) var(--gutter, 1.5rem) var(--space-3); }
  .primary-nav a { display: block; padding-block: 0.85rem; border-bottom: 1px solid var(--line); }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-deep); color: var(--on-navy-soft); font-size: 0.95rem; }
.site-footer a { color: var(--white); }
.site-footer a:hover { color: var(--gold); }
.site-footer__main { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: var(--space-4); padding-block: var(--space-5) var(--space-4); }
@media (max-width: 860px) { .site-footer__main { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); } }
.site-footer h2 { font-family: var(--serif); color: var(--white); font-size: 1.2rem; margin-bottom: var(--space-1); }
.site-footer h3 { font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin: 0 0 var(--space-1); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.site-footer address { font-style: normal; display: grid; gap: 0.35rem; }
.site-footer__legal { border-top: 1px solid rgb(255 255 255 / .12); padding-block: var(--space-3); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); font-size: 0.85rem; }
.placeholder-mark { color: #f0c36b; }

/* ---------- Sections ---------- */
.section { padding-block: var(--space-5) var(--space-6); }
.section--stone { background: var(--stone); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-4); }
.section__head h2 { margin: 0; }
.link-arrow { font-weight: 600; font-size: var(--step--1); color: var(--gold-ink); text-decoration: none; }
.link-arrow:hover { text-decoration: underline; }

/* ---------- News ---------- */
.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
@media (max-width: 960px) { .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .news-grid { grid-template-columns: minmax(0, 1fr); } }
.news-card {
  position: relative; display: flex; flex-direction: column; gap: var(--space-1);
  background: var(--white); padding: var(--space-3); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(21 36 61 / .06), 0 8px 24px -16px rgb(21 36 61 / .25);
  transition: box-shadow .25s ease, transform .25s ease;
}
.news-card:hover { box-shadow: 0 2px 4px rgb(21 36 61 / .08), 0 16px 32px -16px rgb(21 36 61 / .35); transform: translateY(-2px); }
.news-card__date { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.news-card h3 { font-size: 1.2rem; line-height: 1.3; margin: 0; }
.news-card h3 a { text-decoration: none; }
.news-card h3 a::after { content: ""; position: absolute; inset: 0; }
/* The whole card is the link, so the focus ring goes around the card, not just the title. */
.news-card h3 a:focus-visible { outline: none; }
.news-card:has(h3 a:focus-visible) { outline: 2px solid var(--gold); outline-offset: 3px; }
.news-card p { color: var(--text-soft); font-size: 0.95rem; margin: 0; }
.section--stone .news-card { background: var(--white); }
.section:not(.section--stone) .news-card { background: var(--stone); box-shadow: none; }

.empty-state { background: var(--stone); padding: var(--space-4); border-radius: var(--radius); color: var(--text-soft); max-width: 44rem; }
.empty-state h3 { color: var(--navy); }
.section--stone .empty-state { background: var(--white); }

.pagination { margin-top: var(--space-4); display: flex; gap: var(--space-1); flex-wrap: wrap; }
.pagination .page-numbers { min-width: 2.5rem; padding: 0.5rem 0.8rem; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.pagination .current { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ---------- Pages and posts ---------- */
.page-header { background: var(--navy); color: var(--white); padding-block: var(--space-5) var(--space-4); }
.page-header h1 { color: var(--white); margin: 0; font-size: var(--step-3); }
.page-header p { color: var(--on-navy-soft); margin: var(--space-2) 0 0; max-width: 60ch; }
.page-header .meta { font-size: var(--step--1); color: var(--gold); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 var(--space-2); }

.entry { padding-block: var(--space-5) var(--space-6); }

/* ---------- Password gate ---------- */
.gate-page { background: var(--navy-deep); color: var(--white); }
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-3) var(--gutter, 1.5rem); }
.gate__form { width: 100%; max-width: 30rem; display: grid; gap: var(--space-3); }
/* Site name on a single line: fluid size so it still fits narrow phones. */
.gate__title { font-size: min(var(--step-3), 8vw); white-space: nowrap; margin: 0; color: var(--white); text-align: center; }
/* Field, error and button narrower than the title, centred under it. */
.gate__form > :not(.gate__title, .gate__lead) { width: 100%; max-width: 24rem; justify-self: center; }
.gate__lead { margin: calc(var(--space-2) * -1) 0 0; text-align: center; color: var(--on-navy-soft); }
.gate__field { display: grid; gap: 0.4rem; margin-top: 1.5rem; }
.gate__field label { font-weight: 600; font-size: var(--step--1); }
.gate__field input {
  width: 100%; font: inherit; color: var(--text);
  padding: 0.8rem 0.9rem; border: 1px solid transparent; border-radius: var(--radius); background: var(--white);
}
.gate__field input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.gate__error { margin: 0; color: #f5b7b7; font-size: var(--step--1); }
.gate .btn { justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Featured image on single posts */
.entry-figure { margin: 0 0 2rem; }
.entry-figure img { display: block; width: 100%; height: auto; }

/* ---------- Approfondimenti cards (photo on top, title on a solid navy band) ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
@media (max-width: 960px) { .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .topic-grid { grid-template-columns: minmax(0, 1fr); } }
.topic-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--navy); border-radius: var(--radius); overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.topic-card:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -16px rgb(21 36 61 / .5); }
/* The photo is shown in full colour: no overlay on it, the text sits on the band below. */
.topic-card__image { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.topic-card--plain::before { content: ""; display: block; aspect-ratio: 4 / 3; background: var(--navy-deep); }
.topic-card h3 { margin: 0; padding: var(--space-2) var(--space-3); font-size: 1.1rem; line-height: 1.3; color: var(--white); border-top: 3px solid var(--gold); }
.topic-card h3 a { color: inherit; text-decoration: none; }
.topic-card h3 a::after { content: ""; position: absolute; inset: 0; }
.topic-card h3 a:focus-visible { outline: none; }
.topic-card:has(h3 a:focus-visible) { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .topic-card { transition: none; } .topic-card:hover { transform: none; } }

/* Intro text above the approfondimenti cards */
.intro { margin-bottom: var(--space-4); }

/* ---------- Cookie banner ---------- */
.link-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; cursor: pointer; text-align: left; }
.link-button:hover { color: var(--gold-ink); }
/* In the footer the button looks exactly like the neighbouring links. */
.site-footer .link-button { color: var(--white); }
.site-footer .link-button:hover { color: var(--gold); }
.consent {
  position: fixed; z-index: 1000; inset: auto var(--space-3) var(--space-3) auto; max-width: 26rem;
  background: var(--white); color: var(--text); padding: var(--space-3);
  border-top: 3px solid var(--gold); border-radius: var(--radius);
  box-shadow: 0 12px 40px -8px rgb(21 36 61 / .45);
}
.consent[hidden] { display: none; }
.consent__title { font-size: 1.05rem; margin: 0 0 var(--space-1); }
.consent__text { font-size: var(--step--1); color: var(--text-soft); margin: 0 0 var(--space-2); }
.consent__text a { color: var(--navy); }
/* Same weight for both choices: rejecting is as easy as accepting. */
.consent__actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1); }
.consent__btn { font: inherit; font-weight: 600; padding: 0.7rem 1rem; border: 2px solid var(--navy); border-radius: var(--radius); background: var(--navy); color: var(--white); cursor: pointer; }
.consent__btn:hover { background: var(--navy-deep); }
.consent__btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 620px) { .consent { inset: auto var(--space-1) var(--space-1) var(--space-1); max-width: none; } }
