/*
 * Visioramap — design tokens & shared components (charte Evan).
 * Propshaft serves every file in app/assets/stylesheets; this file holds the
 * tokens and the site-wide components. Page-specific styles live in site.css,
 * auth.css, map.css and mobile.css.
 */

@font-face {
  font-family: "Mulish";
  src: url("/assets/Mulish-VariableFont_wght-1f5203a2.ttf") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}
@font-face {
  font-family: "Mulish";
  src: url("/assets/Mulish-Italic-VariableFont_wght-765d1770.ttf") format("truetype");
  font-weight: 200 1000;
  font-style: italic;
  font-display: swap;
}

:root {
  --color-bg-main: #ffffff;
  --color-bg-navbar: #f9f9f9;
  --color-bg-panel: #f2f2f5;
  --color-bg-overlay: rgba(0, 0, 0, 0.2);
  --color-bg-button: #1FA732;
  --color-bg-button-hover: #157a28;
  --color-bg-hover-dark: #d7f4db;
  --color-bg-sidebar: #292c29;
  --color-bg-footer: #121212;

  --color-text-light: #060616;
  --color-text-dark: #ffffff;
  --color-text-accent: #1FA732;
  --color-text-muted: #8a8a8a;
  --color-text-muted-2: #5a5a5a;
  --color-text-muted-3: #757575;
  --color-text-footer: #b0b0b0;

  --color-border-light: #dcdcdc;
  --color-border-muted: #e0e0e0;
  --color-shadow: rgba(0, 0, 0, 0.08);

  --color-danger: #d64545;
  --color-warning: #e6a100;
  --color-up: #ff8000;
  --color-down: #0000ff;

  --gradient-hero: linear-gradient(45deg, #163734, #336D54);
  --gradient-auth: linear-gradient(45deg, #296e73, #46b78e, #9cc960);

  --radius-card: 20px;
  --radius-event: 16px;
  --radius-form: 12px;
  --radius-pill: 9999px;
  --gutter: clamp(16px, 8vw, 130px);
  --navbar-height: 108px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.fade-in { opacity: 0; animation: fadeIn 0.8s ease-out forwards; animation-delay: 0.2s; }

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Mulish", sans-serif;
  font-weight: 400;
  background-color: var(--color-bg-main);
  color: var(--color-text-light);
  line-height: 1.5;
}

button, input, textarea, select { font-family: inherit; font-size: 100%; line-height: inherit; color: inherit; }
img, video, iframe, svg { max-width: 100%; }
code { overflow-wrap: anywhere; }
a { color: inherit; }

.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--color-text-muted); }
.accent { color: var(--color-text-accent); }
.danger { color: var(--color-danger); }
.small { font-size: 13px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; }

/* ---------- Buttons ---------- */
.textbutton {
  color: var(--color-text-light);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;
  align-self: center;
  font-weight: 500;
  background: none;
  border: none;
}
.textbutton:hover { color: var(--color-text-accent); }

