/* ============================================
   CASA COMÚN — design tokens
   ============================================ */
:root{
  /* Palette sourced directly from the Casa Común stamp logo */
  --cream: #fbf8e9;       /* page background */
  --cream-deep: #f2ecd4;  /* alternating section background */

  --ink-900: #241408;     /* darkest ink — headings, footer & dark-section backgrounds */
  --ink-800: #2e1c0e;     /* body text; also the dark-section background tone */
  --ink-700: #40281a;     /* secondary/lede text — one step lighter than body text */

  --rust-600: #b83016;    /* primary accent — logo ink color */
  --rust-700: #8f2410;    /* accent hover/active state */

  --gold-300: #dab749;    /* secondary accent on dark backgrounds */

  --font-display: 'Fraunces', serif;
  --font-body: 'Karla', sans-serif;
  --font-mono: 'Space Mono', monospace;

  --wrap-max: 1180px;
  --radius: 6px;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink-800);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3{
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 0.5em;
  color: var(--ink-900);
}
em{ font-style: italic; color: var(--rust-600); }
p{ margin: 0 0 1em; }
a{ color: inherit; }
img{ max-width: 100%; display: block; }

.wrap{
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 0 28px;
}
.wrap-narrow{ max-width: 760px; }

.section-label{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust-600);
  margin-bottom: 0.9em;
}
.section-label.light{ color: var(--gold-300); }

