@import "tailwindcss";

@custom-variant dark (&:where(.dark, .dark *));

:root {
  --background: #eaf4fb;
  --foreground: #0e2438;
  --muted: #5b7388;
  --border: #c5d9e8;
  --card: #f7fcff;
  --ring: #1490c8;
  --surface: #dceaf4;
  --shadow-soft: 0 14px 40px rgba(14, 72, 110, 0.1);
  --brand-blue: #1588c4;
  --brand-blue-deep: #0a3f64;
  --brand-orange: #d4894a;
  --brand-orange-deep: #b86e38;
  --straw: #e2c078;
  --clay: #d4784a;
  --spruce: #147cb4;
  --spruce-ink: #0d5a86;
  --on-brand: #eaf6fd;
  --ink: #0e2438;
  --veil: rgba(10, 36, 58, 0.55);
  --texture-line: rgba(14, 90, 140, 0.11);
  --texture-dot: rgba(14, 90, 140, 0.08);
}

.dark {
  color-scheme: dark;
  --background: #07131f;
  --foreground: #e6f0f8;
  --muted: #8aa4b8;
  --border: #1d3c54;
  --card: #0c1f30;
  --ring: #4db8e8;
  --surface: #123048;
  --shadow-soft: 0 16px 44px rgba(0, 8, 18, 0.55);
  --brand-blue: #1a8ec8;
  --brand-blue-deep: #061422;
  --brand-orange: #e09a62;
  --brand-orange-deep: #c47a42;
  --straw: #e8c888;
  --clay: #e08a68;
  --spruce: #1890c8;
  --spruce-ink: #8ad4f0;
  --on-brand: #e8f4fc;
  --ink: #e6f0f8;
  --veil: rgba(4, 14, 24, 0.72);
  --texture-line: rgba(77, 184, 232, 0.16);
  --texture-dot: rgba(230, 240, 248, 0.1);
}

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-muted: var(--muted);
  --color-border: var(--border);
  --color-card: var(--card);
  --color-ring: var(--ring);
  --color-surface: var(--surface);
  --color-brand: var(--brand-blue);
  --color-brand-orange: var(--brand-orange);
  --font-sans: var(--font-source), ui-sans-serif, system-ui, sans-serif;
  --font-serif: var(--font-fraunces), Georgia, serif;
  --radius-card: 1.25rem;
}

html {
  scroll-behavior: smooth;
  background-color: var(--background);
}

body {
  background-color: var(--background);
  background-image:
    radial-gradient(1200px 560px at 8% -8%, color-mix(in srgb, var(--brand-blue) 18%, transparent), transparent 58%),
    radial-gradient(900px 480px at 96% 0%, color-mix(in srgb, var(--straw) 16%, transparent), transparent 52%),
    radial-gradient(800px 520px at 50% 110%, color-mix(in srgb, var(--spruce) 12%, transparent), transparent 58%);
  background-attachment: fixed;
  color: var(--foreground);
  font-family: var(--font-source), ui-sans-serif, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }
}

/* —— Theme switch: circular reveal veil (storefront + admin) —— */
/* Instant color flip under the veil — prevents laggy double-fades */
html.theme-animating,
html.theme-animating body,
html.theme-animating * {
  transition: none !important;
}

html.theme-animating header,
html.theme-animating [class*="backdrop-blur"] {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.theme-reveal-veil {
  /* GPU-friendly expanding hole; box-shadow paints the old surface */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .theme-reveal-veil {
    display: none !important;
  }
}

::selection {
  background: var(--spruce);
  color: var(--on-brand);
}

.dark ::selection {
  background: var(--straw);
  color: var(--brand-blue-deep);
}

/* Mill paper: diagonal crib lines + grain dots (must read in dark) */
.bg-canvas {
  position: relative;
  isolation: isolate;
  background-color: transparent;
}

.bg-canvas::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    repeating-linear-gradient(
      -18deg,
      var(--texture-line) 0 1px,
      transparent 1px 11px
    ),
    radial-gradient(var(--texture-dot) 0.85px, transparent 0.85px);
  background-size: auto, 5px 5px;
}

.bg-canvas > * {
  position: relative;
  z-index: 1;
}

.bg-grain {
  position: relative;
}

