/* ==========================================================================
   Loire·360° — Studio Forez
   Palette : fleuve (teal profond), pierre/parchemin, lumière rasante (or)
   ========================================================================== */

:root {
  --bg-deep: #0D2426;
  --bg-panel: #123236;
  --cream: #F2EBDD;
  --gold: #C98A3E;
  --gold-bright: #E3A85C;
  --teal: #6FA89E;
  --ink: #142A2C;
  --line: rgba(242, 235, 221, 0.14);
  --line-dark: rgba(20, 42, 44, 0.12);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 500; margin: 0 0 0.5em; }

/* ---------- Nav ---------- */
.p360-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}
.p360-nav.is-scrolled {
  background: rgba(13, 36, 38, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--line);
}
.p360-nav.is-dark-forced {
  background: rgba(13, 36, 38, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--line);
}
.p360-nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.p360-brand {
  font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--cream); text-decoration: none;
}
.p360-brand-degree { color: var(--gold-bright); }

.p360-nav-links { list-style: none; display: flex; gap: 32px; margin: 0; padding: 0; }
.p360-nav-links a {
  color: var(--cream); text-decoration: none; font-size: 14px; font-weight: 500;
  letter-spacing: 0.01em; padding-bottom: 4px; border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0.85;
}
.p360-nav-links a:hover,
.p360-nav-links a[aria-current="page"] { opacity: 1; border-color: var(--gold-bright); }

.p360-nav-toggle {
  display: none; flex-direction: column; gap: 4px; background: none; border: 0; padding: 6px; cursor: pointer;
}
.p360-nav-toggle span { width: 22px; height: 2px; background: var(--cream); display: block; }

@media (max-width: 760px) {
  .p360-nav-toggle { display: flex; }
  .p360-nav-links {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: rgba(13, 36, 38, 0.97); backdrop-filter: blur(8px);
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
  }
  .p360-nav-links.is-open { max-height: 260px; }
  .p360-nav-links li { border-top: 1px solid var(--line); }
  .p360-nav-links a { display: block; padding: 16px 24px; border-bottom: 0; }
}

/* ---------- Hero ---------- */
.p360-hero {
  position: relative; height: 100vh; min-height: 560px; overflow: hidden;
  background: var(--bg-deep); color: var(--cream);
}
.p360-hero-pano { position: absolute; inset: 0; }
.p360-canvas-wrap { position: absolute; inset: 0; touch-action: none; }
.p360-canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }
.p360-ray-overlay {
  position: absolute; inset: 0; pointer-events: none;
  mix-blend-mode: screen; opacity: 0; z-index: 2;
}
.p360-poi-popup {
  position: absolute; z-index: 7; transform: translate(-50%, calc(-100% - 18px));
  background: var(--bg-panel); color: var(--cream); border-radius: var(--radius);
  padding: 14px 18px; max-width: 240px; box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease;
}
.p360-poi-popup.is-visible { opacity: 1; pointer-events: auto; }
.p360-poi-popup-title { font-family: var(--font-display); font-size: 1rem; margin-bottom: 4px; padding-right: 16px; }
.p360-poi-popup-desc { font-size: 0.85rem; color: rgba(242,235,221,0.8); line-height: 1.4; }
.p360-poi-popup-link { display: inline-block; margin-top: 8px; font-size: 0.82rem; color: var(--gold-bright); text-decoration: none; }
.p360-poi-popup-close {
  position: absolute; top: 8px; right: 10px; background: none; border: 0; color: rgba(242,235,221,0.6);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px;
}
.p360-poi-popup-close:hover { color: var(--cream); }
.p360-hero-scrim {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, rgba(13,36,38,0.15) 0%, rgba(13,36,38,0.35) 55%, rgba(13,36,38,0.92) 100%);
}
.p360-hero-content {
  position: relative; z-index: 4; height: 100%;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  max-width: 1180px; margin: 0 auto; padding: 0 24px 8vh;
}
.p360-hero-panel {
  background: rgba(13,36,38,0.5); backdrop-filter: blur(6px);
  border: 1px solid rgba(242,235,221,0.1);
  border-radius: 10px; padding: 36px 40px; max-width: 620px;
}
@media (max-width: 600px) {
  .p360-hero-panel { padding: 24px 22px; }
}
.p360-eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold-bright); margin-bottom: 18px;
}
.p360-hero-title {
  font-size: clamp(2.2rem, 5.5vw, 4rem); line-height: 1.05; max-width: 14ch; margin-bottom: 20px;
}
.p360-hero-title em { font-style: italic; color: var(--gold-bright); }
.p360-hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 46ch; color: rgba(242,235,221,0.85);
  margin-bottom: 36px;
}

