/* ============================================================
   Undița — stiluri
   Paletă pornită de la o hartă batimetrică: apă adâncă, prundiș,
   alamă de lingură. Un singur accent cald, restul disciplinat.
   ============================================================ */

:root {
  --deep:    #082930;   /* apă adâncă */
  --deep-2:  #0d3a43;
  --shelf:   #14545e;   /* prag, ape mici */
  --foam:    #eef2ef;   /* fundal deschis */
  --gravel:  #d7dcd6;   /* prundiș, linii */
  --ink:     #12211f;   /* text principal */
  --muted:   #5d6b68;
  --brass:   #c08a2e;   /* accent unic */
  --brass-d: #96690f;
  --reed:    #5c7d4a;   /* stare pozitivă */
  --alarm:   #a83e2c;

  --r-sm: 4px;
  --r-md: 10px;
  --r-lg: 20px;

  --shadow-lift: 0 12px 30px -18px rgba(8, 41, 48, .55);

  --f-display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --f-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--foam);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; }

p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--deep-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- butoane ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font: inherit; font-weight: 600;
  padding: .7rem 1.25rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--deep);
  color: var(--foam);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--deep-2); }
.btn--brass { background: var(--brass); color: #1a1206; }
.btn--brass:hover { background: var(--brass-d); color: var(--foam); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--gravel); }
.btn--ghost:hover { background: #fff; border-color: var(--deep); }
.btn--sm { padding: .4rem .8rem; font-size: .875rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ============================================================
   Antet
   ============================================================ */
.top {
  position: sticky; top: 0; z-index: 900;
  background: rgba(238, 242, 239, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gravel);
}
.top__in { display: flex; align-items: center; gap: 1.5rem; padding: .85rem 0; }
@media (max-width: 760px) {
  .top__in { gap: .75rem; }
}
.brand {
  font-family: var(--f-display); font-weight: 800; font-size: 1.35rem;
  letter-spacing: -.03em; color: var(--deep); text-decoration: none;
  display: inline-flex; align-items: center; gap: .5rem;
}
.brand svg { width: 26px; height: 26px; }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; }
.top nav a:hover { text-decoration: underline; }

/* Pe ecran îngust rămân doar sigla și un buton. Restul linkurilor se
   găsesc oricum în bara de jos a aplicației și în subsol. */
@media (max-width: 760px) {
  .top nav a:not(.btn) { display: none; }
  .top nav { gap: .5rem; }
  .brand { font-size: 1.15rem; }
}

/* ============================================================
   Hero: harta e eroul paginii
   ============================================================ */
.hero { position: relative; background: var(--deep); color: var(--foam); overflow: hidden; }
.hero__map { position: absolute; inset: 0; filter: saturate(.75); }
.hero__map::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(105deg, rgba(6,33,39,.97) 0%, rgba(6,33,39,.92) 46%, rgba(6,33,39,.42) 82%),
    linear-gradient(to bottom, rgba(6,33,39,.75) 0%, rgba(6,33,39,0) 30%);
}
/* Pe mobil textul stă peste toată lățimea hărții, deci acoperim aproape complet. */
@media (max-width: 760px) {
  .hero__map { filter: saturate(.5) brightness(.85); }
  .hero__map::after {
    background: linear-gradient(to bottom, rgba(6,33,39,.97) 0%, rgba(6,33,39,.93) 62%, rgba(6,33,39,.72) 100%);
  }
}
.hero__in {
  position: relative; z-index: 2;
  padding: clamp(4rem, 12vh, 8.5rem) 0 clamp(3rem, 8vh, 6rem);
  pointer-events: none;
}
.hero__in > * { pointer-events: auto; }
.hero h1 { color: #fff; max-width: 15ch; text-wrap: balance; }
.hero__lead { font-size: 1.15rem; max-width: 46ch; color: #d8e4e1; }
@media (max-width: 760px) {
  .hero__in { padding-top: 2.75rem; padding-bottom: 2.5rem; }
  .hero h1 { max-width: 100%; }
  .hero__lead { font-size: 1.02rem; }
  .hero__cta { margin-top: 1.5rem; }
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
  .tally { gap: 1.25rem 2rem; margin-top: 2.25rem; }
  .tally div { font-size: .85rem; }
  .tally b { font-size: 1.5rem; }
}
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.tally {
  display: flex; flex-wrap: wrap; gap: 2.5rem;
  margin-top: 3.5rem; padding-top: 1.5rem;
  border-top: 1px solid rgba(238,242,239,.22);
}
.tally div { color: #cfdcd9; }
.tally b {
  display: block; font-family: var(--f-display); font-weight: 700;
  font-size: 2rem; color: #fff; font-variant-numeric: tabular-nums;
}

/* ============================================================
   Secțiuni landing
   ============================================================ */
.band { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.band--paper { background: #fff; border-block: 1px solid var(--gravel); }

.lede { font-size: 1.15rem; color: var(--muted); max-width: 54ch; }

/* pașii — chiar sunt o secvență, deci merită numerotare */
.steps { counter-reset: step; display: grid; gap: 2rem; margin-top: 2.5rem; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 3rem; } }
.step { counter-increment: step; padding-top: 1rem; border-top: 2px solid var(--deep); }
.step::before {
  content: counter(step);
  font-family: var(--f-display); font-weight: 700; font-size: .95rem;
  color: var(--brass-d);
}
.step h3 { margin-top: .35rem; }
.step p { color: var(--muted); margin: 0; }

/* grila de specii */
.species-grid {
  display: grid; gap: .5rem; margin-top: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.species-chip {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  padding: .6rem .8rem; background: var(--foam);
  border: 1px solid var(--gravel); border-radius: var(--r-sm);
  font-size: .9rem;
}
.species-chip i { font-style: italic; color: var(--muted); font-size: .78rem; }
.species-chip b { font-weight: 600; }

/* clasament pe landing */
.rank { border-top: 1px solid var(--gravel); margin-top: 2rem; }
.rank__row {
  display: grid; grid-template-columns: 2.2rem 56px 1fr auto;
  gap: 1rem; align-items: center;
  padding: .75rem 0; border-bottom: 1px solid var(--gravel);
}
.rank__pos { font-family: var(--f-display); font-size: 1.1rem; color: var(--muted); }
.rank__row:nth-child(1) .rank__pos { color: var(--brass-d); }
.rank__thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); background: var(--gravel); }
.rank__kg { font-family: var(--f-display); font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ============================================================
   Aplicație
   ============================================================ */
.app { display: grid; grid-template-rows: auto 1fr; min-height: 100dvh; }
.view { display: none; }
.view.is-on { display: block; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 950;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--gravel);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  border: 0; background: none; font: inherit; font-size: .72rem; font-weight: 600;
  color: var(--muted); padding: .55rem 0 .45rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
}
.tabbar button svg { width: 22px; height: 22px; stroke-width: 1.7; }
.tabbar button[aria-selected="true"] { color: var(--deep); }
.tabbar button[aria-selected="true"] svg { stroke-width: 2.3; }
@media (min-width: 860px) {
  .tabbar { position: sticky; top: 0; bottom: auto; grid-template-columns: repeat(5, max-content);
            gap: .25rem; padding: .35rem .75rem; border-top: 0; border-bottom: 1px solid var(--gravel); }
  .tabbar button { flex-direction: row; font-size: .9rem; padding: .5rem .9rem; border-radius: 999px; }
  .tabbar button[aria-selected="true"] { background: var(--foam); }
}

/* ---------- hartă ---------- */
/* Înălțimea barei de taburi o măsoară JS-ul și o pune în --tab-h,
   fiindcă pe iPhone se adaugă și zona de siguranță de jos. */
#v-harta { background: var(--deep); }
#map { height: calc(100dvh - var(--tab-h, 64px)); width: 100%; background: var(--deep); }
@supports not (height: 100dvh) {
  #map { height: calc(100vh - var(--tab-h, 64px)); }
}

.map-tools {
  position: absolute; z-index: 500; top: .75rem; left: .75rem; right: .75rem;
  display: flex; gap: .5rem; flex-wrap: wrap; pointer-events: none;
}
/* Butoanele de zoom stau jos-stânga (vezi map.js), ca să nu intre peste filtre. */
.leaflet-bottom.leaflet-left { margin-bottom: .25rem; }
@media (max-width: 560px) {
  .map-tools { gap: .35rem; top: .5rem; left: .5rem; right: .5rem; }
  .map-chip { padding: .3rem .6rem; font-size: .8rem; }
  .map-chip select { max-width: 42vw; }
}
.map-tools > * { pointer-events: auto; }
.map-chip {
  background: rgba(255,255,255,.95); border: 1px solid var(--gravel);
  border-radius: 999px; padding: .35rem .75rem; font-size: .85rem; font-weight: 600;
  box-shadow: var(--shadow-lift); cursor: pointer;
}
.map-chip select { border: 0; background: none; font: inherit; font-weight: 600; }

/* pinuri-poză, ca într-o galerie pe hartă */
.photo-pin {
  width: 46px; height: 46px; border-radius: 12px;
  border: 2.5px solid #fff; background: var(--shelf) center/cover no-repeat;
  box-shadow: 0 3px 12px rgba(0,0,0,.4);
  position: relative; transition: transform .12s ease;
}
.photo-pin:hover { transform: scale(1.12); z-index: 600; }
.photo-pin--big { width: 66px; height: 66px; border-radius: 16px; }
.photo-pin__n {
  position: absolute; top: -7px; right: -7px;
  min-width: 21px; height: 21px; padding: 0 5px;
  background: var(--brass); color: #1a1206;
  border-radius: 999px; border: 2px solid #fff;
  font: 700 11px/17px var(--f-body); text-align: center;
  font-variant-numeric: tabular-nums;
}
.photo-pin__tail {
  position: absolute; bottom: -6px; left: 50%; width: 8px; height: 8px;
  background: #fff; transform: translateX(-50%) rotate(45deg);
}

.leaflet-popup-content-wrapper { border-radius: var(--r-md); }
.leaflet-popup-content { margin: 0; width: 230px !important; }
.pop img { width: 100%; height: 150px; object-fit: cover; border-radius: var(--r-md) var(--r-md) 0 0; }
.pop__b { padding: .6rem .75rem .75rem; }
.pop__b b { display: block; font-family: var(--f-display); font-size: 1rem; }

/* ---------- flux ---------- */
.feed { width: min(620px, 100% - 1.5rem); margin: 1rem auto 5rem; }
.card {
  background: #fff; border: 1px solid var(--gravel);
  border-radius: var(--r-md); overflow: hidden; margin-bottom: 1.25rem;
}
.card__head { display: flex; align-items: center; gap: .7rem; padding: .8rem .9rem; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto;
  background: var(--shelf); color: #fff; display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: .95rem;
}
.card__who { line-height: 1.25; }
.card__who b { font-weight: 600; }
.card__who span { display: block; font-size: .8rem; color: var(--muted); }
.card__photo { aspect-ratio: 4/3; object-fit: cover; width: 100%; background: var(--gravel); }
.card__body { padding: .85rem .9rem 1rem; }

.facts { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.fact {
  font-size: .8rem; font-weight: 600; padding: .2rem .6rem;
  border: 1px solid var(--gravel); border-radius: 999px; background: var(--foam);
}
.fact--kg { background: var(--deep); color: var(--foam); border-color: var(--deep); }
.fact--rel { background: #eaf1e4; border-color: #cfdfc2; color: #3d5730; }
.fact--inat { background: #fdf3e0; border-color: #eddcb8; color: #7a5a12; }

.acts { display: flex; gap: .35rem; align-items: center; border-top: 1px solid var(--gravel); padding-top: .6rem; }
.act {
  border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--muted); cursor: pointer; padding: .35rem .55rem; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; gap: .35rem;
}
.act:hover { background: var(--foam); color: var(--ink); }
.act[data-on="1"] { color: var(--alarm); }
.attrib { font-size: .74rem; color: var(--muted); margin-top: .6rem; }

/* ---------- formulare ---------- */
.form { width: min(620px, 100% - 1.5rem); margin: 1.5rem auto 5rem; }
.field { margin-bottom: 1.1rem; }
.field > label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.hint { font-size: .82rem; color: var(--muted); margin: .3rem 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: .65rem .8rem;
  border: 1.5px solid var(--gravel); border-radius: var(--r-sm);
  background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--deep); outline: none; box-shadow: 0 0 0 3px rgba(20,84,94,.15); }
.row2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }

.err { color: var(--alarm); font-size: .85rem; margin-top: .3rem; }
.notice {
  padding: .75rem .9rem; border-radius: var(--r-sm); font-size: .92rem;
  border: 1px solid var(--gravel); background: #fff; margin-bottom: 1rem;
}
.notice--bad  { border-color: #e3bdb4; background: #fdf1ee; color: #6f2417; }
.notice--good { border-color: #cfdfc2; background: #f0f6ea; color: #3d5730; }

.dropzone {
  border: 2px dashed var(--gravel); border-radius: var(--r-md);
  padding: 1.5rem; text-align: center; background: #fff; cursor: pointer;
}
.dropzone.is-over { border-color: var(--brass); background: #fffaf0; }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--r-sm); }

.pickmap { height: 240px; border-radius: var(--r-md); border: 1px solid var(--gravel); }

/* ---------- clasamente ---------- */
.board { width: min(760px, 100% - 1.5rem); margin: 1.25rem auto 5rem; }
.segmented { display: flex; gap: .25rem; background: var(--gravel); padding: .2rem; border-radius: 999px; }
.segmented button {
  flex: 1; border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 600;
  padding: .45rem; border-radius: 999px; cursor: pointer; color: var(--muted);
}
.segmented button[aria-selected="true"] { background: #fff; color: var(--ink); }

table.tbl { width: 100%; border-collapse: collapse; margin-top: 1.25rem; }
.tbl th {
  text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted);
  padding-bottom: .4rem; border-bottom: 1.5px solid var(--deep);
}
.tbl td { padding: .65rem .4rem; border-bottom: 1px solid var(--gravel); font-size: .93rem; }
.tbl td:last-child, .tbl th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- profil ---------- */
.profile { width: min(760px, 100% - 1.5rem); margin: 1.5rem auto 5rem; }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge {
  border: 1px solid var(--gravel); border-radius: var(--r-md); padding: .5rem .75rem;
  background: #fff; font-size: .85rem; font-weight: 600;
}
.badge span { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; }

/* ---------- modal ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(8,41,48,.55); padding: 1rem;
}
.modal__box {
  background: var(--foam); border-radius: var(--r-lg); padding: 1.25rem;
  width: min(560px, 100%); max-height: 90dvh; overflow: auto;
}
.modal__box .card { box-shadow: none; }

/* ---------- stări goale ---------- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h3 { color: var(--ink); }

/* ---------- subsol ---------- */
.foot { background: var(--deep); color: #b9cac7; padding: 3rem 0 2rem; font-size: .9rem; }
.foot a { color: var(--foam); }
.foot__cols { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.foot h4 { color: #fff; font-size: .95rem; margin-bottom: .6rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: .35rem; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