/* subtle grain texture overlay for warmth */
.grain-overlay{
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: 0.035; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================
   HEADER
   ============================================ */
.site-header{
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: rgba(249, 244, 232, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(36,20,8,0.08);
}
.brand{
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink-900);
}
.brand-mark{
  width: 46px; height: 46px; border-radius: 50%;
  display: block; object-fit: cover;
}
.site-nav{ display: flex; align-items: center; gap: 26px; }
.site-nav a{
  text-decoration: none; font-size: 0.95rem; font-weight: 600;
  color: var(--ink-700);
  position: relative;
}
.site-nav a:not(.nav-cta)::after{
  content: ""; position: absolute; left: 0; bottom: -4px; height: 1.5px; width: 0;
  background: var(--rust-600); transition: width 0.25s ease;
}
.site-nav a:not(.nav-cta):hover::after{ width: 100%; }
.nav-cta{
  background: var(--rust-600); color: var(--cream) !important;
  padding: 9px 18px; border-radius: 999px;
  transition: background 0.2s ease;
}
.nav-cta:hover{ background: var(--rust-700); }

.lang-toggle{
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.05em;
  background: none; border: 1.5px solid rgba(36,20,8,0.25);
  color: var(--ink-800); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.lang-toggle:hover{ border-color: var(--rust-600); color: var(--rust-600); }

.nav-toggle{
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-toggle span{ width: 24px; height: 2px; background: var(--ink-800); }

/* ============================================
   HERO
   ============================================ */
.hero{
  position: relative;
  min-height: 92vh;
  display: flex; align-items: center;
  overflow: hidden;
  background: var(--cream);
  color: var(--ink-800);
}
.hero-roots{
  position: absolute; inset: 0; width: 100%; height: 100%;
  color: rgba(184,48,22,0.16);
}
.hero-logo{
  display: block;
  width: 128px; height: 128px;
  margin: 0 auto 28px;
  border-radius: 50%;
  transform: rotate(-6deg);
  box-shadow: 0 10px 30px rgba(36,20,8,0.14);
  animation: stampIn 0.7s cubic-bezier(.2,.9,.3,1.3) both;
}
@keyframes stampIn{
  from{ opacity: 0; transform: rotate(-24deg) scale(0.7); }
  to{ opacity: 1; transform: rotate(-6deg) scale(1); }
}
.root-path{
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 2.6s ease-out forwards;
}
.root-path:nth-child(2){ animation-delay: 0.15s; }
.root-path:nth-child(3){ animation-delay: 0.3s; }
.root-path:nth-child(4){ animation-delay: 0.45s; }
.root-path:nth-child(5){ animation-delay: 0.6s; }
.root-path:nth-child(6){ animation-delay: 0.75s; }
.root-nodes circle{ opacity: 0; animation: fadeIn 0.6s ease forwards 2.4s; }
@keyframes draw{ to{ stroke-dashoffset: 0; } }
@keyframes fadeIn{ to{ opacity: 1; } }

.hero-content{
  position: relative; z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 28px;
  text-align: center;
}
.eyebrow{
  font-family: var(--font-mono); font-size: 0.8rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--rust-600); margin-bottom: 1.4em;
}
.hero h1{
  color: var(--ink-900);
  font-size: clamp(2.2rem, 5.4vw, 3.6rem);
  font-weight: 600;
  margin-bottom: 0.5em;
}
.hero h1 em{ color: var(--rust-600); font-style: italic; }
.hero-lede{
  font-size: 1.1rem; color: var(--ink-700);
  max-width: 580px; margin: 0 auto 1.8em;
}
.hero-actions{ display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn{
  display: inline-block; text-decoration: none;
  font-weight: 700; font-size: 0.95rem;
  padding: 13px 26px; border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary{ background: var(--rust-600); color: var(--cream); }
.btn-primary:hover{ background: var(--rust-700); transform: translateY(-1px); }
.btn-ghost{
  border: 1.5px solid rgba(36,20,8,0.25); color: var(--ink-800);
}
.btn-ghost:hover{ border-color: var(--rust-600); color: var(--rust-600); }

/* ============================================
   GENERIC SECTION RHYTHM
   ============================================ */
.section{ padding: 108px 0; }
.section-intro .lede-text{ font-size: 1.2rem; color: var(--ink-700); }
.section-intro .lede-text:last-child{ margin-bottom: 0; }

.reveal{ opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible{ opacity: 1; transform: none; }

/* ============================================
   ORGANISM DIAGRAM (signature element)
   ============================================ */
.section-organism{
  background: var(--cream-deep);
  color: var(--ink-800);
}
.section-organism h2{ color: var(--ink-900); }
.section-intro-text{
  max-width: 560px; color: var(--ink-700); font-size: 1.05rem;
}
.organism-wrap{
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px;
  align-items: center; margin-top: 50px;
}
.organism-diagram{ width: 100%; height: auto; overflow: visible; }
.organism-connectors path{
  fill: none; stroke: rgba(36,20,8,0.22); stroke-width: 1.6;
  transition: stroke 0.3s ease, stroke-width 0.3s ease;
}
.organism-connectors path.is-active{
  stroke: var(--rust-600); stroke-width: 2.4;
}
.organism-node circle{
  fill: var(--cream); stroke: rgba(36,20,8,0.3); stroke-width: 1.4;
  transition: fill 0.25s ease, stroke 0.25s ease, transform 0.25s ease;
  transform-origin: center;
  cursor: pointer;
}
.organism-node:hover circle, .organism-node:focus circle, .organism-node.is-active circle{
  fill: var(--rust-600); stroke: var(--rust-700);
  transform: scale(1.05);
}
.organism-node--center circle{ fill: var(--rust-600); stroke: var(--rust-700); stroke-width: 2; }
.organism-node--center .node-title{ fill: var(--cream); }
.organism-node--center:hover circle, .organism-node--center.is-active circle{ transform: scale(1.03); }
.node-title{
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
  fill: var(--ink-900); pointer-events: none;
}
.organism-node:hover .node-title, .organism-node.is-active .node-title{ fill: var(--cream); }
.node-title--sm{ font-size: 14px; font-weight: 500; }
.organism-node{ outline: none; }

.organism-panel{
  background: var(--cream);
  border: 1px solid rgba(36,20,8,0.14);
  border-radius: var(--radius);
  padding: 32px;
  min-height: 220px;
}
.panel-eyebrow{
  font-family: var(--font-mono); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--rust-600);
  margin-bottom: 0.6em;
}
.organism-panel h3{ color: var(--ink-900); font-size: 1.4rem; }
.organism-panel p{ color: var(--ink-700); margin-bottom: 0; }

/* ============================================
   MOTIVATION SPLIT
   ============================================ */
.wrap-split{ display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 60px; }
.split-label h2{ font-size: clamp(1.7rem, 3vw, 2.3rem); }
.split-body p{ font-size: 1.08rem; color: var(--ink-700); }

/* ============================================
   IMPACT
   ============================================ */
.section-impact h2{ font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: 0.7em; }
.impact-grid{
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.5px;
  background: rgba(36,20,8,0.12);
  border: 1.5px solid rgba(36,20,8,0.12);
  margin: 40px 0 32px;
}
.impact-item{
  background: var(--cream);
  padding: 34px 22px;
  display: flex; flex-direction: column; gap: 8px;
}
.impact-item--wide{ grid-column: span 5; flex-direction: row; align-items: baseline; gap: 18px; }
.impact-number{
  font-family: var(--font-display); font-weight: 700;
  font-size: 2.6rem; color: var(--rust-600); line-height: 1;
}
.impact-label{
  font-size: 0.92rem; color: var(--ink-700); font-weight: 600;
}
.impact-note{ max-width: 640px; color: var(--ink-700); font-size: 1.02rem; }

/* ============================================
   GALLERY — videos + Instagram callout
   ============================================ */
.section-gallery{ background: var(--cream-deep); }
.gallery-intro{ font-size: 1.05rem; color: var(--ink-700); max-width: 640px; }

.video-grid{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  margin: 40px 0 36px;
}
.video-card{
  position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
  background: var(--ink-900); border-radius: var(--radius); overflow: hidden;
}
.video-card iframe{
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

.instagram-callout{
  margin-top: 40px;
  display: flex; align-items: center; gap: 18px;
  background: var(--cream); border: 1px solid rgba(36,20,8,0.14);
  border-radius: var(--radius); padding: 20px 24px;
  text-decoration: none; color: var(--ink-900);
  max-width: 520px; transition: border-color 0.2s ease;
}
.instagram-callout:hover{ border-color: var(--rust-600); }
.instagram-callout-icon{ width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.instagram-callout strong{ display: block; font-size: 1rem; }
.instagram-callout small{ display: block; color: var(--ink-700); font-size: 0.88rem; margin-top: 2px; }
.instagram-callout-arrow{ margin-left: auto; font-size: 1.2rem; color: var(--rust-600); }

.instagram-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:24px;
    align-items:start;
}

.instagram-media{
    width:100% !important;
    min-width:0 !important;
    margin:0 !important;
}

@media (max-width:900px){
    .instagram-grid{
        grid-template-columns:1fr;
    }
}

/* ============================================
   TIENDA — lightweight shop (order via form/WhatsApp)
   ============================================ */
.section-shop{ background: var(--cream); }
.product-grid{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  margin: 40px 0 20px;
}
.product-card{
  background: var(--cream-deep); border: 1px solid rgba(36,20,8,0.1);
  border-radius: var(--radius); padding: 26px;
  display: flex; flex-direction: column; gap: 10px;
}
.product-photo{
  width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(184,48,22,0.12), rgba(116,129,79,0.14));
  margin-bottom: 6px;
}
.product-card h3{ font-size: 1.15rem; margin-bottom: 0.2em; }
.product-card p{ color: var(--ink-700); font-size: 0.95rem; margin-bottom: 0; }
.product-maker{
  font-family: var(--font-mono); font-size: 0.76rem; color: var(--rust-600);
  margin-top: auto; padding-top: 6px;
}
.btn-sm{ padding: 9px 18px; font-size: 0.85rem; align-self: flex-start; margin-top: 6px; }
.section-shop .btn-primary{ margin-top: 34px; }
.shop-note{ font-size: 0.9rem; color: var(--ink-700); font-style: italic; margin-top: 14px; }

.brochure-grid{ display: flex; flex-wrap: wrap; gap: 16px; margin-top: 34px; }
.brochure-card{
  display: flex; align-items: center; gap: 14px;
  border: 1px solid rgba(36,20,8,0.16); border-radius: var(--radius);
  padding: 14px 20px; text-decoration: none; color: var(--ink-900);
  transition: border-color 0.2s ease;
}
.brochure-card:not(.brochure-card--disabled):hover{ border-color: var(--rust-600); }
.brochure-title{ font-weight: 700; font-size: 0.95rem; }
.brochure-action{ font-family: var(--font-mono); font-size: 0.78rem; color: var(--rust-600); }
.brochure-card--disabled{ opacity: 0.55; cursor: default; }
.brochure-card--disabled .brochure-action{ color: var(--ink-700); }

/* ============================================
   PRODUCTORES
   ============================================ */
.section-producers{ background: var(--ink-900); color: var(--cream); }
.section-producers h2{ color: var(--cream); }
.section-producers .section-intro-text{ color: rgba(243,235,217,0.75); }
.producer-grid{
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px;
  margin-top: 40px;
}
.producer-card{ text-align: center; }
.producer-photo{
  width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 12px;
  background: rgba(243,235,217,0.12); border: 1px solid rgba(243,235,217,0.25);
  overflow: hidden;
}
.producer-photo img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.producer-name{ font-weight: 700; margin-bottom: 2px; }
.producer-role{ font-size: 0.88rem; color: rgba(243,235,217,0.65); margin-bottom: 0; }

/* ============================================
   SUEÑOS (dreams seeking support)
   ============================================ */
.section-dream{ background: var(--cream-deep); }
.dream-grid{
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
  margin: 40px 0 48px;
}
.dream-card{
  background: var(--cream); border: 1px solid rgba(36,20,8,0.12);
  border-radius: var(--radius); padding: 32px;
}
.dream-card-label{
  font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--rust-600); margin-bottom: 0.8em;
}
.dream-card h3{ font-size: 1.5rem; margin-bottom: 0.3em; }
.dream-card-tagline{
  font-family: var(--font-display); font-style: italic; font-size: 1.05rem;
  color: var(--ink-700); margin-bottom: 1em;
}
.dream-card p{ color: var(--ink-700); font-size: 0.98rem; }
.dream-card .plant-tag{
  font-family: var(--font-mono); font-size: 0.78rem;
  border: 1px solid rgba(184,48,22,0.35); color: var(--rust-600);
  padding: 5px 12px; border-radius: 999px;
}
.dream-card .chocolate-plants{ display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.dream-support-note{
  font-size: 0.92rem; font-style: italic; color: var(--ink-700);
  max-width: 640px; margin: 0 0 40px;
}
.dream-text{
  font-family: var(--font-display); font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  line-height: 1.5; color: var(--ink-900); font-weight: 500;
}

/* ============================================
   CONTACT / FOOTER
   ============================================ */
.section-contact{
  background: var(--cream-deep); color: var(--ink-800); text-align: center; margin-top: 40px;
}
.section-contact h2{ color: var(--ink-900); }
.contact-text{ font-size: 1.05rem; color: var(--ink-700); max-width: 560px; margin-left: auto; margin-right: auto; }
.contact-grid{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-top: 34px; text-align: left;
}
.contact-card{
  background: var(--cream); border: 1px solid rgba(36,20,8,0.12);
  border-radius: var(--radius); padding: 18px 22px;
  text-decoration: none; color: var(--ink-900);
  display: flex; flex-direction: column; gap: 3px;
  transition: border-color 0.2s ease;
}
.contact-card:hover{ border-color: var(--rust-600); }
.contact-card-title{ font-weight: 700; }
.contact-card-sub{ font-size: 0.85rem; color: var(--ink-700); }

.site-footer{ background: var(--ink-900); }
.footer-inner{
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 20px 28px; font-size: 0.8rem; color: rgba(243,235,217,0.55);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 860px){
  .wrap-split{ grid-template-columns: 1fr; gap: 24px; }
  .organism-wrap{ grid-template-columns: 1fr; }
  .impact-grid{ grid-template-columns: repeat(2, 1fr); }
  .impact-item--wide{ grid-column: span 2; }
  .video-grid{ grid-template-columns: 1fr; }
  .product-grid{ grid-template-columns: repeat(2, 1fr); }
  .producer-grid{ grid-template-columns: repeat(2, 1fr); }
  .dream-grid{ grid-template-columns: 1fr; }
  .contact-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px){
  .site-nav{
    position: fixed; top: 68px; left: 0; right: 0;
    background: var(--cream);
    flex-direction: column; align-items: flex-start;
    padding: 20px 28px; gap: 18px;
    border-bottom: 1px solid rgba(36,20,8,0.1);
    transform: translateY(-130%); transition: transform 0.3s ease;
  }
  .site-nav.is-open{ transform: translateY(0); }
  .nav-toggle{ display: flex; }
  .section{ padding: 76px 0; }
  .impact-grid{ grid-template-columns: 1fr; }
  .impact-item--wide{ grid-column: span 1; flex-direction: column; gap: 4px; }
  .product-grid{ grid-template-columns: 1fr; }
  .producer-grid{ grid-template-columns: 1fr; }
  .contact-grid{ grid-template-columns: 1fr; }
  .instagram-callout{ max-width: 100%; }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .root-path, .root-nodes circle, .reveal{ animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; }
}

.producer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.producer-modal.active {
  display: flex;
}

.producer-modal-content {
  position: relative;
  background: var(--cream);
  color: var(--ink-900);
  max-width: 500px;
  width: 100%;
  padding: 35px;
  border-radius: var(--radius);
  text-align: center;
}

.producer-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 30px;
  cursor: pointer;
  color: var(--ink-900);
}

.producer-modal-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 18px;
}

.producer-modal-name {
  margin-bottom: 6px;
}

.producer-modal-location {
  color: var(--ink-700);
  margin-bottom: 20px;
}

.producer-modal-description {
  color: var(--ink-700);
  line-height: 1.6;
}
.producer-view-profile {
  margin-top: 10px;
  color: var(--rust-600);
  font-size: 0.85rem;
  font-weight: 600;
}
.producer-modal-image {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 20px;
}