/* Page sections.
   Texture lives on the page background only — sections are transparent
   sheets over it, so no per-section texture re-stack (it tripled the grain
   and cost a compositing layer per section). */
section {
  padding: var(--spacing-xxl) 0;
  position: relative;
  overflow: hidden;
  animation: section-rise 0.9s var(--transition-momentum) both;
  /* Paused until scrolled into view — main.js adds .in-view (documentary
     scroll-reveal). Sections above the fold reveal immediately. */
  animation-play-state: paused;
}

section.in-view {
  animation-play-state: running;
}

/* Smooth cinematic rise — opacity+translate only (compositor-friendly,
   no scale: scaling whole sections blurs text mid-animation) */
@keyframes section-rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered entrance for list items/cards — same smooth settle */
.stagger-item {
  animation: item-rise 0.7s var(--transition-momentum) both;
}

@keyframes item-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Re-renders that aren't navigation (e.g. language toggle) must not replay
   every entrance — main.js sets .no-anim on the app root for those. */
.no-anim section,
.no-anim .stagger-item {
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  section,
  .stagger-item {
    animation: none !important;
  }
}

/* Element-level scroll reveals (main.js adds .is-revealed). Gated on
   html.js-motion: if JS is dead or motion is reduced, the class is absent and
   the element is simply visible — reveals never hide content permanently. */
.js-motion [data-reveal="wipe"] {
  clip-path: inset(0 100% 0 0);
}
.js-motion [data-reveal="wipe"].is-revealed {
  animation: wipe-reveal 1s var(--transition-momentum) forwards;
}
@keyframes wipe-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.js-motion [data-reveal="rise"] {
  opacity: 0;
  transform: translateY(24px);
}
.js-motion [data-reveal="rise"].is-revealed {
  animation: item-rise 0.8s var(--transition-momentum) forwards;
}

/* Full-bleed dark 'chapter' band — breaks the long cream run and carries the
   oversized editorial statement. Reuses the kraft tone the footer proves. */
.manifesto-band {
  background-color: var(--color-kraft);
  background-image:
    var(--tx-grain-light),
    radial-gradient(120% 90% at 50% 0%, rgba(255, 240, 214, 0.06) 0%, transparent 55%);
  color: #f0e6d4;
  text-align: center;
  padding: clamp(4.5rem, 13vh, 9rem) 0;
}

.manifesto-band .container {
  max-width: 1000px;
}

.manifesto-eyebrow {
  font-family: var(--font-handwritten);
  font-size: 1.6rem;
  color: var(--color-brand-pink-light);
  transform: rotate(-2deg);
  display: inline-block;
  margin-bottom: var(--spacing-sm);
}

/* The big editorial moment — type at ~9vw says 'essay', not 'template' */
.manifesto-headline {
  display: block;
  font-family: var(--font-headings);
  font-weight: 600;
  font-size: clamp(2.8rem, 9vw, 8rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: #faf3e3;
  margin-bottom: var(--spacing-lg);
}

.manifesto-headline::after {
  content: none;
}

.manifesto-headline .accent {
  color: var(--color-brand-pink-light);
}

.manifesto-sub {
  max-width: 600px;
  margin: 0 auto var(--spacing-xl);
  color: #c7b699;
  font-size: 1.1rem;
}

/* NOTE: the headline clip-path 'wipe' reveal is intentionally deferred to the
   motion pass, where the IntersectionObserver gets a safety fallback. The
   headline must never depend on JS to be visible. */

/* 1. Landing split hero — two photographs cut apart by a laser line */
.hero-split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(88vh - 80px);
  overflow: hidden;
  position: relative;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--spacing-xxl);
  position: relative;
  z-index: 1;
}

/* Dashed laser cut line between the two halves */
.hero-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 3px dashed rgba(250, 243, 227, 0.65);
  z-index: 10;
  transform: translateX(-50%);
}

/* Left: warm product photograph — wash kept light enough that the craft
   actually reads; text legibility comes from the text-shadows */
.hero-panel-packaging {
  background-image:
    linear-gradient(100deg, rgba(38, 22, 9, 0.74) 0%, rgba(38, 22, 9, 0.42) 55%, rgba(38, 22, 9, 0.6) 100%),
    url('../assets/hero-craft.jpg');
  background-size: cover;
  background-position: center;
}

