/* Ligue des Apéros — structured CSS, no build step, mobile-first. */

:root {
  --color-bg: #FAF6F0;
  --color-bg-alt: #FFFFFF;
  --color-ink: #24201B;
  --color-ink-soft: #756B60;
  --color-primary: #D9642A;
  --color-primary-dark: #B84E1A;
  --color-primary-light: #FBEAE0;
  --color-secondary: #2E7D5B;
  --color-gold: #E4A925;
  --color-border: #EBE2D5;
  --color-danger: #C1382D;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 10px 28px rgba(36, 26, 16, 0.10);
  --shadow-soft: 0 3px 12px rgba(36, 26, 16, 0.07);
  --shadow-primary: 0 8px 20px rgba(217, 100, 42, 0.28);
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --header-height: 60px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--color-primary-dark); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }

/* Inline SVG icons (Lucide) — sized in em so they follow the surrounding text/button */
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.icon-lg { width: 1.5em; height: 1.5em; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.container-narrow { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 1rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: none; border-radius: var(--radius-md); padding: .8rem 1.5rem; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out), background .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: 0 12px 24px rgba(217, 100, 42, 0.32); }
.btn-secondary { background: var(--color-bg-alt); color: var(--color-ink); border: 1px solid var(--color-border); }
.btn-secondary:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }
.btn-ghost { background: transparent; color: var(--color-ink-soft); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 1.1rem 2rem; font-size: 1.1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
@media (hover: none) { .btn-primary:hover { transform: none; } }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; padding: .7rem .9rem; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font-size: 1rem; background: #fff; color: var(--color-ink); font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 3px solid var(--color-gold); outline-offset: 1px; }
.field { margin-bottom: 1.1rem; }
.field-error { color: var(--color-danger); font-size: .85rem; margin-top: .3rem; }
.checkbox-row { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; }
.checkbox-row input { margin-top: .3rem; }

/* City picker (autocomplete + geolocate) */
.city-picker { position: relative; }
.city-picker-row { display: flex; gap: .5rem; }
.city-picker-row input { flex: 1; }
.city-geolocate-btn {
  flex: none; border: 1px solid var(--color-border); background: #fff; border-radius: var(--radius-md);
  padding: 0 .9rem; cursor: pointer; display: flex; align-items: center; color: var(--color-ink-soft);
}
.city-suggestions {
  position: absolute; z-index: 20; top: calc(100% + .3rem); left: 0; right: 0;
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  list-style: none; margin: 0; padding: .3rem; max-height: 220px; overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.city-suggestions li { padding: .55rem .7rem; border-radius: 8px; cursor: pointer; font-size: .92rem; }
.city-suggestions li:hover, .city-suggestions li.active { background: #FFF1E4; }
.city-status { font-size: .8rem; color: var(--color-ink-soft); margin-top: .35rem; min-height: 1em; }

/* Top nav */
.site-header {
  position: sticky; top: 0; z-index: 40; background: rgba(250, 246, 240, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--color-ink); display: inline-flex; align-items: center; gap: .4rem; }
@media (min-width: 640px) { .site-header .container { height: var(--header-height); } .brand { font-size: 1.25rem; } }
.brand .crest-logo { width: 1.9em; height: 1.9em; object-fit: contain; flex: none; }
.nav-links { display: none; gap: 1.25rem; align-items: center; }
@media (min-width: 860px) { .nav-links { display: flex; } }

/* App bottom nav (mobile) */
.app-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--color-bg-alt); border-top: 1px solid var(--color-border);
  display: flex; justify-content: space-around; padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
}
@media (min-width: 860px) { .app-tabbar { display: none; } }
.app-tabbar a { color: var(--color-ink-soft); font-size: .68rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .3rem .6rem; }
.app-tabbar a, .app-tabbar .icon { transition: color .15s ease, transform .2s var(--ease-out); }
.app-tabbar a.active { color: var(--color-primary-dark); font-weight: 700; }
.app-tabbar a.active .icon { transform: scale(1.12); }
.app-tabbar .icon { width: 1.3rem; height: 1.3rem; }
.app-tabbar a.tabbar-publish .icon-publish-wrap {
  width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--color-primary); color: #fff;
  display: flex; align-items: center; justify-content: center; margin-bottom: .1rem;
  box-shadow: 0 4px 12px rgba(217, 100, 42, 0.4); transition: transform .2s var(--ease-out), background .15s ease;
}
.app-tabbar a.tabbar-publish .icon-publish-wrap .icon { width: 1.15rem; height: 1.15rem; }
.app-tabbar a.tabbar-publish.active .icon-publish-wrap { background: var(--color-primary-dark); transform: scale(1.08); }
.app-tabbar a.tabbar-publish.active .icon { transform: none; }
.app-tabbar a.tabbar-publish:active .icon-publish-wrap { transform: scale(0.92); }
.app-content { padding-bottom: 5rem; }
.app-content.has-fab { padding-bottom: 8rem; }
@media (min-width: 860px) { .app-content { padding-bottom: 2rem; } .app-content.has-fab { padding-bottom: 2rem; } }

