/* =========================================================================
   A GLAD SCIENTIST — core styles
   The whole site is a chalkboard. Everything on it feels drawn, taped,
   or scrawled. Nothing feels printed.
   ========================================================================= */

/* ---- FONTS ----
   Display font: Caveat (Google Fonts) — a handwriting font used as the
   display face today. When your custom "Dan Handwriting" font is ready,
   uncomment the @font-face blocks below, drop the files in /assets/fonts/,
   and it'll take over automatically without any other code changes.

   UI font: JetBrains Mono (typewriter/lab-label voice).
   Body font: DM Sans (for long-form reading in product copy).
   All three are loaded via <link> in each HTML <head>.

   ---- CUSTOM FONT SLOT (when ready, uncomment) -----------------------------
   @font-face {
     font-family: 'Dan Handwriting';
     src: url('../assets/fonts/My-Font.woff2') format('woff2'),
          url('../assets/fonts/My-Font.ttf') format('truetype');
     font-weight: 400;
     font-style: normal;
     font-display: swap;
   }
   @font-face {
     font-family: 'Dan Handwriting';
     src: url('../assets/fonts/My-Font-Bold.woff2') format('woff2'),
          url('../assets/fonts/My-Font-Bold.ttf') format('truetype');
     font-weight: 700;
     font-style: normal;
     font-display: swap;
   }
   --------------------------------------------------------------------------- */

/* ---- DESIGN TOKENS ---- */
:root {
  /* Palette: dark chalkboard + single teal accent. */
  --ink:         #0f1113;   /* deepest black, for shadows under cards */
  --board:       #1a1a1e;   /* base chalkboard color */
  --board-soft:  #242428;   /* slightly raised surface */
  --chalk:       #e8e4d8;   /* off-white chalk */
  --chalk-dim:   #a8a49a;   /* faded chalk / body text */
  --chalk-faint: #6a665d;   /* erased chalk / metadata */
  --teal:        #5bc4a8;   /* the one accent */
  --teal-dim:    #3a8a76;
  --warn:        #e8b25b;   /* for "SOLD OUT" / tags */

  /* Type */
  --f-display: 'Dan Handwriting', 'Kalam', 'Caveat', cursive;
  --f-mono:    'JetBrains Mono', 'Courier Prime', 'Courier New', monospace;
  --f-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing rhythm — based on 8px */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 4rem;
  --s-7: 6rem;
  --s-8: 8rem;

  /* Layout */
  --max-w: 1280px;
  --content-w: 960px;
  --prose-w: 640px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; margin: 0; }
img, picture, svg { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---- BASE ---- */
html, body { min-height: 100%; }

body {
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--chalk-dim);
  background-color: var(--board);
  background-image: url('../assets/bg-dirty.png');
  background-size: 1400px 1400px;
  background-position: center top;
  background-attachment: fixed;
  background-repeat: repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* chalk dust grain — the micro-texture that sells the surface */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
}

/* subtle vignette so the center reads as "lit" */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center,
              transparent 0%,
              transparent 40%,
              rgba(0,0,0,0.35) 100%);
}

/* everything above the background layers */
main, header, footer, nav { position: relative; z-index: 2; }

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  color: var(--chalk);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

h1 { font-size: clamp(3rem, 8vw, 6rem); }
h2 { font-size: clamp(2.25rem, 5vw, 3.75rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h4 { font-size: 1.25rem; }

p { margin-bottom: var(--s-2); }
p:last-child { margin-bottom: 0; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: var(--s-2);
}

.meta {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--chalk-faint);
}

/* ---- LAYOUT ---- */
.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s-3);
}

.wrap--content { max-width: var(--content-w); }
.wrap--prose   { max-width: var(--prose-w); }

/* ---- NAV / HEADER ---- */
.site-header {
  padding: var(--s-3) 0;
  border-bottom: 1px dashed rgba(168, 164, 154, 0.15);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.logo {
  font-family: var(--f-display);
  font-size: 1.75rem;
  color: var(--chalk);
  letter-spacing: 0.02em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  transition: color 0.2s var(--ease);
}
.logo:hover { color: var(--teal); }
.logo__mark {
  width: 36px; height: 36px;
  border: 1px solid var(--teal);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 0.8rem;
  color: var(--teal);
}

.nav-primary {
  display: flex;
  gap: var(--s-4);
  font-family: var(--f-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.nav-primary a {
  color: var(--chalk-dim);
  padding: var(--s-1) 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav-primary a:hover,
.nav-primary a.is-current {
  color: var(--chalk);
  border-bottom-color: var(--teal);
}

@media (max-width: 640px) {
  .nav-primary { gap: var(--s-2); font-size: 0.7rem; }
  .logo { font-size: 1.35rem; }
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-3);
  font-family: var(--f-mono);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--chalk);
  background: transparent;
  border: 1px solid var(--chalk-dim);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  position: relative;
}
.btn:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--teal);
  color: var(--board);
  border-color: var(--teal);
  font-weight: 500;
}
.btn--primary:hover {
  background: transparent;
  color: var(--teal);
  transform: translateY(-1px);
}