.p360-bearing {
  position: absolute; left: 24px; bottom: 28px; z-index: 4;
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.05em; color: rgba(242,235,221,0.75);
}
.p360-scroll-cue {
  position: absolute; right: 28px; bottom: 28px; z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(242,235,221,0.6); text-decoration: none;
}
.p360-scroll-cue span:last-child { animation: p360-bounce 1.8s ease-in-out infinite; }
@keyframes p360-bounce { 0%,100% { transform: translateY(0);} 50% { transform: translateY(6px);} }

/* ---------- Buttons ---------- */
.p360-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  padding: 14px 28px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.p360-btn:hover { transform: translateY(-1px); }
.p360-btn-gold { background: var(--gold); color: var(--bg-deep); }
.p360-btn-gold:hover { background: var(--gold-bright); }
.p360-btn-ghost { background: transparent; border-color: var(--line); color: var(--cream); }
.p360-btn-ghost:hover { border-color: var(--gold-bright); }
.p360-btn-dark { background: var(--ink); color: var(--cream); }
.p360-btn-dark:hover { background: #0c1f21; }
.p360-btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.p360-btn-dark-glass {
  background: rgba(13,36,38,0.55); backdrop-filter: blur(6px);
  border-color: rgba(242,235,221,0.18); color: var(--cream);
}
.p360-btn-dark-glass:hover { background: rgba(13,36,38,0.75); }

.p360-poi-toggle {
  position: absolute; bottom: 24px; right: 24px; z-index: 6;
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(13,36,38,0.55); backdrop-filter: blur(6px);
  border: 1px solid rgba(242,235,221,0.18); color: var(--cream);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.p360-poi-toggle:hover { background: rgba(13,36,38,0.75); }
.p360-poi-toggle.is-off { opacity: 0.55; }

/* ---------- Sections ---------- */
.p360-section { max-width: 1180px; margin: 0 auto; padding: 96px 24px; }
.p360-section-head { max-width: 620px; margin-bottom: 48px; }
.p360-section-head .p360-eyebrow { color: var(--teal); }
.p360-section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.p360-section-head p { color: rgba(20,42,44,0.7); font-size: 1.05rem; }

.p360-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 860px) { .p360-cards { grid-template-columns: 1fr; } }
.p360-card {
  background: var(--bg-panel); color: var(--cream); border-radius: var(--radius);
  padding: 28px; position: relative;
}
.p360-card-bearing {
  font-family: var(--font-mono); font-size: 12px; color: var(--gold-bright);
  letter-spacing: 0.05em; margin-bottom: 14px; display: block;
}
.p360-card h3 { font-size: 1.2rem; margin-bottom: 10px; }
.p360-card p { color: rgba(242,235,221,0.75); font-size: 0.95rem; margin: 0; }

/* ---------- Footer ---------- */
.p360-footer { background: var(--bg-deep); color: var(--cream); }
.p360-footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 56px 24px 40px;
  display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; align-items: flex-start;
  border-top: 1px solid var(--line);
}
.p360-footer-brand p { color: rgba(242,235,221,0.6); font-size: 0.9rem; margin-top: 8px; }
.p360-footer-links { display: flex; flex-direction: column; gap: 10px; }
.p360-footer-links a { text-decoration: none; font-size: 0.9rem; color: rgba(242,235,221,0.8); }
.p360-footer-links a:hover { color: var(--gold-bright); }
.p360-footer-credit { width: 100%; font-size: 0.8rem; color: rgba(242,235,221,0.45); margin: 24px 0 0; }
.p360-footer-credit a { color: rgba(242,235,221,0.7); }

/* ---------- Cookie banner ---------- */
.p360-cookie-banner {
  position: fixed; left: 20px; right: 20px; bottom: -140px; z-index: 200;
  max-width: 640px; margin: 0 auto; background: var(--bg-panel); color: var(--cream);
  border-radius: var(--radius); padding: 20px 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  transition: bottom 0.4s ease, opacity 0.4s ease; opacity: 0;
}
.p360-cookie-banner.is-visible { bottom: 20px; opacity: 1; }
.p360-cookie-banner.is-hidden { opacity: 0; }
.p360-cookie-banner p { margin: 0; font-size: 0.85rem; color: rgba(242,235,221,0.85); flex: 1 1 320px; }
.p360-cookie-banner a { color: var(--gold-bright); }
.p360-cookie-actions { display: flex; gap: 10px; }
.p360-cookie-actions .p360-btn { padding: 10px 18px; font-size: 0.85rem; }

/* ---------- Page "Découvrir" : filtres + planche ---------- */
.p360-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.p360-filter {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.03em;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line-dark);
  background: transparent; color: var(--ink); text-decoration: none; cursor: pointer;
}
.p360-filter[aria-current="true"] { background: var(--ink); color: var(--cream); border-color: var(--ink); }

.p360-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .p360-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .p360-board { grid-template-columns: 1fr; } }