/* Compact hero: home is now hero + feed merged into one page, so the hero must stay small
   (~30-35% of the viewport height on phones) and hand off to real content fast. */
.hero-compact { text-align: left; padding: .4rem 0 .6rem; max-width: 480px; margin: 0 auto; }
.hero-compact h1 { font-size: 1.25rem; margin: 0 0 .3rem; line-height: 1.25; }
.hero-compact .lede { font-size: .82rem; color: var(--color-ink-soft); margin: 0 0 .6rem; }
.hero-compact .btn-lg { width: 100%; padding: .65rem 1.1rem; font-size: .9rem; }
.hero-compact .hero-secondary-link { display: inline-block; margin-top: .5rem; font-size: .8rem; font-weight: 500; color: var(--color-ink-soft); background: none; border: none; cursor: pointer; padding: .2rem 0; }
.hero-compact .hero-secondary-link:hover { color: var(--color-primary-dark); text-decoration: underline; }
@media (min-width: 640px) {
  .hero-compact { text-align: center; max-width: 620px; padding: 1.5rem 0 1.75rem; }
  .hero-compact h1 { font-size: 1.6rem; margin-bottom: .4rem; }
  .hero-compact .lede { font-size: 1rem; margin-bottom: 1rem; }
  .hero-compact .btn-lg { width: auto; padding: .9rem 1.5rem; font-size: 1rem; }
}

/* Feed section heading */
.feed-heading { display: flex; align-items: center; justify-content: space-between; margin: .5rem 0 .9rem; }
.feed-heading h2 {
  font-size: .78rem; font-weight: 700; margin: 0; font-family: var(--font-body); color: var(--color-primary-dark);
  text-transform: uppercase; letter-spacing: .07em; position: relative; padding-left: .7rem;
}
.feed-heading h2::before { content: ''; position: absolute; left: 0; top: .1rem; bottom: .1rem; width: 3px; border-radius: 2px; background: var(--color-primary); }

/* Compact "top villes" insert card shown a few posts into the feed */
.ranking-insert { background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 1rem 1.1rem 1.2rem; margin-bottom: 1.25rem; }
.ranking-insert-title { font-weight: 600; margin: 0 0 .6rem; font-size: .92rem; color: var(--color-ink-soft); }
.ranking-insert .podium-row { padding: .45rem .1rem; }
.ranking-insert .btn { width: 100%; margin-top: .5rem; }

/* Floating "prendre une photo" action button — always-reachable primary CTA on the home feed */
.fab-capture {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(0); bottom: calc(4.6rem + env(safe-area-inset-bottom));
  z-index: 45; display: flex; align-items: center; gap: .5rem; background: var(--color-primary); color: #fff;
  border-radius: var(--radius-md); padding: .75rem 1.3rem; font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-primary);
  text-decoration: none; white-space: nowrap; transition: transform .18s var(--ease-out), background .15s ease, box-shadow .18s var(--ease-out);
}
.fab-capture:hover { background: var(--color-primary-dark); text-decoration: none; transform: translateX(-50%) translateY(-2px); box-shadow: 0 14px 28px rgba(217, 100, 42, 0.32); }
.fab-capture:active { transform: translateX(-50%) scale(0.96); }
@media (min-width: 860px) { .fab-capture { bottom: 1.5rem; } }

