/* =========================================================
   Field to Table — styles.css
   Rustic, pro-America, field-to-table aesthetic.
   Warm parchment backdrop, deep navy shadows, aged gold accents.
   ========================================================= */

/* ---------- 1. Design tokens (edit colors/sizes here) ---------- */
:root {
  --bg-deep:       #1a1410;                 /* very dark warm brown */
  --bg-canvas:     #221912;                 /* main page background */
  --bg-vignette:   radial-gradient(ellipse at center, #2b2018 0%, #0e0906 100%);
  --parchment:     #f4ead5;                 /* off-white / cream */
  --parchment-dim: #d9cfb8;                 /* softer cream for body */
  --gold:          #d4a24a;                 /* aged gold */
  --gold-bright:   #f0c96b;                 /* highlight gold */
  --americana-red: #a0332b;                 /* barn red accent */
  --americana-blue:#2a3a56;                 /* muted navy */
  --glow-gold:     rgba(240, 201, 107, 0.55);
  --glow-white:    rgba(255, 248, 220, 0.35);

  --font-display:  "Playfair Display", "Georgia", serif;
  --font-body:     "Inter", "Helvetica Neue", Arial, sans-serif;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --ease-smooth: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 2. Reset + base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--parchment);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  background:
    var(--bg-vignette),
    var(--bg-canvas);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2vw, 40px);
}

/* ---------- 3. Header ---------- */
.site-header {
  text-align: center;
  padding: clamp(12px, 2vw, 28px) 0 clamp(8px, 1.5vw, 20px);
}

.site-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.4vw, 64px);
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--parchment);
  text-shadow: 0 0 24px rgba(0,0,0,0.4);
}

.site-title .amp {
  color: var(--gold);
  font-style: italic;
  font-weight: 400;
  margin: 0 0.15em;
}

.site-tagline {
  font-size: clamp(12px, 1.15vw, 16px);
  margin: 0.4em 0 0;
  color: var(--parchment-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* subtle gold underline flourish */
.site-header::after {
  content: "";
  display: block;
  width: 120px;
  height: 1px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.7;
}

/* ---------- 4. Pyramid stage ---------- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1.5vw, 24px) 0;
  position: relative;
}

.pyramid-frame {
  position: relative;
  width: 100%;
  max-width: 1600px;
  aspect-ratio: 1672 / 941;     /* matches the PNG's real aspect ratio */
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 30px 60px rgba(0,0,0,0.55),
    0 0 0 1px rgba(212, 162, 74, 0.15) inset;
  background: #000;
}

.pyramid-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* keep full pyramid visible, no cropping */
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* ---------- 5. Hotspot layer — glowing circles ---------- */
.hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  border: none;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  transition:
    transform 220ms var(--ease-smooth),
    box-shadow 220ms var(--ease-smooth),
    background 220ms var(--ease-smooth);
  outline: none;
}

/* Debug outline — press D to toggle */
.hotspot-layer.debug .hotspot {
  background: rgba(240, 201, 107, 0.22);
  box-shadow: 0 0 0 1px var(--gold-bright) inset;
}

/* Hover / focus: warm white → gold radial glow + slight grow */
.hotspot:hover,
.hotspot:focus-visible {
  transform: scale(1.10);
  background: radial-gradient(circle,
    var(--glow-white) 0%,
    var(--glow-gold) 45%,
    transparent 70%);
  box-shadow:
    0 0 24px 6px var(--glow-gold),
    0 0 60px 20px var(--glow-white);
}

.hotspot:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* ---------- 6. Tooltip (food name on hover) ---------- */
.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  transform: translate(-50%, -140%);
  pointer-events: none;
  background: rgba(20, 14, 10, 0.92);
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 162, 74, 0.35);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 160ms var(--ease-smooth);
  white-space: nowrap;
  z-index: 40;
}
.tooltip.visible { opacity: 1; }

/* ---------- 7. "Coming soon" toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: rgba(20, 14, 10, 0.95);
  color: var(--parchment);
  border: 1px solid rgba(212, 162, 74, 0.45);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.06em;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 220ms var(--ease-smooth),
    transform 220ms var(--ease-smooth);
  z-index: 50;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 8. Video modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal.open {
  display: flex;
  animation: fadeIn 220ms var(--ease-smooth);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.75), rgba(0,0,0,0.92));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  width: min(92vw, 960px);
  background: linear-gradient(180deg, #241a13 0%, #17100b 100%);
  border: 1px solid rgba(212, 162, 74, 0.35);
  border-radius: var(--radius-lg);
  box-shadow:
    0 40px 80px rgba(0,0,0,0.7),
    0 0 60px rgba(212, 162, 74, 0.10);
  padding: 28px 28px 24px;
  color: var(--parchment);
  animation: rise 320ms var(--ease-smooth);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 14px;
  letter-spacing: 0.02em;
}

.modal-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(212, 162, 74, 0.25);
}

.modal-video {
  width: 100%;
  height: 100%;
  display: block;
}

.modal-caption {
  margin: 14px 0 0;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--parchment-dim);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(212, 162, 74, 0.4);
  background: rgba(0,0,0,0.5);
  color: var(--parchment);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms var(--ease-smooth), transform 160ms var(--ease-smooth);
  z-index: 2;
}
.modal-close:hover,
.modal-close:focus-visible {
  background: var(--gold);
  color: #1a1410;
  transform: scale(1.05);
  outline: none;
}

/* ---------- 9. Footer ---------- */
.site-footer {
  text-align: center;
  padding: 18px 0 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(217, 207, 184, 0.55);
}

