/* ==========================================================================
   FERMENTO — Global Styles
   Reset, base typography, utility classes
   ========================================================================== */

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* --- Typography (pass editoriale 2026-07) ---
   h1/h2 = Playfair Title Case (lingua della hero)
   h3/h4 = Inter semibold (gerarchia secondaria leggibile) */
h1, h2 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.08;
  color: var(--color-ink);
  overflow-wrap: break-word;
  word-wrap: break-word;
  letter-spacing: 0.005em;
}

h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--color-ink);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 {
  font-size: var(--text-6xl);
}

h2 {
  font-size: var(--text-5xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

p {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

@media (min-width: 768px) {
  h1 {
    font-size: var(--text-6xl);
  }
  h2 {
    font-size: var(--text-5xl);
  }
  h3 {
    font-size: var(--text-3xl);
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: var(--text-7xl);
  }
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

.container--narrow {
  max-width: var(--container-md);
}

.container--wide {
  max-width: var(--container-2xl);
}

/* --- Sections --- */
.section {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

@media (min-width: 768px) {
  .section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
  }
}

/* Section variants — warm cinematic restyling 2026-06 */
.section--warm {
  background-color: var(--color-cream);
  background-image: var(--texture-cream-paper);
}

.section--dark {
  background-color: var(--color-cream-darker);
  color: var(--color-ink);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-ink);
}

.section--primary {
  background: var(--gradient-hero-cinematic);
  color: var(--color-cream);
  position: relative;
}

.section--primary h1,
.section--primary h2,
.section--primary h3,
.section--primary h4 {
  color: var(--color-cream);
}

/* --- Section Headers --- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-ink-medium);
  line-height: var(--lh-relaxed);
}

.section--dark .section-subtitle {
  color: var(--color-ink-medium);
}

.section--primary .section-subtitle {
  color: var(--color-cream-alpha-85);
}

/* --- Grids --- */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 {
  grid-template-columns: 1fr;
}

.grid--3 {
  grid-template-columns: 1fr;
}

.grid--4 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Scroll Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Screen Reader Only --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Focus Styles --- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* --- Selection --- */
::selection {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
}