/* First-visit intro panel */
.intro-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(36, 32, 27, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s ease, visibility 0s linear .25s;
}
.intro-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s ease; }
@media (min-width: 640px) { .intro-overlay { align-items: center; } }
.intro-panel {
  background: var(--color-bg-alt); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-card);
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom)); width: 100%; max-width: 460px;
  transform: translateY(28px); transition: transform .3s var(--ease-out);
}
.intro-overlay.open .intro-panel { transform: translateY(0); }
@media (min-width: 640px) { .intro-panel { border-radius: var(--radius-lg); margin: 1rem; } }
.intro-panel h3 { margin: 0 0 1rem; font-size: 1.1rem; font-family: var(--font-body); font-weight: 600; }
.intro-steps { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.intro-steps li { display: flex; align-items: center; gap: .7rem; font-size: .92rem; }
.intro-steps .step-icon { color: var(--color-ink-soft); flex: none; }
.intro-panel .btn-block { margin-bottom: .5rem; }
.intro-dismiss { display: block; width: 100%; text-align: center; background: none; border: none; color: var(--color-ink-soft); font-size: .85rem; cursor: pointer; padding: .4rem; }

/* Podium */
.podium-block { background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 1.5rem; margin: 2rem auto; max-width: 640px; }
.podium-title { text-align: center; font-weight: 600; margin-bottom: 1rem; font-family: var(--font-body); }
.podium-row { display: flex; align-items: center; justify-content: space-between; padding: .6rem .4rem; border-bottom: 1px solid var(--color-border); }
.podium-row:last-child { border-bottom: none; }
.podium-rank { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--color-ink-soft); width: 2rem; }
.podium-city { flex: 1; font-weight: 600; }
.podium-points { color: var(--color-ink-soft); font-weight: 500; }

.live-dot {
  width: .6rem; height: .6rem; border-radius: 50%; background: #2E7D5B; flex: none;
  box-shadow: 0 0 0 rgba(46, 125, 91, .5); animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 125, 91, .5); }
  70% { box-shadow: 0 0 0 8px rgba(46, 125, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 125, 91, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Cards / feed */
.card {
  background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft); overflow: hidden; margin-bottom: 1.25rem;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); } }

/* Feed cards ease in on load, staggered per post via inline animation-delay */
.apero-card { animation: card-in .45s var(--ease-out) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .apero-card { animation: none; } }

.apero-card .apero-photo-wrap { position: relative; }
.apero-card .apero-photo { width: 100%; aspect-ratio: 4/5; object-fit: cover; background: var(--color-border); }
.apero-points-sticker {
  position: absolute; bottom: .6rem; left: .6rem; background: rgba(36, 32, 27, .68); color: #fff;
  font-weight: 600; font-size: .76rem; padding: .22rem .6rem; border-radius: 999px;
  backdrop-filter: blur(3px);
}
.apero-card .apero-body { padding: .8rem 1rem 1rem; }
.apero-meta { display: flex; align-items: baseline; gap: .35rem; font-size: .9rem; color: var(--color-ink); margin-bottom: .3rem; flex-wrap: wrap; }
.apero-meta .author-line { font-weight: 700; }
.apero-meta .city-tag { font-weight: 600; color: var(--color-primary-dark); text-decoration: none; }
.apero-meta .city-tag:hover { text-decoration: underline; }
.apero-meta .time { color: var(--color-ink-soft); font-size: .82rem; margin-left: auto; }
.apero-score-line { font-size: .85rem; color: var(--color-ink-soft); margin: 0 0 .5rem; }
.apero-points-pill { display: inline-block; background: var(--color-secondary); color: #fff; border-radius: var(--radius-sm); padding: .15rem .6rem; font-size: .78rem; font-weight: 600; }
.apero-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding: .6rem 1rem .1rem; }
.apero-actions button, .apero-actions a {
  background: none; border: none; font-size: .88rem; font-weight: 500; color: var(--color-ink-soft); cursor: pointer;
  display: flex; align-items: center; gap: .35rem; text-decoration: none; transition: color .15s ease;
}
.apero-actions button:hover, .apero-actions a:hover { color: var(--color-primary-dark); }
.apero-actions button.active { color: var(--color-primary-dark); }
.apero-actions button.active .icon { animation: react-pop .38s var(--ease-out); }
@keyframes react-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .apero-actions button.active .icon { animation: none; } }
.apero-actions button:disabled { opacity: .7; cursor: default; }