.p360-tile { text-decoration: none; color: var(--ink); display: block; }
.p360-tile-visual {
  position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-panel);
}
.p360-tile-visual img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.p360-tile:hover .p360-tile-visual img { transform: scale(1.05); }
.p360-tile-tag {
  position: absolute; top: 12px; left: 12px; font-family: var(--font-mono); font-size: 11px;
  background: rgba(13,36,38,0.75); color: var(--gold-bright); padding: 4px 10px; border-radius: 999px;
  letter-spacing: 0.05em;
}
.p360-tile-title { margin-top: 12px; font-family: var(--font-display); font-size: 1.05rem; }
.p360-tile-city { margin-top: 2px; font-size: 0.85rem; color: rgba(20,42,44,0.55); }

.p360-empty { color: rgba(20,42,44,0.55); font-style: italic; }

/* ---------- Page lieu (visite) ---------- */
.p360-viewer-page { background: var(--bg-deep); color: var(--cream); }
.p360-viewer-stage { position: relative; height: 100vh; min-height: 560px; }
.p360-viewer-hud {
  position: absolute; top: 96px; left: 24px; z-index: 6; max-width: 420px;
}
.p360-viewer-hud h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 8px; }
.p360-viewer-start {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: rgba(13,36,38,0.55); backdrop-filter: blur(2px);
}
.p360-viewer-start.is-hidden { display: none; }
.p360-viewer-hint {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 6;
  font-family: var(--font-mono); font-size: 12px; color: rgba(242,235,221,0.6);
}

/* ==========================================================================
   Backoffice
   ========================================================================== */
.p360-admin { background: #F5F2EA; min-height: 100vh; font-family: var(--font-body); color: var(--ink); }
.p360-admin-bar {
  background: var(--bg-deep); color: var(--cream); padding: 16px 28px;
  display: flex; justify-content: space-between; align-items: center;
}
.p360-admin-bar a { color: var(--cream); text-decoration: none; }
.p360-admin-bar .p360-brand { font-size: 14px; }
.p360-admin-nav { display: flex; gap: 20px; font-size: 14px; }
.p360-admin-nav a { opacity: 0.8; }
.p360-admin-nav a:hover { opacity: 1; }

.p360-admin-main { max-width: 1000px; margin: 0 auto; padding: 40px 24px; }
.p360-admin-main h1 { font-size: 1.6rem; margin-bottom: 24px; }

.p360-admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.p360-admin-table th, .p360-admin-table td {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-dark); font-size: 14px;
}
.p360-admin-table th { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(20,42,44,0.55); }
.p360-tag { font-family: var(--font-mono); font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--bg-panel); color: var(--gold-bright); }
.p360-status-on { color: #2f7d4f; font-weight: 600; }
.p360-status-off { color: #a34141; font-weight: 600; }
.p360-row-actions a { margin-right: 12px; font-size: 13px; text-decoration: none; color: var(--teal); }
.p360-row-actions a.danger { color: #a34141; }

.p360-form { background: #fff; padding: 28px; border-radius: var(--radius); max-width: 640px; }
.p360-field { margin-bottom: 20px; }
.p360-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.p360-field input[type=text], .p360-field input[type=number], .p360-field input[type=password],
.p360-field select, .p360-field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-dark); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; background: #fff;
}
.p360-field-inline { display: flex; align-items: center; gap: 10px; }
.p360-field small { display: block; color: rgba(20,42,44,0.55); font-size: 12px; margin-top: 4px; }
.p360-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.p360-preview {
  position: relative; width: 100%; aspect-ratio: 16/9; background: var(--bg-deep); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
}
.p360-preview-target {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 28px; height: 28px; pointer-events: none; z-index: 5;
}
.p360-preview-target::before, .p360-preview-target::after {
  content: ''; position: absolute; background: rgba(242,235,221,0.75);
}
.p360-preview-target::before { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%); }
.p360-preview-target::after { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%); }

.p360-alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 20px; }
.p360-alert-error { background: #FBEAEA; color: #a34141; }
.p360-alert-success { background: #E9F5EC; color: #2f7d4f; }

.p360-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-deep);
}
.p360-login-card {
  background: var(--cream); padding: 40px; border-radius: var(--radius); width: 100%; max-width: 360px;
}
.p360-login-card h1 { font-size: 1.3rem; margin-bottom: 24px; }

/* ---------- Static content pages (mentions légales / cookies / contact) ---------- */
.p360-content { max-width: 760px; margin: 0 auto; padding: 140px 24px 96px; }
.p360-content h1 { font-size: 2rem; margin-bottom: 24px; }
.p360-content h2 { font-size: 1.2rem; margin: 32px 0 12px; }
.p360-content p { color: rgba(20,42,44,0.8); }
.p360-content-form .p360-field { max-width: 480px; }