/* Right: laser-cut Malaysia map, warm espresso duotone (sepia blueprint) */
.hero-panel-machinery {
  background-image:
    linear-gradient(80deg, rgba(33, 26, 16, 0.78) 0%, rgba(33, 26, 16, 0.45) 60%, rgba(33, 26, 16, 0.66) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 30px),
    url('../assets/hero-map.jpg');
  background-size: cover, auto, auto, cover;
  background-position: center;
}

/* Grain + vignette baked onto each photo panel — kept, but light enough
   that the photograph stays the subject */
.hero-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    var(--tx-grain),
    radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(10, 6, 2, 0.45) 100%);
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
}

/* Light text over the photographs */
.hero-panel h1 {
  font-size: clamp(2.2rem, 4.8vw, 3.5rem);
  margin-bottom: var(--spacing-md);
  color: #faf3e3;
  text-shadow: 0 2px 14px rgba(10, 6, 2, 0.55);
}

.hero-panel p {
  font-size: 1.12rem;
  margin-bottom: var(--spacing-xl);
  max-width: 32rem;
  color: #ecdfc8;
  text-shadow: 0 1px 8px rgba(10, 6, 2, 0.5);
}

.hero-panel .text-gradient {
  color: #f3a7c7;
  -webkit-text-fill-color: #f3a7c7;
}

/* The machinery half speaks warm bronze, not craft-pink — the fork in the
   brand starts at the front door (both halves stay in the warm family) */
.hero-panel-machinery .text-gradient {
  color: #e6c08a;
  -webkit-text-fill-color: #e6c08a;
}

.hero-panel .handwritten {
  color: #f3a7c7;
  text-shadow: 0 1px 6px rgba(10, 6, 2, 0.5);
  margin-top: var(--spacing-md);
}

/* Sketchy buttons need paper tones on dark photos */
.hero-panel .btn-secondary {
  background: rgba(255, 253, 246, 0.94);
}

.hero-panel .btn-outline {
  border-color: rgba(250, 243, 227, 0.65);
  color: #faf3e3;
  background: rgba(10, 6, 2, 0.2);
}

.hero-panel .btn-outline:hover {
  border-color: #f3a7c7;
  color: #f3a7c7;
}

.hero-panel .stamp {
  align-self: flex-start;
  color: #e8b9a4;
  border-color: #e8b9a4;
  mix-blend-mode: normal;
  opacity: 0.9;
  margin-top: var(--spacing-lg);
}

/* Torn paper edge where the hero meets the page */
.hero-split-container::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 22px;
  background-image: var(--tx-torn);
  background-repeat: repeat-x;
  background-size: 120px 22px;
  z-index: 11;
  pointer-events: none;
}

@media (max-width: 768px) {
  .hero-split-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: auto;
  }
  .hero-divider {
    display: none;
  }
  .hero-panel {
    /* Extra bottom clearance so the WhatsApp FAB doesn't sit on the
       handwritten note */
    padding: var(--spacing-xl) var(--spacing-xl) 5rem;
    min-height: 58vh;
  }
}

/* 2. Shop catalog — prints pinned to a corkless wall */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-lg);
}

.product-card {
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-panel);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42, 31, 22, 0.14);
  box-shadow: var(--shadow-md);
}

/* Tape strip across the top of each card */
.product-card::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(-2.5deg);
  width: 96px;
  height: 25px;
  background: var(--color-tape);
  clip-path: polygon(2% 0, 98% 4%, 100% 30%, 97% 55%, 100% 78%, 98% 100%, 3% 96%, 0 70%, 2% 42%, 0 18%);
  box-shadow: 0 1px 3px rgba(58, 38, 20, 0.18);
  mix-blend-mode: multiply;
  z-index: 4;
}

.product-card:nth-child(even)::before {
  transform: translateX(-50%) rotate(2deg);
}

/* The photo: a bordered print, slightly crooked, archival tone */
.product-image-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 75%;
  background-color: #ece2cd;
  border: 7px solid #fffefa;
  outline: 1px solid rgba(42, 31, 22, 0.12);
  overflow: hidden;
  margin-bottom: var(--spacing-md);
  box-shadow: 0 2px 6px rgba(58, 38, 20, 0.14);
  transform: rotate(-0.7deg);
}

.product-card:nth-child(even) .product-image-wrapper {
  transform: rotate(0.6deg);
}

/* Catalog photos show TRUE color — no sepia/grain/vignette on merchandise.
   These are festive gift boxes; the color IS the purchase decision. The
   archival treatment stays on decorative collage pieces (.taped-photo). */
