/* =========================================================
   CCC Turin — Rooted & Hopeful
   Shared stylesheet
   ========================================================= */

:root {
  /* --- Brand palette --- */
  --sandstone: #C9B99A;
  --warm-brown: #7A5C45;
  --warm-brown-deep: #5c4432;
  --mist-gray: #9DAAB0;
  --linen: #F2EDE4;
  --linen-deep: #e8e0cf;
  --sky-blue: #7AAEC4;
  --sky-blue-deep: #5f95ac;

  /* --- Semantic --- */
  --bg: var(--linen);
  --bg-alt: #faf6ef;
  --ink: var(--warm-brown-deep);
  --ink-soft: var(--warm-brown);
  --muted: var(--mist-gray);
  --accent: var(--sky-blue);
  --accent-ink: #2a4854;

  /* --- Typography --- */
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --w-thin: 200;
  --w-light: 300;
  --w-reg: 400;
  --w-med: 500;
  --w-bold: 700;
  --w-black: 900;

  /* --- Motion --- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* --- Layout --- */
  --container: 1180px;
  --radius: 4px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-weight: var(--w-light);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Paper-grain background — subtle warmth across every page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.478 0 0 0 0 0.361 0 0 0 0 0.271 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.12;
  mix-blend-mode: multiply;
}

main, header, footer { position: relative; z-index: 1; }

/* --- Typography system --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variation-settings: "SOFT" 50, "WONK" 1;
}

h1 {
  font-weight: var(--w-black);
  font-size: clamp(2.8rem, 7.5vw, 6rem);
  letter-spacing: -0.035em;
}

h2 {
  font-weight: var(--w-bold);
  font-size: clamp(2rem, 4.5vw, 3.4rem);
}

h3 {
  font-weight: var(--w-bold);
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  letter-spacing: -0.015em;
}

p { font-weight: var(--w-light); }

.eyebrow {
  font-family: var(--font-body);
  font-weight: var(--w-med);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--ink-soft);
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* =========================================================
   NAVIGATION
   ========================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242, 237, 228, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(122, 92, 69, 0.12);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.1rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: var(--w-black);
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--warm-brown);
  display: grid;
  place-items: center;
  color: var(--linen);
  font-weight: var(--w-black);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: clamp(1rem, 3vw, 2.2rem);
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-body);
  font-weight: var(--w-med);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  padding: 0.4rem 0;
  transition: color 0.3s var(--ease);
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1.5px;
  background: var(--sky-blue);
  transition: width 0.4s var(--ease);
}

.nav-links a:hover,
.nav-links a.active { color: var(--ink); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--ink);
}
.nav-toggle svg { display: block; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--linen);
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem 2rem 2rem;
    gap: 1.2rem;
    border-bottom: 1px solid rgba(122, 92, 69, 0.12);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--ease);
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links a { font-size: 1rem; }
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-body);
  font-weight: var(--w-med);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1.05rem 2rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--warm-brown);
  color: var(--linen);
}
.btn-primary:hover {
  background: var(--warm-brown-deep);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(92, 68, 50, 0.55);
}

.btn-accent {
  background: var(--sky-blue);
  color: var(--accent-ink);
}
.btn-accent:hover {
  background: var(--sky-blue-deep);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -12px rgba(95, 149, 172, 0.6);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--linen);
}

.btn .arrow {
  display: inline-block;
  transition: transform 0.35s var(--ease);
}
.btn:hover .arrow { transform: translateX(4px); }

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  margin-top: 8rem;
  padding: 4rem 0 2.5rem;
  background: var(--warm-brown);
  color: var(--linen);
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='nf'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23nf)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.08;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.footer-inner {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 3rem;
}

.footer h4 {
  font-family: var(--font-body);
  font-weight: var(--w-med);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sandstone);
  margin-bottom: 1.2rem;
}

.footer p, .footer a {
  color: var(--linen);
  font-weight: var(--w-light);
  line-height: 1.8;
  font-size: 0.95rem;
  text-decoration: none;
}
.footer a:hover { color: var(--sky-blue); }

.footer .big {
  font-family: var(--font-display);
  font-weight: var(--w-bold);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--linen);
}

.footer-bottom {
  max-width: var(--container);
  margin: 3.5rem auto 0;
  padding: 1.8rem clamp(1.25rem, 4vw, 2.5rem) 0;
  border-top: 1px solid rgba(242, 237, 228, 0.18);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--sandstone);
  position: relative;
}

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr; gap: 2.2rem; }
  .footer { margin-top: 5rem; }
}

/* =========================================================
   ANIMATIONS — orchestrated entrance
   Fail-safe: if animations don't run for any reason, content
   is still visible after 2s via the fallback keyframe.
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  animation: reveal 0.95s var(--ease) forwards;
}
.d-1 { animation-delay: 0.1s; }
.d-2 { animation-delay: 0.22s; }
.d-3 { animation-delay: 0.34s; }
.d-4 { animation-delay: 0.46s; }
.d-5 { animation-delay: 0.58s; }
.d-6 { animation-delay: 0.70s; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

.reveal-slow {
  opacity: 0;
  animation: fadeIn 1.4s var(--ease) 0.3s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }

/* Safety net: if animations are blocked (sandboxed previews,
   old browsers, etc.), reveal content after a short delay */
@media (prefers-reduced-motion: no-preference) {
  .reveal, .reveal-slow {
    animation-fill-mode: forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-slow { opacity: 1; transform: none; animation: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   HERO — shared
   ========================================================= */
.hero {
  padding: clamp(4rem, 10vh, 8rem) 0 clamp(3rem, 8vh, 6rem);
  position: relative;
}

.hero-sub {
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.65;
  max-width: 580px;
  color: var(--ink-soft);
  margin-top: 1.8rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.6rem;
  flex-wrap: wrap;
}

/* =========================================================
   SECTIONS
   ========================================================= */
section { padding: clamp(4rem, 9vh, 7rem) 0; }

.section-head {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
  align-items: end;
}
@media (max-width: 820px) {
  .section-head { grid-template-columns: 1fr; gap: 1.5rem; }
}

.section-head .lead {
  font-size: clamp(1.1rem, 1.8vw, 1.25rem);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 560px;
}

/* =========================================================
   UTILITIES
   ========================================================= */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(122, 92, 69, 0.25), transparent);
  margin: 0;
}

.accent-line {
  display: block;
  width: 48px;
  height: 3px;
  background: var(--sky-blue);
  margin-bottom: 1.5rem;
}

a { color: var(--sky-blue-deep); }
a:hover { color: var(--warm-brown); }

::selection {
  background: var(--sky-blue);
  color: var(--linen);
}