/* Ranking */
.ranking-tabs { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: 1rem; padding-bottom: .25rem; }
.ranking-tabs a { flex: none; padding: .45rem .95rem; border-radius: 999px; background: var(--color-bg-alt); border: 1px solid var(--color-border); font-weight: 500; font-size: .85rem; color: var(--color-ink-soft); transition: background .15s ease, color .15s ease, border-color .15s ease; }
.ranking-tabs a.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: var(--shadow-primary); }
table.ranking-table { width: 100%; border-collapse: collapse; background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); overflow: hidden; }
table.ranking-table th, table.ranking-table td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--color-border); font-size: .92rem; }
table.ranking-table tr:last-child td { border-bottom: none; }
table.ranking-table tbody tr { transition: background .12s ease; }
@media (hover: hover) { table.ranking-table tbody tr:hover { background: var(--color-primary-light); } }
table.ranking-table th { color: var(--color-ink-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* Camera / capture */
.capture-stage { position: relative; width: 100%; max-width: 480px; margin: 0 auto; border-radius: var(--radius-lg); overflow: hidden; background: #000; aspect-ratio: 3/4; }
.capture-stage video, .capture-stage canvas, .capture-stage img { width: 100%; height: 100%; object-fit: cover; }
.capture-controls { display: flex; justify-content: center; gap: 1rem; margin-top: 1.25rem; }
.shutter-btn { width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 5px solid var(--color-primary); cursor: pointer; }
.shutter-btn:active { transform: scale(.93); }
.detected-item-row { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px dashed var(--color-border); font-size: .92rem; }
.counter { display: flex; align-items: center; gap: .75rem; }
.counter button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--color-border); background: #fff; font-size: 1.1rem; font-weight: 600; cursor: pointer; }
.counter .count { min-width: 1.5rem; text-align: center; font-weight: 700; }

/* Badges / divisions */
.badge-chip { display: inline-flex; flex-direction: column; align-items: center; width: 84px; text-align: center; font-size: .75rem; }
.badge-chip .crest { width: 52px; height: 52px; border-radius: 50%; background: var(--color-bg); border: 1px solid var(--color-border); box-shadow: var(--shadow-soft); display: flex; align-items: center; justify-content: center; color: var(--color-primary-dark); margin-bottom: .35rem; }

/* Alerts / notices */
.notice { border-radius: var(--radius-md); padding: 1rem; margin-bottom: 1rem; font-size: .9rem; }
.notice-info { background: #EAF3EE; color: #1F5138; }
.notice-warn { background: #FFF3DC; color: #7A5411; }
.notice-danger { background: #FBE7E4; color: var(--color-danger); }
.disclaimer { font-size: .78rem; color: var(--color-ink-soft); text-align: center; padding: 1rem 0; }

/* Admin */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: var(--color-ink); color: #fff; padding: 1.5rem 1rem; flex: none; }
.admin-sidebar a { display: block; color: #EADFD2; padding: .5rem .6rem; border-radius: 8px; font-size: .9rem; }
.admin-sidebar a.active, .admin-sidebar a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.admin-main { flex: 1; padding: 2rem; max-width: 1100px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-tile { background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); padding: 1rem; }
.stat-tile .value { font-size: 1.6rem; font-weight: 700; font-family: var(--font-display); color: var(--color-primary-dark); }
.stat-tile .label { font-size: .78rem; color: var(--color-ink-soft); }
@media (max-width: 760px) { .admin-shell { flex-direction: column; } .admin-sidebar { width: 100%; display: flex; overflow-x: auto; gap: .5rem; } .admin-main { padding: 1rem; } }

/* Footer */
.site-footer { border-top: 1px solid var(--color-border); padding: 2rem 0; margin-top: 3rem; color: var(--color-ink-soft); font-size: .85rem; }
.site-footer a { color: var(--color-ink-soft); margin-right: 1rem; }
.footer-linkgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; padding: 1.5rem 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); margin-bottom: 1rem; }
.footer-linkcol h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--color-ink); margin: 0 0 .6rem; }
.footer-linkcol a { display: block; margin: 0 0 .4rem; font-size: .82rem; }

/* Breadcrumb */
.breadcrumb { font-size: .8rem; color: var(--color-ink-soft); margin-bottom: 1rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0; }
.breadcrumb li:not(:last-child)::after { content: '›'; margin-left: .35rem; color: var(--color-ink-soft); }
.breadcrumb a { color: var(--color-ink-soft); }
.breadcrumb span[aria-current] { color: var(--color-ink); }

/* Editorial / thematic pages */
.editorial-content h2 { font-size: 1.15rem; margin-top: 2rem; }
.editorial-content ul { padding-left: 1.2rem; }
.editorial-content li { margin-bottom: .4rem; }
.city-link-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.city-link-grid a { background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; }

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: .5rem; } .justify-between { justify-content: space-between; }
.muted { color: var(--color-ink-soft); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
