/* ═══════════════════════════════════════════
   TEMPIOCASA — base.css
   Design tokens, reset, typography, utilities
═══════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Palette principale */
  --c-forest:   #1B3A2D;   /* verde foresta profondo — brand primario */
  --c-pine:     #244E3B;   /* verde medio — hover, secondario */
  --c-fern:     #2E6B52;   /* verde chiaro — accenti, link */
  --c-sage:     #5A9178;   /* verde salvia — stati disabilitati, sfumature */
  --c-gold:     #B8953A;   /* oro antico — CTA principale, highlight */
  --c-gold-lt:  #D4AE5A;   /* oro chiaro — hover CTA */
  --c-gold-pale:#F0DEB4;   /* oro palissandro — sfondo accento */
  --c-cream:    #F9F5EE;   /* crema calda — sfondo principale */
  --c-warm:     #EDE8DE;   /* beige caldo — sfondo sezioni alternate */
  --c-stone:    #C8BFB0;   /* pietra — bordi, separatori */
  --c-dust:     #6A6358;   /* grigio caldo scuro — testo secondario su fondo chiaro (WCAG AA) */
  --c-dust-light: #A8A398; /* grigio caldo chiaro — testo secondario su fondo scuro (WCAG AA) */
  --c-ink:      #1A1814;   /* quasi nero caldo — testo principale */
  --c-white:    #FFFFFF;

  /* Typography */
  --font-serif: 'Cormorant Garamond', 'Georgia', serif;
  --font-sans:  'Jost', 'Helvetica Neue', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* Type scale */
  --text-xs:    0.68rem;
  --text-sm:    0.82rem;
  --text-base:  1rem;
  --text-lg:    1.15rem;
  --text-xl:    1.35rem;
  --text-2xl:   1.7rem;
  --text-3xl:   2.2rem;
  --text-4xl:   3rem;
  --text-5xl:   4rem;
  --text-hero:  clamp(3rem, 6vw, 6.5rem);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* Layout */
  --max-w: 1380px;
  --max-w-sm: 980px;
  --px: 56px;
  --px-sm: 28px;
  --nav-h: 78px;

  /* Radius */
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 8px;
  --r-xl: 16px;
  --r-full: 999px;

  /* Shadows */
  --shadow-xs:  0 1px 4px rgba(26,24,20,.06);
  --shadow-sm:  0 2px 12px rgba(26,24,20,.08);
  --shadow-md:  0 6px 28px rgba(26,24,20,.11);
  --shadow-lg:  0 16px 56px rgba(26,24,20,.14);
  --shadow-xl:  0 28px 80px rgba(26,24,20,.18);
  --shadow-green: 0 8px 32px rgba(27,58,45,.25);

  /* Transitions */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .15s var(--ease);
  --t-base: .25s var(--ease);
  --t-slow: .45s var(--ease);

  /* Z-indices */
  --z-base: 1;
  --z-dropdown: 100;
  --z-nav: 500;
  --z-overlay: 800;
  --z-modal: 900;
  --z-toast: 1000;
}

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

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

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--c-cream);
  color: var(--c-ink);
  overflow-x: hidden;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font-family: var(--font-sans); }
button { cursor: pointer; }
ul, ol { list-style: none; }
::selection { background: var(--c-gold-pale); color: var(--c-forest); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--c-cream); }
::-webkit-scrollbar-thumb { background: var(--c-forest); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-pine); }

/* ── TYPOGRAPHY ── */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.02em;
}
h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
}
h1 { font-size: var(--text-hero); }
h2 { font-size: clamp(2rem, 3.5vw, 3.2rem); }
h3 { font-size: clamp(1.4rem, 2.2vw, 1.9rem); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-base); }
p { line-height: 1.8; }

.serif   { font-family: var(--font-serif); font-weight: 400; }
.italic  { font-style: italic; }
.gold    { color: var(--c-gold); }
.green   { color: var(--c-forest); }
.muted   { color: var(--c-dust); }
.white   { color: var(--c-white); }
.upper   { text-transform: uppercase; letter-spacing: .15em; font-size: var(--text-xs); font-weight: 600; }