.bg-grain::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
  background-image: radial-gradient(var(--texture-dot) 0.7px, transparent 0.7px);
  background-size: 4px 4px;
}

.dark .bg-grain::after {
  opacity: 0.85;
}

.bg-grain > * {
  position: relative;
  z-index: 1;
}

.silo-chrome {
  position: relative;
  isolation: isolate;
}

.silo-chrome::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(80% 120% at 0% 0%, color-mix(in srgb, var(--brand-blue) 28%, transparent), transparent 58%),
    radial-gradient(70% 90% at 100% 100%, color-mix(in srgb, var(--straw) 14%, transparent), transparent 50%);
}

.silo-chrome::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0 13px,
    color-mix(in srgb, var(--on-brand) 10%, transparent) 13px 14px
  );
}

.dark .silo-chrome::after {
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0 12px,
    color-mix(in srgb, var(--ring) 18%, transparent) 12px 13px
  );
}

.silo-chrome > * {
  position: relative;
  z-index: 2;
}

.silo-paper {
  background-color: var(--card);
  background-image: radial-gradient(var(--texture-dot) 0.7px, transparent 0.7px);
  background-size: 5px 5px;
}

.card-elevated {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.media-zoom {
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.group:hover .media-zoom {
  transform: scale(1.05);
}

/* Form controls stay readable in both themes */
input,
select,
textarea {
  color: var(--foreground);
  background-color: var(--background);
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in oklab, var(--muted) 85%, transparent);
}

.dark input,
.dark select,
.dark textarea {
  background-color: var(--surface);
  border-color: var(--border);
}

/* Soft diagonal reflection / sheen — plays on hover only */
@keyframes promo-reflection {
  0% {
    transform: translateX(-160%) skewX(-18deg);
    opacity: 0;
  }
  20% {
    opacity: 0.9;
  }
  100% {
    transform: translateX(240%) skewX(-18deg);
    opacity: 0;
  }
}

.promo-reflection {
  pointer-events: none;
  position: absolute;
  inset: -20% -30%;
  z-index: 2;
  width: 42%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 28%,
    rgba(255, 255, 255, 0.7) 48%,
    rgba(255, 255, 255, 0.2) 60%,
    transparent 75%
  );
  transform: translateX(-160%) skewX(-18deg);
  opacity: 0;
  mix-blend-mode: soft-light;
}

.group\/promo:hover .promo-reflection {
  animation: promo-reflection 0.75s cubic-bezier(0.22, 1, 0.36, 1) 1;
}

.font-serif {
  font-family: var(--font-fraunces), Georgia, serif;
}

.ticket-perf {
  background-image: radial-gradient(circle at 0 50%, transparent 6px, var(--card) 7px);
  background-size: 14px 100%;
  background-repeat: repeat-y;
}

