/* ==========================================================================
   Casa Raffa — Design system e layout di base (mobile-first)
   ========================================================================== */

/* Font self-hosted (latin): nessuna chiamata a terze parti */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../assets/fonts/playfair-display.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../assets/fonts/inter.woff2') format('woff2');
}

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('../assets/fonts/cormorant-garamond-italic.woff2') format('woff2');
}

:root {
  /* Colori primari */
  --color-primary:       #1a1a2e;
  --color-primary-soft:  #26263f;
  --color-secondary:     #c9a96e;
  --color-secondary-text:#8a6d3b;    /* Oro scurito: contrasto AA su fondi chiari */
  --color-accent:        #e8d5b7;

  /* Neutri */
  --color-bg:            #faf9f6;
  --color-bg-alt:        #f0ece4;
  --color-text:          #2c2c2c;
  --color-text-light:    #6b6b6b;
  --color-border:        #e0dcd4;
  --color-on-dark:       #ece7dd;
  --color-on-dark-muted: #b9b4c6;

  /* Feedback */
  --color-success:       #4a7c59;
  --color-error:         #c44536;

  /* Tipografia */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent:  'Cormorant Garamond', Georgia, serif;

  /* Spaziature */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  2rem;
  --space-xl:  4rem;
  --space-2xl: 8rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  /* Transizioni */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Ombre */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.15);

  /* Layout */
  --container: 1280px;
  --gutter: 1.25rem;
  --header-h: 72px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked {
  overflow: hidden;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-primary);
  text-wrap: balance;
}

p {
  margin: 0 0 var(--space-md);
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

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

:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 3px;
}

::selection {
  color: var(--color-primary);
  background: var(--color-accent);
}

/* --- Accessibilità ------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 200;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-secondary);
  transform: translateY(-200%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

/* --- Layout -------------------------------------------------------------- */
.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.container--narrow {
  max-width: 760px;
}

.section {
  padding-block: var(--space-xl);
}

.section--alt {
  background: var(--color-bg-alt);
}

.section--dark {
  color: var(--color-on-dark);
  background: var(--color-primary);
}

.section--dark h2,
.section--dark h3 {
  color: #fff;
}

.section__head {
  max-width: 640px;
  margin-bottom: var(--space-lg);
}

.section__head--center {
  margin-inline: auto;
  text-align: center;
}

/* --- Tipografia ---------------------------------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  margin-bottom: var(--space-md);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--color-secondary-text);
}

.eyebrow::before {
  content: '';
  width: 2.25rem;
  height: 1px;
  background: currentColor;
}

.section--dark .eyebrow,
.eyebrow--light {
  color: var(--color-secondary);
}

.section-title {
  font-size: 1.75rem;
}

.tagline {
  font-family: var(--font-accent);
  font-size: 1.1rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text-light);
}

.lead {
  font-size: 1.05rem;
  color: var(--color-text);
}

.muted {
  color: var(--color-text-light);
}

.small {
  font-size: 0.8rem;
}

/* --- Animazioni di comparsa (attivate da main.js) ------------------------ */
.reveal.is-pending {
  opacity: 0;
  transform: translateY(24px);
}

.reveal {
  transition: opacity 900ms cubic-bezier(0.2, 0.6, 0.2, 1), transform 900ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal.is-pending {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