/* ── LAYOUT ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
}
.container-sm {
  max-width: var(--max-w-sm);
  margin: 0 auto;
  padding: 0 var(--px);
}

section {
  padding: var(--space-10) 0;
}
section.compact {
  padding: var(--space-8) 0;
}

/* ── GRID SYSTEM ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-5); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  transition: all var(--t-base);
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: var(--c-forest);
  color: var(--c-white);
  border-color: var(--c-forest);
}
.btn-primary:hover {
  background: var(--c-pine);
  border-color: var(--c-pine);
  transform: translateY(-1px);
  box-shadow: var(--shadow-green);
}
.btn-gold {
  background: var(--c-gold);
  color: var(--c-ink);
  border-color: var(--c-gold);
  font-weight: 700;
}
.btn-gold:hover {
  background: var(--c-gold-lt);
  border-color: var(--c-gold-lt);
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  color: var(--c-forest);
  border-color: var(--c-stone);
}
.btn-outline:hover {
  border-color: var(--c-forest);
  background: rgba(27,58,45,.05);
}
.btn-outline-white {
  background: transparent;
  color: rgba(255,255,255,.88);
  border-color: rgba(255,255,255,.35);
}
.btn-outline-white:hover {
  border-color: var(--c-gold-lt);
  color: var(--c-gold-pale);
}
.btn-sm { padding: 10px 22px; font-size: .65rem; }
.btn-lg { padding: 18px 44px; font-size: var(--text-sm); }
.btn-full { width: 100%; }

/* ── LABELS / EYEBROWS ── */
.label-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-fern);
  margin-bottom: var(--space-4);
}
.label-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: currentColor;
  flex-shrink: 0;
}
.label-eyebrow.light { color: var(--c-sage); }
.label-eyebrow.gold  { color: var(--c-gold); }
.label-eyebrow.white { color: rgba(255,255,255,.6); }

/* ── DIVIDERS ── */
.divider { height: 1px; background: var(--c-warm); }
.divider-gold { height: 1px; background: linear-gradient(to right, transparent, var(--c-gold), transparent); }

/* ── BADGE ── */
.badge {
  display: inline-block;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-sm);
}
.badge-green  { background: var(--c-forest); color: #fff; }
.badge-gold   { background: var(--c-gold); color: var(--c-ink); }
.badge-amber  { background: #B05A1A; color: #fff; }
.badge-sage   { background: var(--c-warm); color: var(--c-forest); border: 1px solid var(--c-stone); }

/* ── FORMS ── */
.form-group {
  margin-bottom: var(--space-5);
}
.form-group label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-dust);
  margin-bottom: 7px;
}
.form-control {
  width: 100%;
  background: var(--c-white);
  border: 1px solid var(--c-stone);
  color: var(--c-ink);
  font-size: var(--text-sm);
  padding: 12px 15px;
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}
.form-control:focus {
  border-color: var(--c-fern);
  box-shadow: 0 0 0 3px rgba(46,107,82,.12);
}
.form-control::placeholder { color: var(--c-stone); }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.6; }
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238C8478'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── ASPECT RATIOS ── */
.aspect-16-9 { aspect-ratio: 16/9; overflow: hidden; }
.aspect-4-3  { aspect-ratio: 4/3;  overflow: hidden; }
.aspect-3-2  { aspect-ratio: 3/2;  overflow: hidden; }
.aspect-sq   { aspect-ratio: 1/1;  overflow: hidden; }
[class*="aspect-"] img { width: 100%; height: 100%; object-fit: cover; }

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes countUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}
.animate-in { animation: fadeInUp .6s var(--ease) both; }
.animate-in-delay-1 { animation-delay: .1s; }
.animate-in-delay-2 { animation-delay: .2s; }
.animate-in-delay-3 { animation-delay: .3s; }
.animate-in-delay-4 { animation-delay: .4s; }

/* ── SKELETON LOADING ── */
.skeleton {
  background: linear-gradient(90deg, var(--c-warm) 25%, var(--c-stone) 37%, var(--c-warm) 63%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}

/* ── UTILS ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.flex    { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-end    { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.mt-auto { margin-top: auto; }
.hidden  { display: none !important; }
.text-center { text-align: center; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.w-full { width: 100%; }

/* ── RESPONSIVE BASE ── */
@media (max-width: 1100px) {
  :root { --px: 36px; }
}
@media (max-width: 768px) {
  :root { --px: 20px; --nav-h: 68px; }
  section { padding: var(--space-9) 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  :root { --px: 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── TOUCH TARGETS ── */
@media (max-width: 768px) {
  .btn-sm { padding: 12px 20px; min-height: 44px; }
  .filter-chip { min-height: 40px; padding: 8px 14px; }
  .nav-link { min-height: 44px; }
}