/* ---------- 10. Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ---------- 11. Responsive tweaks ---------- */
@media (max-width: 720px) {
  .site-tagline { font-size: 11px; }
  .modal-panel  { padding: 20px 16px 16px; }
  .modal-title  { font-size: 22px; }
}

/* Touch devices: no hover, so make sure tap feels responsive */
@media (hover: none) {
  .hotspot:active {
    transform: scale(1.10);
    background: radial-gradient(circle,
      var(--glow-white) 0%,
      var(--glow-gold) 45%,
      transparent 70%);
    box-shadow: 0 0 24px 6px var(--glow-gold);
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- 12. Discreet keyboard hint (bottom-left) ---------- */
.kb-hint {
  position: fixed;
  bottom: 10px;
  left: 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(217, 207, 184, 0.35);
  z-index: 20;
  pointer-events: none;
}
.kb-hint kbd {
  background: rgba(212, 162, 74, 0.12);
  border: 1px solid rgba(212, 162, 74, 0.25);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: "Consolas", monospace;
}

/* ---------- 13. Drag-and-resize editor (press E) ---------- */
body.edit-mode { cursor: default; }

body.edit-mode .hotspot {
  border: 1px dashed rgba(240, 201, 107, 0.55);
  background: rgba(240, 201, 107, 0.12);
  border-radius: 4px;
  transform: none !important;
  box-shadow: none !important;
  transition: none;
  cursor: move;
}
body.edit-mode .hotspot:hover {
  background: rgba(240, 201, 107, 0.22) !important;
  transform: none !important;
  box-shadow: none !important;
  border-color: var(--gold-bright);
}
body.edit-mode .hotspot.selected {
  border: 2px solid var(--gold-bright);
  background: rgba(240, 201, 107, 0.28);
  z-index: 30;
}

.hotspot-label {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 14, 10, 0.92);
  color: var(--gold-bright);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-body);
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid rgba(212, 162, 74, 0.4);
  display: none;
  z-index: 31;
}
body.edit-mode .hotspot-label { display: block; }

.handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--gold-bright);
  border: 2px solid #1a1410;
  border-radius: 50%;
  z-index: 40;
  display: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
body.edit-mode .hotspot.selected .handle { display: block; }
.handle-nw { top: -7px;    left: -7px;   cursor: nwse-resize; }
.handle-ne { top: -7px;    right: -7px;  cursor: nesw-resize; }
.handle-sw { bottom: -7px; left: -7px;   cursor: nesw-resize; }
.handle-se { bottom: -7px; right: -7px;  cursor: nwse-resize; }

.edit-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 340px;
  background: rgba(20, 14, 10, 0.97);
  border: 1px solid rgba(212, 162, 74, 0.5);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--parchment);
  font-family: var(--font-body);
  z-index: 500;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  font-size: 13px;
}
.edit-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(212, 162, 74, 0.25);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.edit-panel-header strong {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.03em;
}
.edit-selected-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-bright);
  margin-bottom: 8px;
  min-height: 1em;
}
.edit-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-bottom: 10px;
}
.edit-values label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--parchment-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.edit-input {
  flex: 1;
  padding: 4px 6px;
  background: rgba(0,0,0,0.5);
  color: var(--parchment);
  border: 1px solid rgba(212, 162, 74, 0.35);
  border-radius: 4px;
  font-family: "Consolas", monospace;
  font-size: 12px;
  min-width: 0;
}
.edit-input:disabled { opacity: 0.4; }
.edit-help {
  font-size: 11px;
  color: var(--parchment-dim);
  line-height: 1.6;
  margin: 8px 0 12px;
  padding: 8px;
  background: rgba(0,0,0,0.25);
  border-radius: 5px;
}
.edit-help kbd {
  background: rgba(212, 162, 74, 0.15);
  border: 1px solid rgba(212, 162, 74, 0.35);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: "Consolas", monospace;
  font-size: 10px;
}
.edit-actions { display: flex; gap: 8px; margin-bottom: 6px; }
.edit-btn {
  padding: 7px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(212, 162, 74, 0.35);
  color: var(--parchment);
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  transition: background 140ms var(--ease-smooth);
}
.edit-btn:hover { background: rgba(212, 162, 74, 0.18); }
.edit-btn-primary {
  background: var(--gold);
  color: #1a1410;
  border-color: var(--gold);
  font-weight: 600;
  flex: 1;
}
.edit-btn-primary:hover { background: var(--gold-bright); color: #1a1410; }
.edit-output {
  width: 100%;
  height: 90px;
  background: rgba(0,0,0,0.5);
  color: var(--parchment);
  border: 1px solid rgba(212, 162, 74, 0.25);
  border-radius: 5px;
  padding: 8px 10px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 10px;
  resize: vertical;
  margin-top: 8px;
}