.flatbutton, .outlinebutton {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.5;
}
.flatbutton { background-color: var(--color-bg-button); color: var(--color-text-dark); }
.flatbutton:hover { background-color: var(--color-bg-button-hover); }
.flatbutton.danger { background-color: var(--color-danger); }
.flatbutton.danger:hover { background-color: #a83232; }
.flatbutton.secondary { background-color: #444; }
.flatbutton.secondary:hover { background-color: #222; }
.flatbutton:disabled, .flatbutton[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.outlinebutton { background-color: transparent; border-color: var(--color-border-light); color: var(--color-text-light); }
.outlinebutton:hover { color: var(--color-text-accent); border-color: var(--color-text-accent); }
.button-sm { padding: 4px 12px; font-size: 13px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--color-bg-navbar);
  height: var(--navbar-height);
  border-bottom: 1px solid var(--color-border-muted);
  display: flex;
  align-items: center;
}
.navcontainer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 var(--gutter); flex-wrap: wrap; width: 100%; height: 100%;
}
.navlogo { display: flex; align-items: center; }
.navlogo img { max-height: 50px; width: auto; height: auto; }
.navbuttons { display: flex; gap: 32px; align-items: center; }
.hamburger {
  display: none; font-size: 28px; cursor: pointer; color: var(--color-text-light);
  background: none; border: none; transition: color 0.3s ease;
}
.hamburger:hover { color: var(--color-text-accent); }
.overlay { display: none; }

@media (max-width: 1046px) {
  .hamburger { display: block; z-index: 999; padding: 1rem; }
  .navbuttons {
    position: fixed; top: 0; right: -100%; height: 100vh; height: 100dvh; width: min(280px, 85vw); overflow-y: auto;
    background-color: var(--color-bg-navbar); box-shadow: -4px 0 12px var(--color-shadow);
    flex-direction: column; padding: 16px; gap: 8px; transition: right 0.3s ease-in-out; z-index: 1003;
    align-items: stretch;
  }
  .navbuttons.active { right: 0; }
  .navbuttons .textbutton, .navbuttons .flatbutton {
    padding: 16px 8px; font-size: 16px; border-radius: 8px; font-weight: 600; display: block; width: 100%;
  }
  .navbuttons .textbutton { position: relative; text-align: left; }
  .navbuttons .textbutton::after {
    content: "▶"; font-size: 18px; position: absolute; right: 16px; top: 50%;
    transform: translateY(-50%); color: var(--color-text-light); transition: transform 0.3s ease, color 0.3s ease;
  }
  .navbuttons .textbutton:hover::after { transform: translateY(-50%) translateX(5px); color: var(--color-text-accent); }
  .navbuttons .textbutton:hover { background-color: var(--color-bg-hover-dark); color: var(--color-text-accent); }
  .navbuttons .flatbutton { margin-top: auto; }
  .overlay {
    display: block; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--color-bg-overlay); opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease; z-index: 1002;
  }
  .overlay.active { opacity: 1; visibility: visible; }
}

@media (max-width: 700px) {
  :root { --navbar-height: 68px; }
  .navlogo img { max-height: 36px; }
  .hamburger { padding: 8px; }
}

/* ---------- Footer ---------- */
.footer {
  background-color: var(--color-bg-footer); color: #e0e0e0; padding: 48px var(--gutter);
  display: flex; flex-direction: column; gap: 32px; font-size: 15px; line-height: 1.6; font-weight: 400;
}
.footercols { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 48px; }
.footercol { min-width: min(200px, 100%); flex: 1; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.footercoltitle { font-weight: 600; font-size: 17px; color: #ffffff; margin-bottom: 8px; }
.footersub { font-size: 17px; font-weight: 400; color: #ffffff; margin-bottom: 8px; }
.footer .textbutton { color: var(--color-text-footer); cursor: pointer; width: 100%; transition: color 0.3s ease; font-weight: 400; text-align: left; }
.footer .textbutton:hover { color: #1FA732; }
.footersepator { height: 1px; background-color: #2a2a2a; width: 100%; margin-top: 16px; }
.footer > .footercoltitle:last-child { text-align: center; font-size: 14px; color: #777; }

/* ---------- Flash ---------- */
.flash { position: fixed; top: calc(var(--navbar-height) + 12px); right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.flash-item {
  padding: 12px 16px; border-radius: 12px; background: #fff; color: var(--color-text-light);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); border-left: 4px solid var(--color-text-accent); font-weight: 500;
  animation: fadeIn 0.3s ease-out;
}
.flash-item.alert { border-left-color: var(--color-danger); }
.flash-item.notice { border-left-color: var(--color-text-accent); }

/* ---------- Generic cards / forms ---------- */
.card {
  background: #fff; border: 1px solid var(--color-border-light); border-radius: var(--radius-form);
  padding: 24px; box-shadow: 0 2px 8px var(--color-shadow);
}
.card h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .field label { font-size: 0.9rem; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 4px; }
.form input[type="text"], .form input[type="email"], .form input[type="password"], .form input[type="number"],
.form input[type="datetime-local"], .form input[type="url"], .form input[type="tel"], .form input[type="date"],
.form textarea, .form select,
.input {
  padding: 10px 14px; border: 1px solid var(--color-border-light); border-radius: 6px; font-size: 1rem;
  background: #fff; transition: border 0.3s ease, box-shadow 0.3s ease; width: 100%;
}
.form input:focus, .form textarea:focus, .form select:focus, .input:focus {
  border-color: var(--color-text-accent); outline: none; box-shadow: 0 0 0 3px rgba(31, 167, 50, 0.2);
}
.form .checkbox { display: flex; align-items: center; gap: 8px; }
.form .checkbox input { width: 18px; height: 18px; accent-color: var(--color-bg-button); }
.form-errors { background: #fdecec; border: 1px solid #f5b5b5; color: #8a1f1f; border-radius: 8px; padding: 12px 16px; font-size: 14px; }
.form-errors ul { margin-left: 18px; }
.help { font-size: 13px; color: var(--color-text-muted); }

/* ---------- Progress ---------- */
.progress { width: 100%; height: 12px; border-radius: var(--radius-pill); background: var(--color-bg-panel); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-bg-button); transition: width 0.4s ease; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; background: var(--color-bg-panel); color: var(--color-text-muted-2); }
.badge.green { background: var(--color-bg-hover-dark); color: var(--color-bg-button-hover); }
.badge.red { background: #fdecec; color: #8a1f1f; }
.badge.orange { background: #fff3d6; color: #8a5a00; }
.badge.dark { background: #333; color: #fff; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border-muted); text-align: left; vertical-align: middle; }
.table th { font-weight: 600; color: var(--color-text-muted-2); font-size: 13px; }

@media (max-width: 760px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { border: 1px solid var(--color-border-muted); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; }
  .table.stack td { border-bottom: none; padding: 4px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; overflow-wrap: anywhere; }
  .table.stack td[data-label]::before { content: attr(data-label); font-weight: 600; font-size: 13px; color: var(--color-text-muted-2); text-align: left; flex-shrink: 0; }
  .table.stack td.row { justify-content: flex-end; }
}

/* ---------- Segment colors ---------- */
.seg-up { color: var(--color-up); }
.seg-down { color: var(--color-down); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.2); vertical-align: middle; }

/* Video render: current step while no frame counter is available yet */
.video-job-stage { display: flex; align-items: center; gap: 8px; }
.video-job-stage .spinner-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: videoStagePulse 1.2s ease-in-out infinite; }
@keyframes videoStagePulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .video-job-stage .spinner-dot { animation: none; opacity: .6; } }

/* ---------- AddToAny share kit (share modal, Race page, videos) ---------- */
.share-kit { display: flex; flex-wrap: wrap; gap: 8px; line-height: 0; }
.share-kit.a2a_default_style a { padding: 0; }
.share-kit .a2a_svg { border-radius: 50% !important; }
.share-kit .share-instagram .a2a_svg {
  display: inline-block; width: 32px; height: 32px;
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}
.share-kit .share-instagram svg { width: 100%; height: 100%; }
