/* Maverick System App — brand-locked palette.
   Primary Blue #0C4C94, charcoal, white only. No orange/amber/gold. */

:root {
  --brand-blue: #0C4C94;
  --brand-blue-dark: #08356A;
  --brand-charcoal: #2A2E33;
  --brand-charcoal-soft: #4A4F55;
  --brand-grey-100: #F4F6F8;
  --brand-grey-200: #E4E8ED;
  --brand-grey-300: #C6CCD3;
  --brand-white: #FFFFFF;

  --layer-gap: 130px;         /* JS overrides this dynamically based on stack size */
  --tile-size: 420px;         /* on-screen size of each stacked tile */
  --callout-gutter: 60px;     /* horizontal gap between tile column and label column */
  --callout-width: 260px;     /* label column width */
  --stage-bg-top: #EEF2F6;
  --stage-bg-bot: #D6DEE6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', 'Calibri', system-ui, -apple-system, sans-serif;
  color: var(--brand-charcoal);
  background: var(--brand-grey-100);
  overflow: hidden;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: var(--brand-white);
  border-bottom: 3px solid var(--brand-blue);
  height: 84px;
}

.logo {
  height: 56px;
  width: auto;
}

.header-text h1 {
  font-family: 'Alata', 'Inter', sans-serif;
  font-weight: 400;
  font-size: 24px;
  margin: 0;
  color: var(--brand-blue);
  letter-spacing: 0.5px;
}

.header-text .tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--brand-charcoal-soft);
}

/* ---------- Main 3-column layout ---------- */
.app-main {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  height: calc(100vh - 84px);
}

/* ---------- Left rail: product buttons ---------- */
.product-rail {
  background: var(--brand-white);
  border-right: 1px solid var(--brand-grey-200);
  overflow-y: auto;
  padding: 16px 14px;
}

.product-group {
  margin-bottom: 18px;
}

.product-group-title {
  font-family: 'Alata', 'Inter', sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--brand-blue);
  margin: 0 0 8px 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--brand-grey-200);
}

.product-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  margin-bottom: 5px;
  background: var(--brand-grey-100);
  border: 1px solid var(--brand-grey-200);
  border-radius: 4px;
  color: var(--brand-charcoal);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.product-btn:hover {
  background: var(--brand-blue);
  border-color: var(--brand-blue-dark);
  color: var(--brand-white);
}

.product-btn:active {
  transform: translateY(1px);
}

/* ---------- Center stage: stack area ---------- */
.stage-wrap {
  position: relative;
  background: linear-gradient(180deg, var(--stage-bg-top) 0%, var(--stage-bg-bot) 100%);
  overflow: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.stage {
  position: relative;
  width: calc(var(--tile-size) + var(--callout-gutter) + var(--callout-width));
  min-height: 100%;
  display: block;
  padding: 40px 0;
}

.tile-column {
  position: relative;
  width: var(--tile-size);
  height: 100%;
  min-height: calc(var(--tile-size) + 40px);
}

.callout-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.tile {
  width: var(--tile-size);
  height: auto;
  position: absolute;
  bottom: 40px;
  left: 0;
  pointer-events: none;
  user-select: none;
  /* Heavier drop shadow gives each floating slab physical weight so the stack
     reads as ONE exploded object rather than 6 unrelated photos. */
  filter: drop-shadow(0 22px 20px rgba(15, 25, 40, 0.32))
          drop-shadow(0 6px 8px rgba(15, 25, 40, 0.18));
}

.tile-base {
  z-index: 1;
}

/* Ground shadow beneath the base — implies the concrete sits on something,
   anchors the whole stack visually. Radial ellipse a bit wider than the tile. */
.tile-column::before {
  content: "";
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--tile-size) * 0.9);
  height: 32px;
  background: radial-gradient(ellipse at center,
              rgba(15, 25, 40, 0.28) 0%,
              rgba(15, 25, 40, 0.10) 55%,
              transparent 75%);
  filter: blur(4px);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Right rail: current stack list + controls ---------- */
.stack-rail {
  background: var(--brand-white);
  border-left: 1px solid var(--brand-grey-200);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stack-rail h2 {
  font-family: 'Alata', 'Inter', sans-serif;
  font-weight: 400;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--brand-blue);
  margin: 0 0 12px;
}

.stack-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--brand-grey-200);
  border-radius: 4px;
  background: var(--brand-grey-100);
}

.stack-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--brand-grey-200);
  font-size: 13px;
  color: var(--brand-charcoal);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stack-item::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--brand-blue);
  border-radius: 50%;
  flex-shrink: 0;
}

.stack-item:last-child { border-bottom: none; }

.stack-item-base {
  background: var(--brand-grey-200);
  font-weight: 600;
  color: var(--brand-charcoal-soft);
}

.stack-item-base::before { background: var(--brand-charcoal-soft); }

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.controls .btn-primary {
  grid-column: 1 / -1;
}

