/* kublaii — shared base: tokens, type, nav, buttons, section headings, footer.
   Loaded by index.html, shop.html and product.html. Page-specific styles stay inline. */

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

:root {
  --black: #080a09;
  --fog: #b8c4be;
  --forest: #3d6649;
  --moss: #62966e;
  --mist: #e8ede9;
  --charcoal: #141a16;
  --midgray: #3a4a3e;
  --lightfog: #d4ddd6;

  /* Type — the one place to swap faces (and the Google Fonts link in each page) */
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-display-axes: normal; /* variation settings, for variable display faces */
  --font-body: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--mist);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* clip (not hidden) so position: sticky keeps working */
@supports (overflow: clip) { html, body { overflow-x: clip; } }

em, i { font-family: var(--font-display); font-variation-settings: var(--font-display-axes); font-style: italic; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 1px solid var(--moss); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* NAV */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 1.5rem var(--gutter);
  background: linear-gradient(to bottom, rgba(8,10,9,0.95) 0%, transparent 100%);
  transition: background 0.3s;
}
#navbar.scrolled {
  background: rgba(8,10,9,0.97);
  border-bottom: 1px solid rgba(74,107,82,0.2);
}
.nav-logo, .footer-logo {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--mist);
}
.nav-links { display: flex; gap: 2.5rem; list-style: none; margin-left: auto; order: 1; }
.nav-links a, .nav-cart {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fog);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--mist); }

/* Cart button — lives in the fixed nav, so it's always on screen */
.nav-cart {
  order: 2;
  margin-left: 2.5rem;
  display: inline-flex; align-items: center; gap: 0.55rem;
  background: none; border: 0; cursor: pointer;
  padding: 0.35rem 0;
}
.nav-cart:hover { color: var(--mist); }
.nav-cart-count {
  display: inline-grid; place-items: center;
  min-width: 1.45rem; height: 1.45rem; padding: 0 0.3rem;
  border: 1px solid var(--midgray); border-radius: 999px;
  font-size: 0.68rem; letter-spacing: 0;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.nav-cart.has-items .nav-cart-count { background: var(--forest); border-color: var(--moss); color: var(--mist); }
.nav-cart.bump .nav-cart-count { animation: cartBump 0.5s var(--ease-out); }
@keyframes cartBump { 40% { transform: scale(1.35); box-shadow: 0 0 18px rgba(98,150,110,0.6); } }

.nav-hamburger {
  display: none;
  order: 3;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.25rem;
  margin-left: 1.25rem;
  z-index: 101;
}
.nav-hamburger span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--fog);
  transition: transform 0.3s, opacity 0.3s;
}
#navbar.menu-open .nav-hamburger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#navbar.menu-open .nav-hamburger span:nth-child(2) { opacity: 0; }
#navbar.menu-open .nav-hamburger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* BUTTONS */
.btn-primary, .btn-ghost {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 1rem 1.6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.25s, border-color 0.25s, color 0.25s, transform 0.2s;
}
.btn-primary {
  font-weight: 500;
  background: var(--forest);
  color: var(--mist);
  border: 1px solid var(--moss);
}
.btn-primary:hover { background: var(--moss); border-color: var(--fog); transform: translateY(-2px); }
.btn-ghost {
  font-weight: 400;
  background: transparent;
  color: var(--fog);
  border: 1px solid var(--midgray);
}
.btn-ghost:hover { border-color: var(--fog); color: var(--mist); transform: translateY(-2px); }

/* SECTION COMMON */
section { padding: 7rem 4rem; scroll-margin-top: 5rem; }
.section-label {
  font-family: var(--font-mono);
  font-weight: 400; font-size: 0.68rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--moss);
  margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 1rem;
}
.section-label::before {
  content: ''; display: block;
  width: 30px; height: 1px; background: var(--moss);
}
.section-title {
  font-family: var(--font-display);
  font-variation-settings: var(--font-display-axes);
  font-weight: 400;
  font-size: clamp(3.75rem, 11vw, 9.5rem);
  letter-spacing: -0.02em;
  color: var(--mist); line-height: 0.85; margin-bottom: 3.5rem;
  text-transform: lowercase;
}

/* FOOTER */
footer {
  background: var(--charcoal);
  padding: 3rem 4rem;
  display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 2rem;
  border-top: 1px solid rgba(74,107,82,0.15);
}
.footer-logo { font-size: 1.6rem; color: var(--fog); }
.social-links { display: flex; gap: 2rem; flex-wrap: wrap; }
.social-link {
  font-family: var(--font-mono);
  font-weight: 400; font-size: 0.68rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fog); text-decoration: none; transition: color 0.2s;
}
.social-link:hover { color: var(--mist); }
.footer-copy {
  font-family: var(--font-body);
  font-weight: 400; font-size: 0.7rem;
  color: rgba(184,196,190,0.72); letter-spacing: 0.16em;
}

@media (max-width: 900px) {
  #navbar { padding: 1.2rem var(--gutter); }
  .nav-hamburger { display: flex; }
  .nav-cart { margin-left: auto; }
  .nav-links {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,10,9,0.97);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    z-index: 100;
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 1.4rem; letter-spacing: 0.1em; }
  section { padding: 5rem 1.5rem; }
  footer { padding: 2.5rem 1.5rem; flex-direction: column; align-items: flex-start; }
}

/* FILM GRAIN — one fixed layer over every page. The noise tile jumps to a new offset
   8 times a second (steps), like film; moving a composited layer keeps it cheap. */
body::after {
  content: '';
  position: fixed;
  inset: -100%;
  z-index: 500;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  animation: grain 1s steps(8) infinite;
  will-change: transform;
}
@keyframes grain {
  0%     { transform: translate(0, 0); }
  12.5%  { transform: translate(-3%, 2%); }
  25%    { transform: translate(2%, -4%); }
  37.5%  { transform: translate(-5%, -1%); }
  50%    { transform: translate(4%, 3%); }
  62.5%  { transform: translate(-1%, 5%); }
  75%    { transform: translate(5%, -2%); }
  87.5%  { transform: translate(-4%, -5%); }
  100%   { transform: translate(1%, 1%); }
}

/* HEADING LINE REVEALS (assets/motion.js splits headings into lines).
   The clip-path's negative insets keep italic swashes and descenders; the bottom edge
   is the mask each line rises out of. */
.motion-ok:not(.motion-ready) :is(.section-title, .drop-title) { visibility: hidden; }
.rv-line { display: block; clip-path: inset(-0.4em -0.3em -0.22em -0.3em); }
.rv-in {
  display: inline-block;
  translate: 0 115%;
  transition: translate 1.15s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 0.09s);
}
.rv.is-in .rv-in { translate: 0 0; }

/* Lenis smooth scroll */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  body::after { animation: none; }
}