.btn--buy {
  padding: var(--s-3) var(--s-4);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
}

.btn--ghost {
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
}
.btn--ghost:hover {
  border-color: transparent;
  color: var(--teal);
  transform: translateX(4px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

/* ---- HERO (homepage) ---- */
.hero {
  padding: var(--s-8) 0 var(--s-7);
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--s-6);
  align-items: center;
}
@media (max-width: 820px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero { padding: var(--s-6) 0 var(--s-5); min-height: auto; }
}

.hero__title {
  font-size: clamp(3.5rem, 9vw, 7rem);
  line-height: 0.95;
  margin-bottom: var(--s-3);
}
.hero__title em {
  font-style: normal;
  color: var(--teal);
  display: block;
}

.hero__blurb {
  font-size: 1.15rem;
  max-width: 46ch;
  margin-bottom: var(--s-4);
  color: var(--chalk-dim);
}

.hero__mascot {
  justify-self: center;
  width: 100%;
  max-width: 360px;
  opacity: 0.92;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
  animation: mascot-float 6s ease-in-out infinite;
}
.hero__mascot svg { width: 100%; height: auto; }
@keyframes mascot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---- CATEGORY CARDS ---- */
.categories {
  padding: var(--s-6) 0;
}
.categories__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: var(--s-4);
  gap: var(--s-3);
  flex-wrap: wrap;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--s-3);
}

.category-card {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(168, 164, 154, 0.15);
  background: var(--board-soft);
  transition: transform 0.4s var(--ease-out), border-color 0.25s var(--ease);
}
.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--teal);
}

.category-card__banner {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  transition: opacity 0.4s var(--ease), transform 0.8s var(--ease-out);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
}
.category-card:hover .category-card__banner {
  opacity: 0.75;
  transform: scale(1.03);
}
.category-card__banner img {
  width: 100%; height: 100%; object-fit: cover;
}

.category-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
              rgba(15,17,19,0.95) 0%,
              rgba(15,17,19,0.4) 50%,
              rgba(15,17,19,0.1) 100%);
}

.category-card__content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: var(--s-3);
}
.category-card__title {
  font-size: 2.25rem;
  color: var(--chalk);
  margin-bottom: var(--s-1);
}
.category-card__count {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal);
}

/* "coming soon" state */
.category-card--soon { cursor: not-allowed; }
.category-card--soon .category-card__title { color: var(--chalk-faint); }
.category-card--soon::after {
  content: 'COMING SOON';
  position: absolute;
  top: var(--s-2); right: var(--s-2);
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--warn);
  border: 1px solid var(--warn);
  padding: 4px 8px;
  opacity: 0.8;
}

/* ---- PRODUCT GRID ---- */
.products {
  padding: var(--s-5) 0 var(--s-7);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4) var(--s-3);
}

.product-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease);
}
.product-card:hover { transform: translateY(-4px); }

.product-card__img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--ink);
  border: 1px solid rgba(168, 164, 154, 0.12);
  margin-bottom: var(--s-2);
}
.product-card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out), filter 0.3s var(--ease);
}
.product-card:hover .product-card__img {
  transform: scale(1.04);
  filter: brightness(1.05);
}

.product-card__title {
  font-family: var(--f-display);
  font-size: 1.5rem;
  color: var(--chalk);
  margin-bottom: 2px;
  line-height: 1.1;
}

.product-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--chalk-faint);
  text-transform: uppercase;
}
.product-card__price { color: var(--teal); }

/* ---- PRODUCT DETAIL ---- */
.product-detail {
  padding: var(--s-5) 0 var(--s-7);
}
.product-detail__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 900px) {
  .product-detail__grid { grid-template-columns: 1fr; gap: var(--s-4); }
}