.btn {
  padding: 10px 14px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-primary {
  background: var(--brand-blue);
  color: var(--brand-white);
  border-color: var(--brand-blue-dark);
}
.btn-primary:hover { background: var(--brand-blue-dark); }

.btn-secondary {
  background: var(--brand-white);
  color: var(--brand-charcoal);
  border-color: var(--brand-grey-300);
}
.btn-secondary:hover {
  background: var(--brand-grey-100);
  border-color: var(--brand-charcoal-soft);
}

.footnote {
  font-size: 11px;
  color: var(--brand-charcoal-soft);
  margin: 8px 0 0;
  text-align: center;
  letter-spacing: 0.3px;
}

/* ==========================================================================
   Mobile — SINGLE-ZONE architecture (per UX audit 2026-07-01).
   Full-screen stage. Product rail becomes slide-up sheet triggered by FAB.
   Callouts killed. Actions in fixed bottom bar so thumb can always reach.
   ========================================================================== */

/* Desktop: hide mobile-only elements */
.mobile-bar, .sheet-backdrop, .sheet-header { display: none; }

@media (max-width: 900px) {
  :root {
    --tile-size: min(78vw, 360px);
    --callout-gutter: 0px;
    --callout-width: 0px;
  }

  html, body { overflow: auto; height: auto; }
  body { padding-bottom: 78px; }  /* room for fixed bottom bar */

  .app-header {
    padding: 10px 14px;
    height: auto;
    gap: 12px;
    position: sticky; top: 0; z-index: 15;
  }
  .logo { height: 38px; }
  .header-text h1 { font-size: 17px; }
  .header-text .tagline { font-size: 11px; }

  .app-main {
    display: block;
    height: auto;
    min-height: calc(100vh - 60px - 78px);
  }

  /* Kill the callout column on mobile — labels live in the stack (redundant). */
  .callout-svg { display: none !important; }

  /* Stage fills the viewport. No competing zones. */
  .stage-wrap {
    min-height: calc(100vh - 60px - 78px);
    padding: 0;
  }
  .stage {
    width: var(--tile-size);
    padding: 12px 0 24px;
  }
  .tile-column { width: var(--tile-size); }
  .tile { bottom: 20px; }

  /* Desktop stack-rail: hidden on mobile. Info moves into the sheet + tile diagram. */
  .stack-rail { display: none; }

  /* ---- Product rail becomes bottom sheet ---- */
  .product-rail {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: 28vh;
    max-height: none;
    padding: 60px 14px calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--brand-white);
    border-right: none;
    border-top: 3px solid var(--brand-blue);
    box-shadow: 0 -8px 28px rgba(15, 25, 40, 0.32);
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
    transform: translateY(105%);
    transition: transform 0.28s cubic-bezier(.2,.9,.3,1);
    z-index: 100;
    -webkit-overflow-scrolling: touch;
  }
  body.sheet-open .product-rail { transform: translateY(0); }

  .sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: absolute; top: 0; left: 0; right: 0;
    height: 52px;
    padding: 0 16px 0 20px;
    background: var(--brand-white);
    border-bottom: 1px solid var(--brand-grey-200);
    border-radius: 18px 18px 0 0;
  }
  .sheet-header h3 {
    font-family: 'Alata', 'Inter', sans-serif;
    margin: 0;
    font-size: 15px;
    color: var(--brand-blue);
    letter-spacing: 1.2px;
    text-transform: uppercase;
  }
  .sheet-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--brand-charcoal-soft);
    padding: 8px 12px;
    cursor: pointer;
  }

  /* Backdrop — dim stage when sheet open, tap to dismiss. */
  .sheet-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15, 25, 40, 0.48);
    opacity: 0; pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 50;
  }
  body.sheet-open .sheet-backdrop {
    opacity: 1; pointer-events: auto;
  }

  .product-group { margin-bottom: 14px; }
  .product-group-title { font-size: 11px; margin-bottom: 6px; }
  .product-btn {
    min-height: 54px;
    padding: 14px 16px;
    font-size: 15px;
    margin-bottom: 6px;
  }

  /* ---- Fixed bottom action bar ---- */
  .mobile-bar {
    display: flex;
    gap: 6px;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--brand-white);
    border-top: 1px solid var(--brand-grey-200);
    box-shadow: 0 -4px 14px rgba(15, 25, 40, 0.10);
    z-index: 20;
  }
  .mobile-bar .btn {
    flex: 1;
    min-height: 50px;
    padding: 10px 8px;
    font-size: 13px;
  }
  .mobile-bar .btn-add {
    flex: 2.4;
    background: var(--brand-blue);
    color: var(--brand-white);
    border-color: var(--brand-blue-dark);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.3px;
  }
  .mobile-bar .btn-mobile-icon {
    flex: 0.9;
    font-size: 22px;
    font-weight: 400;
    padding: 4px 0;
  }
}

@media (max-width: 400px) {
  :root { --tile-size: min(82vw, 300px); }
  .header-text h1 { font-size: 15px; }
  .header-text .tagline { display: none; }
  .app-header { gap: 8px; padding: 8px 12px; }
  .logo { height: 34px; }
}
