/* ============================================================
   BRIM — Site 2 — Brady Bunch / 70s Mod
   ============================================================ */

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

/* ── 70s Palette ────────────────────────────────────────── */
:root {
  --bg-70s:    #C06B20;   /* burnt orange — body + grid gaps */
  --font-body: 'DM Sans', sans-serif;
}

/* ── Body ───────────────────────────────────────────────── */
body {
  background: var(--bg-70s);
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-body);
}

/* ── Grid wrapper — centres the square grid ─────────────── */
.grid-main {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Product grid — perfect square ──────────────────────── */
.product-grid {
  width:  min(100dvw, 100dvh);
  height: min(100dvw, 100dvh);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows:    repeat(3, 1fr);
  gap: 8px;
  /* gap colour = body bg, so burnt orange peeks through */
}

/* ── Card shell ─────────────────────────────────────────── */
.product-card {
  position: relative;
  overflow: hidden;
  perspective: 1200px;
  cursor: pointer;
}

/* ── 3D flip inner ──────────────────────────────────────── */
.card-inner {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Horizontal flip (Y-axis) ──  tiles 01 03 05 07 09 */
/* Hover no longer flips: the hat tosses and shuffles colorways instead (see bottom) */

/* Vertical flip (X-axis) ──  tiles 02 04 06 08 */


/* ── Front & back faces ─────────────────────────────────── */
.card-front,
.card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Front sits on top at rest */
.card-front { z-index: 2; }

/* Back faces — rotated to start hidden */
.flip-h .card-back { transform: rotateY(180deg); }
.flip-v .card-back { transform: rotateX(180deg); }

/* ── Photo (front face) ─────────────────────────────────── */
.card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Hat SVG (back face) ────────────────────────────────── */
.card-back {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back .hat-svg {
  width: 62%;
  max-width: 190px;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.28));
}


/* ── Per-hat back reveal colours ────────────────────────── */

/* ── Floating cart pill ─────────────────────────────────── */
.cart-pill {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 20;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: #4a1c4e;
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 0.7rem 1.6rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 4px 18px rgba(0,0,0,0.38);
}
.cart-pill:hover          { background: #7a3d80; transform: translateY(-2px); }
.cart-pill.has-items      { background: #e8a0bf; color: #3d1040; }

/* ── Cart drawer ─────────────────────────────────────────── */
.cart-overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed; top: 0; right: 0; z-index: 31;
  width: min(380px, 92vw);
  height: 100dvh;
  background: #fdf4ec;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -6px 0 32px rgba(0,0,0,0.18);
}
.cart-drawer.open { transform: translateX(0); }

.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem 1.5rem 1.2rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}
.cart-title {
  font-family: var(--font-body);
  font-size: 1rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #2a1020;
}
.cart-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: #2a1020;
  padding: 0.25rem; line-height: 1;
}
.cart-body {
  flex: 1; overflow-y: auto;
  padding: 1rem 1.5rem;
}
.cart-empty {
  font-size: 0.85rem; color: #888;
  font-style: italic; margin-top: 1rem;
}
.cart-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.cart-item-name  { flex: 1; font-size: 0.85rem; color: #2a1020; }
.cart-item-price { font-size: 0.85rem; font-weight: 500; color: #4a1c4e; }
.cart-item-remove {
  background: none; border: none; cursor: pointer;
  color: #aaa; font-size: 0.75rem; padding: 0.2rem 0.3rem;
  transition: color 0.15s;
}
.cart-item-remove:hover { color: #c06b20; }

.cart-footer {
  padding: 1.2rem 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}
.cart-total-row {
  display: flex; justify-content: space-between;
  font-size: 0.9rem; font-weight: 500;
  color: #2a1020; margin-bottom: 1rem;
}
.checkout-btn {
  width: 100%;
  padding: 0.8rem;
  background: #4a1c4e; color: #fff;
  border: none; border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: background 0.2s;
}
.checkout-btn:hover { background: #7a3d80; }

/* ── Product modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.product-modal {
  position: fixed; z-index: 41;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0; pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;

  width: min(540px, 92vw);
  max-height: 88dvh;
  background: #fdf4ec;
  border-radius: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.product-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; pointer-events: auto;
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem; z-index: 2;
  background: rgba(0,0,0,0.18); color: #fff;
  border: none; border-radius: 50%;
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; cursor: pointer;
  transition: background 0.15s;
}
.modal-close:hover { background: rgba(0,0,0,0.35); }

.modal-img {
  width: 100%; height: 260px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-img .hat-svg {
  width: 55%; max-width: 200px;
  filter: drop-shadow(0 8px 28px rgba(0,0,0,0.28));
}

.modal-body {
  padding: 1.5rem 1.75rem 2rem;
  overflow-y: auto;
}
.modal-name {
  font-size: 1.35rem; font-weight: 500;
  color: #2a1020; margin-bottom: 0.3rem;
}
.modal-material {
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #c06b20; margin-bottom: 0.9rem;
}
.modal-desc {
  font-size: 0.9rem; line-height: 1.65;
  color: #4a3030; margin-bottom: 1.4rem;
}
.modal-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.modal-price {
  font-size: 1.2rem; font-weight: 500; color: #2a1020;
}
.modal-add-btn {
  padding: 0.7rem 1.6rem;
  background: #4a1c4e; color: #fff;
  border: none; border-radius: 99px;
  font-family: var(--font-body);
  font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: background 0.2s, transform 0.2s;
}
.modal-add-btn:hover        { background: #7a3d80; transform: translateY(-1px); }
.modal-add-btn.added        { background: #e8a0bf; color: #3d1040; }

/* ── Waitlist modal ──────────────────────────────────────── */
.waitlist-modal {
  position: fixed; z-index: 42;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0; pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  width: min(440px, 92vw);
  background: #fdf4ec;
  border-radius: 20px;
  padding: 3rem 2.5rem 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  text-align: center;
}
.waitlist-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; pointer-events: auto;
}

.waitlist-eyebrow {
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: #c06b20; margin-bottom: 0.7rem;
}
.waitlist-heading {
  font-size: 2rem; font-weight: 300;
  color: #2a1020; line-height: 1.2;
  margin-bottom: 0.75rem;
}
.waitlist-sub {
  font-size: 0.88rem; color: #6a4030;
  line-height: 1.6; margin-bottom: 1.8rem;
}
.waitlist-form {
  display: flex; flex-direction: column; gap: 0.7rem;
}
.waitlist-input {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 99px;
  background: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem; color: #2a1020;
  outline: none;
  transition: border-color 0.2s;
}
.waitlist-input:focus { border-color: #c06b20; }
.waitlist-btn {
  width: 100%;
  padding: 0.85rem;
  background: #4a1c4e; color: #fff;
  border: none; border-radius: 99px;
  font-family: var(--font-body);
  font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.09em; text-transform: uppercase;
  cursor: pointer; transition: background 0.2s, transform 0.15s;
}
.waitlist-btn:hover { background: #7a3d80; transform: translateY(-1px); }

.waitlist-success { text-align: center; padding: 1rem 0; }
.waitlist-success-msg {
  font-size: 2.2rem; font-weight: 300;
  color: #2a1020; margin-bottom: 0.6rem;
}
.waitlist-success-sub {
  font-size: 0.88rem; color: #6a4030; font-style: italic;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 767px) {
  body { height: auto; overflow-y: auto; }

  .grid-main { height: auto; padding: 8px; align-items: flex-start; }

  .product-grid {
    width: 100%;
    height: auto;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }

  /* Keep tiles square on mobile */
  .product-card { aspect-ratio: 1; }

  /* Disable flip on touch — direct tap opens modal */
  .flip-h:hover .card-inner,
  .flip-v:hover .card-inner { transform: none; }

  .cart-pill { bottom: 1.2rem; right: 1.2rem; }

  .modal-img { height: 200px; }
}

/* ── Premium tiles: floating hats on 70s colour blocks ── */
:root { --font-serif: 'Instrument Serif', Georgia, serif; }
.product-card .card-front { background: var(--f); color: var(--fi); }
.product-card .card-back  { background: var(--b); color: var(--bi); display: block; }
.card-front, .card-back { overflow: hidden; }
.card-front::after, .card-back::after {           /* soft vignette for depth */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, rgba(255,255,255,0.14), rgba(0,0,0,0.12));
}
.card-hat {
  position: absolute; left: 50%; top: 47%;
  width: 74%; height: auto;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 18px 22px rgba(0,0,0,0.28)) drop-shadow(0 3px 4px rgba(0,0,0,0.18));
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.product-card:hover .card-back .card-hat { transform: translate(-50%, -52%) rotate(-3deg); }
.card-num {
  position: absolute; top: 0.9rem; left: 1rem; z-index: 2;
  font-family: var(--font-body); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.18em; opacity: 0.7;
}
.card-word {
  position: absolute; left: 0; right: 0; bottom: 0.9rem; z-index: 2;
  text-align: center;
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(1.1rem, 2.6vmin, 1.9rem); line-height: 1;
}
.card-word s { opacity: 0.45; text-decoration-thickness: 1px; }
.card-meta {
  position: absolute; left: 0; right: 0; bottom: 1rem; z-index: 2;
  text-align: center;
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase;
}
.modal-img { background: var(--mbg, #fdf4ec) !important; height: 320px; }
.modal-photo {
  height: 82%; width: auto; max-width: 86%; object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0,0,0,0.3));
}
.modal-name { font-family: var(--font-serif); font-size: 2rem; font-weight: 400; }
.modal-swatches { display: flex; gap: 0.6rem; margin-bottom: 1.1rem; }
.swatch {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.18); cursor: pointer;
  transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] { outline: 1.5px solid #2a1020; outline-offset: 3px; }

/* ── Name font: streetwear caps ── */
.card-word, .modal-name {
  font-family: 'Archivo Black', sans-serif; font-style: normal; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.card-word { font-size: clamp(0.8rem, 1.7vmin, 1.15rem); }

/* ── Hover: hat gets tossed and lands in the next colorway (script.js) ── */
@keyframes hat-toss {
  0%   { transform: translate(-50%, -50%) rotate(0); }
  30%  { transform: translate(-50%, -66%) rotate(-10deg) scale(1.04); }
  55%  { transform: translate(-50%, -48%) rotate(5deg); }
  72%  { transform: translate(-50%, -53%) rotate(-3deg); }
  86%  { transform: translate(-50%, -50%) rotate(1.5deg); }
  100% { transform: translate(-50%, -51%) rotate(0); }
}
.card-front .card-hat.tossing { animation: hat-toss 0.9s cubic-bezier(0.3, 0.7, 0.3, 1) both; }
@media (prefers-reduced-motion: reduce) { .card-front .card-hat.tossing { animation: none; } }

/* ── Gutters: manifesto (left) + Positive Dictionary (right) ── */
.manifesto, .dict { display: none; }
@media (min-width: 1100px) and (min-aspect-ratio: 7/5) {
  .manifesto, .dict {
    display: flex; flex-direction: column; justify-content: center;
    position: fixed; top: 0; bottom: 0; z-index: 1;
    width: calc(50vw - 50dvh - 4px);
    padding: 0 clamp(20px, 3.2vw, 72px);
    container-type: inline-size;
    color: #2a1020;
  }
  .manifesto { left: 0; }
  .dict { right: 0; }
}
.mf-kicker, .dict-kicker, .dict-num {
  font-size: max(10px, 3.6cqi); font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase;
  opacity: 0.75; margin-bottom: 1.2em;
}
.mf-title {
  font-family: 'Archivo Black', sans-serif; font-weight: 400; text-transform: uppercase;
  font-size: 15cqi; line-height: 0.92; letter-spacing: -0.01em; color: #fdf4ec;
  margin-bottom: 0.45em;
}
.manifesto p:not(.mf-kicker):not(.mf-sign) {
  font-family: var(--font-serif); font-size: max(16px, 8.6cqi); line-height: 1.1; margin-bottom: 0.5em;
}
.mf-sign {
  font-family: 'Archivo Black', sans-serif; text-transform: uppercase; color: #fdf4ec;
  font-size: max(12px, 5.6cqi); letter-spacing: 0.04em; margin-top: 0.7em;
}
.dict-kicker { margin-bottom: 2.6em; }
.dict-entry { transition: opacity 0.16s, transform 0.16s; }
.dict-entry.swap { opacity: 0; transform: translateY(6px); }
.dict-num { margin-bottom: 0.9em; }
.dict-word {
  font-family: 'Archivo Black', sans-serif; text-transform: lowercase; color: #fdf4ec;
  font-size: 13.5cqi; line-height: 0.95; overflow-wrap: anywhere;
}
.dict-pron {
  font-size: max(11px, 4.2cqi); letter-spacing: 0.06em; margin: 0.9em 0 1.4em;
  padding-bottom: 1.1em; border-bottom: 1.5px solid rgba(42,16,32,0.35);
}
.dict-def { font-family: var(--font-serif); font-size: max(16px, 8.6cqi); line-height: 1.1; margin-bottom: 0.7em; }
.dict-note { font-family: var(--font-serif); font-style: italic; font-size: max(14px, 6.6cqi); line-height: 1.2; opacity: 0.8; }

/* Definition inside the product modal (the only place it shows on phones) */
.modal-def { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.3; color: #3a2030; margin: -0.4rem 0 1.1rem; }
.modal-def:empty { display: none; }
.modal-def-pron { font-family: var(--font-body); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; display: block; margin-bottom: 0.2rem; }

/* Phones: manifesto sits above the grid */
@media (max-width: 767px) {
  .manifesto { display: block; padding: 40px 20px 28px; color: #2a1020; }
  .manifesto { container-type: inline-size; }
  .mf-title { font-size: 15cqi; }
  .manifesto p:not(.mf-kicker):not(.mf-sign) { font-size: 1.35rem; }
  .mf-sign { font-size: 1rem; }
}