.gallery {
  position: sticky;
  top: var(--s-3);
}
.gallery__main {
  aspect-ratio: 1 / 1;
  background: var(--ink);
  border: 1px solid rgba(168, 164, 154, 0.12);
  overflow: hidden;
  margin-bottom: var(--s-2);
}
.gallery__main img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 0.3s var(--ease);
}
.gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: var(--s-1);
}
.gallery__thumb {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(168, 164, 154, 0.12);
  overflow: hidden;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}
.gallery__thumb:hover { opacity: 0.9; }
.gallery__thumb.is-active {
  opacity: 1;
  border-color: var(--teal);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }

.product-info__breadcrumb {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--chalk-faint);
  margin-bottom: var(--s-3);
}
.product-info__breadcrumb a { color: var(--chalk-dim); }
.product-info__breadcrumb a:hover { color: var(--teal); }

.product-info__title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: var(--s-1);
}
.product-info__subtitle {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--chalk-faint);
  margin-bottom: var(--s-3);
}

.product-info__price-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-top: 1px dashed rgba(168, 164, 154, 0.2);
  border-bottom: 1px dashed rgba(168, 164, 154, 0.2);
  margin-bottom: var(--s-3);
}
.product-info__price {
  font-family: var(--f-display);
  font-size: 2.5rem;
  color: var(--teal);
  line-height: 1;
}
.product-info__format {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--chalk-faint);
  text-transform: uppercase;
}

.product-info__copy {
  margin-bottom: var(--s-4);
  font-size: 1.05rem;
}
.product-info__copy p { margin-bottom: var(--s-2); }

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
  padding: var(--s-3);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(168, 164, 154, 0.1);
  margin-bottom: var(--s-4);
}
.specs__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.specs__label {
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--chalk-faint);
}
.specs__value {
  font-family: var(--f-body);
  font-size: 0.95rem;
  color: var(--chalk);
}

.buy-section {
  margin-bottom: var(--s-4);
}
.buy-note {
  margin-top: var(--s-2);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--chalk-faint);
  text-transform: uppercase;
}

/* ---- STATUS / MESSAGING ---- */
.status {
  padding: var(--s-2);
  border: 1px solid var(--chalk-faint);
  font-family: var(--f-mono);
  font-size: 0.85rem;
  margin-top: var(--s-2);
  display: none;
}
.status.is-visible { display: block; }
.status--error { border-color: var(--warn); color: var(--warn); }
.status--success { border-color: var(--teal); color: var(--teal); }

/* ---- FOOTER ---- */
.site-footer {
  padding: var(--s-5) 0 var(--s-4);
  margin-top: var(--s-6);
  border-top: 1px dashed rgba(168, 164, 154, 0.15);
  font-family: var(--f-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--chalk-faint);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.site-footer a { color: var(--chalk-dim); }
.site-footer a:hover { color: var(--teal); }

/* ---- UTILITY PAGES (thank-you, recover) ---- */
.utility-page {
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding: var(--s-5) 0;
}
.utility-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: var(--s-5) var(--s-4);
  border: 1px solid rgba(168, 164, 154, 0.15);
  background: rgba(15,17,19,0.6);
  backdrop-filter: blur(4px);
}
.utility-card h1 { font-size: clamp(2.5rem, 6vw, 4rem); margin-bottom: var(--s-2); }
.utility-card p { margin-bottom: var(--s-3); }

.download-panel {
  margin: var(--s-3) 0;
  padding: var(--s-3);
  border: 1px dashed var(--teal-dim);
}
.download-panel__file {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--chalk);
  margin-bottom: var(--s-2);
  word-break: break-all;
}
.download-panel__expires {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--chalk-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---- FORMS (recover page) ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  margin-bottom: var(--s-3);
  text-align: left;
}
.field label {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--chalk-faint);
}
.field input {
  padding: var(--s-2);
  font-family: var(--f-mono);
  font-size: 0.95rem;
  color: var(--chalk);
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(168, 164, 154, 0.2);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.2s var(--ease);
}
.field input:focus { border-color: var(--teal); }

/* ---- REVEAL ANIMATION ---- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: reveal 0.8s var(--ease-out) forwards;
}
.reveal--1 { animation-delay: 0.05s; }
.reveal--2 { animation-delay: 0.18s; }
.reveal--3 { animation-delay: 0.32s; }
.reveal--4 { animation-delay: 0.46s; }
@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ---- ACCESSIBILITY ---- */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero__mascot { animation: none; }
}
