/* ==========================================================
   ar-app.css — AR Dice Roll page (augmentedReality.html)
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Colours from the site palette (same as style.css) */
  --text-primary: #1f3442;       /* deep steel blue */
  --text-secondary: #555555;     /* deep grey */
  --accent-blue: #3b6f8f;        /* steel blue, deepened (buttons, headings, active menu link) */
  --accent-violet: #5e5e5e;      /* deep grey */
  --nav-height: 56px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* AR.js sets the body's size and margins to match the camera view (see ar-app.js),
   so no width / height / position here. */
html {
  background: #000000;
  overflow: hidden;
}

body.ar-page {
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  /* Must stay transparent: AR.js puts the camera picture behind the page,
     so a body background would cover it. The black comes from <html>. */
  background: transparent;
  color: var(--text-primary);
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* Never show Safari's video play button over the camera view (iPhone / iPad) */
#arjs-video::-webkit-media-controls,
#arjs-video::-webkit-media-controls-start-playback-button,
#arjs-video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none;
}

/* AR.js adds its own plain-text error box; ar-app.js shows a friendlier one instead */
#error-popup {
  display: none !important;
}

/* ---------- Navigation ---------- */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 4px 0;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-blue);
}

.hamburger {
  display: none;
  font-size: 24px;
  line-height: 1;
  padding: 6px;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
}

@media (max-width: 700px) {
  .hamburger {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: calc(var(--nav-height) - 4px);
    right: 12px;
    width: 200px;
    flex-direction: column;
    gap: 0;
    padding: 0 16px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
  }

  .nav-links.open {
    max-height: 240px;
    opacity: 1;
    padding: 10px 16px;
  }

  .nav-links a {
    color: var(--text-primary);
    padding: 10px 0;
  }
}

/* ---------- Instructions toggle ---------- */
#info-toggle {
  position: fixed;
  top: calc(var(--nav-height) + 12px);
  right: 14px;
  z-index: 1001;
  min-height: 40px;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  background: #1f3442;
  color: #ffffff;
  font: 600 0.9rem/1 inherit;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ---------- Instructions panel ---------- */
#project-info {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  max-height: calc(100% - var(--nav-height));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 999;
  transition: transform 0.35s ease;
}

#project-info.is-collapsed {
  transform: translateY(-110%);
  pointer-events: none;
}

.project-info-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 22px 20px 24px;
}

.project-info-content h1 {
  display: inline-block;
  margin: 0 0 6px;
  padding-right: 120px; /* room for the Hide button */
  font-size: 1.8rem;
  line-height: 1.15;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lead {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
}

.ar-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.ar-step-card {
  padding: 16px;
  border-radius: 12px;
  background: #f1f5f9;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.ar-step-card strong {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 1rem;
  color: var(--text-primary);
}

.step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ar-step-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

.marker-card .marker-link {
  display: inline-block;
  margin: 4px 0 8px;
}

.marker-card img {
  display: block;
  width: 180px;
  height: 180px;
  max-width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  border: none;
  color: #ffffff;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  box-shadow: 0 6px 16px -6px rgba(73, 130, 166, 0.6);
}

.btn-secondary {
  border: 1px solid #d6d0cb;
  color: var(--text-primary);
  background: #ffffff;
}

/* ---------- Messages over the camera view ---------- */
.ar-overlay-message {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-weight: 500;
  pointer-events: none;
}

.ar-status {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}

/* Gentle shake when someone taps before the marker is in view */
.ar-status.nudge {
  animation: nudge 0.4s ease;
}

@keyframes nudge {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(calc(-50% - 8px)); }
  75% { transform: translateX(calc(-50% + 8px)); }
}

.ar-result {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  padding: 10px 26px;
  border-radius: 16px;
  background: #ffffff;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  animation: result-pop 0.35s ease-out;
}

.ar-result b {
  font-size: 1.8rem;
  margin-left: 6px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes result-pop {
  from { opacity: 0; transform: translate(-50%, 12px) scale(0.9); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ---------- Camera error ---------- */
.ar-error {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1002;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - var(--nav-height) - 32px);
  overflow-y: auto;
  padding: 22px;
  border-radius: 16px;
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.ar-error strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.ar-error p,
.ar-error li {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ar-error ul {
  margin: 6px 0 16px;
  padding-left: 20px;
}

@media (prefers-reduced-motion: reduce) {
  #project-info,
  .ar-result {
    transition: none;
    animation: none;
  }
}