.product-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.product-card:hover .product-image-wrapper img {
  transform: scale(1.05) rotate(0.5deg);
}

.product-sku {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.product-title {
  font-family: var(--font-headings);
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-primary);
}

.product-spec-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  border-bottom: 1px dashed rgba(42, 31, 22, 0.2);
  padding: 0.4rem 0;
}

.product-spec-row strong {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Handwritten price — like a tag written in marker */
.product-price-range {
  font-family: var(--font-handwritten);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--color-brand-pink);
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: baseline;
  gap: var(--spacing-xs);
  transform: rotate(-1deg);
}

.product-price-range span {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  transform: none;
}

/* 3. Quote configurator — a printed order ticket */
.calc-wrapper {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--spacing-xxl);
  align-items: start;
}

@media (max-width: 992px) {
  .calc-wrapper {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
  }
}

/* The receipt: punched holes up top, torn serration below */
.calc-result-panel {
  background: #fffefa;
  border: 1px solid rgba(42, 31, 22, 0.16) !important;
  box-shadow: var(--shadow-lg) !important;
  border-radius: 4px;
  position: sticky;
  top: 100px;
}

.calc-result-panel::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 10px;
  background-image: radial-gradient(circle at 7px 5px, var(--color-bg-dark) 3.2px, transparent 3.8px);
  background-size: 22px 10px;
  background-repeat: repeat-x;
}

.calc-result-panel::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -11px;
  height: 12px;
  background-image:
    linear-gradient(45deg, #fffefa 8.49px, transparent 8.5px),
    linear-gradient(-45deg, #fffefa 8.49px, transparent 8.5px);
  background-size: 17px 12px;
  background-repeat: repeat-x;
}

.calc-result-panel h2 {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* No pink marker squiggle inside the receipt — it breaks the ticket fiction */
.calc-result-panel h2::after {
  display: none;
}

.calc-breakdown-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px dashed rgba(42, 31, 22, 0.18);
  font-size: 0.95rem;
}

.calc-breakdown-row strong {
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: right;
}

.calc-total-row {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 4px double var(--color-ink);
  font-size: 1.55rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* 4. Machine hub — spec sheets on blueprint accents */
.machine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-lg);
}

.machine-card {
  display: flex;
  flex-direction: column;
  border-top: 4px solid var(--color-brand-purple);
}

.machine-card h3 {
  color: var(--color-brand-purple);
  -webkit-text-fill-color: var(--color-brand-purple);
}

.machine-features {
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  border-top: 1px dashed rgba(42, 31, 22, 0.2);
  padding-top: var(--spacing-md);
}

.machine-features li {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
}

.machine-features li svg {
  width: 1.2rem;
  height: 1.2rem;
  color: var(--color-brand-purple);
  flex-shrink: 0;
}

/* Taped sample print on the machine hub intro */
.machine-sample {
  float: right;
  width: clamp(120px, 16vw, 190px);
  margin: 0 0 var(--spacing-md) var(--spacing-lg);
  transform: rotate(3deg);
}

@media (max-width: 768px) {
  .machine-sample {
    float: none;
    display: block;
    margin: var(--spacing-md) auto;
  }
}

/* Language toggle — inset paper switch */
.lang-toggle {
  display: flex;
  background-color: rgba(42, 31, 22, 0.06);
  border: 1.5px solid rgba(42, 31, 22, 0.25);
  border-radius: var(--radius-round);
  padding: 3px;
  box-shadow: inset 0 1px 3px rgba(58, 38, 20, 0.12);
}

.lang-btn {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: var(--radius-round);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--color-brand-pink);
  color: #fff8ee;
  box-shadow: 0 1px 0 #8e2c57;
}

/* Kraft footer with grain */
.footer-kraft {
  position: relative;
}

.footer-kraft::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--tx-grain-light);
  opacity: 0.5;
  pointer-events: none;
}

/* Compact header: below ~1200px the 6-link nav can't share a row with the
   brand and action bar (it used to collide between 900–1200px), so it drops
   to its own scrollable row. Scrollbar hidden — the row still scrolls. */
@media (max-width: 1200px) {
  header .container {
    flex-wrap: wrap;
    row-gap: 0.75rem;
  }
  header nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  header nav::-webkit-scrollbar {
    display: none;
  }
  header nav a {
    white-space: nowrap;
  }
}