.hide-scrollbar {
  scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

.tile-lift {
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s ease,
    box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.tile-lift:hover {
  transform: translateY(-7px);
  border-color: color-mix(in srgb, var(--straw) 70%, var(--border));
  box-shadow:
    0 22px 48px rgba(14, 72, 110, 0.16),
    0 0 0 1px color-mix(in srgb, var(--straw) 35%, transparent);
}

.dark .tile-lift:hover {
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px color-mix(in srgb, var(--straw) 40%, transparent);
}

.price-mark {
  display: inline-flex;
  align-items: flex-start;
  font-variant-numeric: tabular-nums;
  color: var(--spruce-ink);
  line-height: 1;
}

.price-mark .cur {
  margin-top: 0.28em;
  font-size: 0.72rem;
  font-weight: 700;
}

.price-mark .dol {
  font-family: var(--font-fraunces), Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.price-mark .cent {
  margin-top: 0.22em;
  margin-left: 0.08em;
  font-size: 0.7rem;
  font-weight: 700;
}

.rail-btn {
  display: inline-flex;
  height: 2.35rem;
  width: 2.35rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--foreground);
  background: var(--card);
  border: none;
  clip-path: polygon(
    0 0,
    calc(100% - 7px) 0,
    100% 7px,
    100% 100%,
    7px 100%,
    0 calc(100% - 7px)
  );
  box-shadow: inset 0 0 0 1px var(--border);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.rail-btn:hover {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--straw);
  transform: translateY(-1px);
}

/* Mill bin-tag buttons — cut corners like a crib stencil, not pills */
.btn-bin {
  --bin-fill: var(--spruce);
  --bin-ink: var(--on-brand);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.5rem;
  padding: 0 1.1rem;
  border: 0;
  color: var(--bin-ink);
  background:
    repeating-linear-gradient(
      -28deg,
      transparent 0 7px,
      color-mix(in srgb, var(--bin-ink) 6%, transparent) 7px 8px
    ),
    var(--bin-fill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  clip-path: polygon(
    0 0,
    calc(100% - 9px) 0,
    100% 9px,
    100% 100%,
    9px 100%,
    0 calc(100% - 9px)
  );
  transition: filter 0.2s, transform 0.2s;
}

.btn-bin::before {
  content: "";
  pointer-events: none;
  position: absolute;
  top: 5px;
  left: 7px;
  width: 11px;
  height: 2px;
  background: var(--straw);
}

.btn-bin::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 3px;
  clip-path: polygon(
    0 0,
    calc(100% - 6px) 0,
    100% 6px,
    100% 100%,
    6px 100%,
    0 calc(100% - 6px)
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--straw) 50%, transparent);
}

.btn-bin:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-bin:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-bin-straw {
  --bin-fill: var(--straw);
  --bin-ink: var(--brand-blue-deep);
}

.btn-bin-straw::before {
  background: var(--brand-blue-deep);
}

.btn-bin-straw::after {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-blue-deep) 22%, transparent);
}

.btn-bin-clay {
  --bin-fill: var(--clay, #b85c38);
  --bin-ink: #fff8ee;
}

.btn-bin-ghost {
  --bin-fill: color-mix(in srgb, var(--on-brand) 7%, transparent);
  --bin-ink: var(--on-brand);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--straw) 45%, transparent);
}

.btn-bin-ghost::after {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on-brand) 12%, transparent);
}

.btn-bin-ghost:hover:not(:disabled) {
  --bin-fill: color-mix(in srgb, var(--straw) 18%, transparent);
  filter: none;
}

.btn-bin-outline {
  --bin-fill: var(--card);
  --bin-ink: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}

.btn-bin-outline::before {
  background: color-mix(in srgb, var(--straw) 75%, var(--spruce));
}

.btn-bin-outline:hover:not(:disabled) {
  --bin-fill: var(--surface);
  box-shadow: inset 0 0 0 1px var(--straw);
  filter: none;
}

.btn-bin-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.btn-bin-icon::before {
  left: 6px;
  width: 8px;
}

@media (min-width: 768px) {
  .btn-bin-grow {
    width: auto;
    min-width: 2.5rem;
    padding-inline: 0.85rem;
  }
}

.btn-bin-wide {
  width: 100%;
}

.btn-bin-sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

.btn-bin-sm::before {
  width: 8px;
}

.field-bin {
  height: 2.65rem;
  width: 100%;
  border: 0;
  background: var(--background);
  padding: 0 0.95rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  clip-path: polygon(
    0 0,
    calc(100% - 9px) 0,
    100% 9px,
    100% 100%,
    9px 100%,
    0 calc(100% - 9px)
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--straw) 28%, var(--border));
}

.field-bin:focus,
.field-bin:focus-within {
  box-shadow: inset 0 0 0 1px var(--straw);
}

.crib-chip {
  clip-path: polygon(
    0 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% 100%,
    8px 100%,
    0 calc(100% - 8px)
  );
}

.qty-bin {
  display: inline-flex;
  align-items: center;
  clip-path: polygon(
    0 0,
    calc(100% - 7px) 0,
    100% 7px,
    100% 100%,
    7px 100%,
    0 calc(100% - 7px)
  );
  box-shadow: inset 0 0 0 1px var(--border);
  background: var(--background);
}

.search-bin {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: var(--card);
  clip-path: polygon(
    0 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--straw) 28%, transparent);
}

.search-bin input {
  flex: 1;
  min-width: 0;
  height: 2.65rem;
  border: 0;
  background: transparent;
  padding-left: 2.4rem;
  padding-right: 0.5rem;
}

.search-bin .btn-bin {
  height: auto;
  align-self: stretch;
  border-radius: 0;
}
