/* Merkazit — look and feel.
   Idea: a white bus with coloured stripes. Four colours borrowed from Israeli bus
   companies, one per area of the app, ink-black outlines, and scores shown like
   platform signs. Colours only: no company logos or names are used. */

:root {
  color-scheme: light dark;
  --paper: #F5F1E8;
  --card: #FFFFFF;
  --soft: #EFEADF;
  --ink: #15171B;
  --muted: #5F6570;
  --border: #15171B;
  --shadow-color: #15171B;
  --like: #D9304A;
  --danger: #C0321F;

  /* the four bus colours, and the text colour that reads well on each */
  --green: #027E3F;   /* Egged */
  --navy: #03296A;    /* Kavim, Superbus */
  --orange: #F58113;  /* Metropoline */
  --lime: #99CA3C;    /* Kavim */
  --on-green: #FFFFFF;
  --on-navy: #FFFFFF;
  --on-orange: #15171B;
  --on-lime: #15171B;

  /* score colours, worst to best */
  --band-0: #EE6A55;
  --band-1: #F4924A;
  --band-2: #F5BE1E;
  --band-3: #A6CF45;
  --band-4: #3DBB75;
  --badge-ink: #15171B;

  --radius: 14px;
  --shadow: 3px 3px 0 var(--shadow-color);
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --width: 560px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101216;
    --card: #1A1D23;
    --soft: #252931;
    --ink: #F4F0E7;
    --muted: #A0A6B1;
    --border: #4B515D;
    --shadow-color: #000000;
    --like: #FF6B81;
    --danger: #FF8A78;
    --navy: #2F5FC4; /* the real navy disappears on a dark background */
  }
}

/* section colours: feed green, leaderboard navy, rating orange, profile lime */
:root, #app { --accent: var(--green); --on-accent: var(--on-green); }
#app[data-section='board'] { --accent: var(--navy); --on-accent: var(--on-navy); }
#app[data-section='rate'] { --accent: var(--orange); --on-accent: var(--on-orange); }
#app[data-section='profile'] { --accent: var(--lime); --on-accent: var(--on-lime); }

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

#app {
  max-width: var(--width);
  margin-inline: auto;
  min-height: 100dvh;
}

/* ---------- frame ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 17px;
  background: var(--card);
  color: var(--ink);
}
/* the livery stripe: all four colours, with slanted joins */
.topbar::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 7px;
  background: linear-gradient(115deg,
    var(--green) 0 25%, var(--navy) 25% 50%, var(--orange) 50% 75%, var(--lime) 75% 100%);
}

.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 900; font-size: 26px; letter-spacing: -0.02em; line-height: 1;
}
.wordmark__mark { display: inline-flex; gap: 3px; transform: skewX(-14deg); }
.wordmark__mark i { width: 6px; height: 22px; border-radius: 2px; }
.wordmark__mark i:nth-child(1) { background: var(--green); }
.wordmark__mark i:nth-child(2) { background: var(--navy); }
.wordmark__mark i:nth-child(3) { background: var(--orange); }
.wordmark__mark i:nth-child(4) { background: var(--lime); }

.lang {
  padding: 6px 12px;
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--border);
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
}
.lang:hover { background: var(--ink); color: var(--card); }

/* shown while the app is loading, and if it fails to load */
.boot { padding: 48px 20px; color: var(--muted); text-align: center; }

.main { padding: 16px 16px 112px; }

.view { display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  max-width: var(--width); margin-inline: auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 2px solid var(--border);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px; font-weight: 500;
}
.tabbar__item .icon { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 999px; }
.tabbar__item.is-on { color: var(--ink); }
.tabbar__item--feed.is-on .icon { background: var(--green); color: var(--on-green); }
.tabbar__item--board.is-on .icon { background: var(--navy); color: var(--on-navy); }
.tabbar__item--profile.is-on .icon { background: var(--lime); color: var(--on-lime); }
/* the Rate button is always filled: it's the main thing to do */
.tabbar__item--rate .icon { background: var(--orange); color: var(--on-orange); }
.tabbar__item--rate.is-on .icon { box-shadow: 0 0 0 2px var(--ink); }

.icon { display: inline-grid; line-height: 0; }
.icon svg { width: 22px; height: 22px; }
[dir='rtl'] .icon--flip { transform: scaleX(-1); }

/* ---------- text ---------- */

.title { font-size: 28px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.title::after {
  content: ''; display: block;
  width: 46px; height: 6px; margin-top: 8px;
  background: var(--accent); border-radius: 2px;
  transform: skewX(-14deg);
}
.welcome .title::after { margin-inline: auto; }
.section-title { margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.note { color: var(--muted); font-size: 13.5px; }
.note--box { padding: 10px 12px; background: var(--soft); border-radius: 10px; color: var(--ink); }

.back { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; color: var(--muted); font-weight: 500; }
.back:hover { color: var(--ink); }

.link { padding: 0; background: none; border: 0; color: var(--muted); font-size: 13px; text-decoration: underline; }
.link:hover { color: var(--ink); }
.link--center { align-self: center; margin-top: 12px; }

/* ---------- surfaces ---------- */

.card {
  padding: 14px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 28px 16px;
  border: 2px dashed var(--border); border-radius: var(--radius);
  color: var(--muted); text-align: center;
}

/* ---------- buttons and inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow);
  font-weight: 700;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow-color); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn--primary { background: var(--accent); color: var(--on-accent); border-color: #15171B; }
/* Google's button keeps Google's own look, per its sign-in guidelines */
.btn--google { gap: 10px; background: #FFFFFF; color: #1F1F1F; border-color: #747775; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--muted); opacity: 0.4; }
.btn--danger { color: var(--danger); }
.btn--block { width: 100%; }
.btn--icon { min-width: 48px; padding-inline: 10px; }

.round {
  flex: none; display: grid; place-items: center;
  width: 44px; height: 44px;
  background: var(--card); border: 2px solid var(--border); border-radius: 50%;
}

.input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--border); border-radius: 12px;
  /* Hebrew and English typed in the same box each read in their own direction. */
  unicode-bidi: plaintext;
}
.input::placeholder { color: var(--muted); }
.input--lg { min-height: 54px; font-size: 18px; }
textarea.input { resize: vertical; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; font-weight: 700; }
.field__hint { font-weight: 400; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 12px; }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; gap: 4px;
  background: var(--soft);
  border-radius: 12px;
}
.seg__item {
  padding: 8px 10px;
  background: transparent; border: 0; border-radius: 9px;
  color: var(--muted); font-weight: 700; text-align: center;
}
.seg__item.is-on { background: var(--card); color: var(--ink); box-shadow: 0 0 0 2px var(--border); }

/* ---------- score sign ---------- */

.score {
  flex: none; display: inline-grid; place-items: center;
  min-width: 48px; height: 40px; padding: 0 8px;
  background: var(--soft); color: var(--muted);
  border: 2px solid #15171B; border-radius: 10px;
  font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1;
  direction: ltr;
}
.score--xl { min-width: 96px; height: 84px; border-radius: 16px; font-size: 44px; box-shadow: var(--shadow); }
[data-band='0'] { background: var(--band-0); color: var(--badge-ink); }
[data-band='1'] { background: var(--band-1); color: var(--badge-ink); }
[data-band='2'] { background: var(--band-2); color: var(--badge-ink); }
[data-band='3'] { background: var(--band-3); color: var(--badge-ink); }
[data-band='4'] { background: var(--band-4); color: var(--badge-ink); }

/* ---------- avatar ---------- */

.avatar {
  flex: none; display: grid; place-items: center;
  width: var(--size); height: var(--size);
  border: 2px solid #15171B; border-radius: 50%;
  font-weight: 700; font-size: calc(var(--size) * 0.42); line-height: 1;
}
.avatar--0 { background: var(--green); color: var(--on-green); }
.avatar--1 { background: var(--navy); color: var(--on-navy); }
.avatar--2 { background: var(--orange); color: var(--on-orange); }
.avatar--3 { background: var(--lime); color: var(--on-lime); }

/* ---------- review ---------- */

.review { display: flex; flex-direction: column; gap: 10px; }
.review__head { display: flex; align-items: center; gap: 10px; }
.review__who { flex: 1; min-width: 0; }
.review__name { font-weight: 700; }
.review__meta { color: var(--muted); font-size: 13.5px; }
.review__meta a:hover, .review__name:hover { text-decoration: underline; }
.review__text { overflow-wrap: anywhere; white-space: pre-wrap; text-align: start; }
.review__foot { display: flex; gap: 6px; margin: -4px -8px -6px; }

.act {
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 44px; min-height: 40px; padding: 0 8px;
  background: none; border: 0; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums;
}
button.act:hover, a.act:hover { background: var(--soft); color: var(--ink); }
.act--like.is-on { color: var(--like); }
.act--like.is-on svg { fill: currentColor; }
.act--more { margin-inline-start: auto; justify-content: center; }

.photos { display: grid; gap: 6px; }
.photos--2 { grid-template-columns: 1fr 1fr; }
.photos--3 { grid-template-columns: 1fr 1fr 1fr; }
.photos__item { padding: 0; background: var(--soft); border: 2px solid var(--border); border-radius: 10px; overflow: hidden; }
.photos__item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photos--1 .photos__item img { aspect-ratio: 16 / 10; }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.88);
}
.lightbox img { max-height: 90dvh; border-radius: 8px; }
.lightbox__close {
  position: absolute; top: 12px; inset-inline-end: 12px;
  display: grid; place-items: center; width: 44px; height: 44px;
  background: #fff; color: #15171B; border: 0; border-radius: 50%;
}

/* ---------- feed ---------- */

.teaser {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--radius);
}
.teaser__label { font-size: 12.5px; font-weight: 500; opacity: 0.75; }
.teaser__name { font-size: 20px; font-weight: 900; line-height: 1.2; }

/* ---------- leaderboard ---------- */

.board { display: flex; flex-direction: column; gap: 8px; }
.board__row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 2px solid var(--border); border-radius: 12px;
}
.board__row:hover { box-shadow: var(--shadow); }
.board__rank {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  color: var(--muted); font-weight: 900; font-variant-numeric: tabular-nums;
}
.board__rank.is-top { background: var(--accent); color: var(--on-accent); border: 2px solid #15171B; }
.board__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.board__name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.board__sub { color: var(--muted); font-size: 13px; }

/* ---------- station ---------- */

.hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hero__text { min-width: 0; }
.hero__name { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }
.hero__sub { margin-top: 2px; font-weight: 500; }
.hero__rank { margin-top: 8px; color: var(--muted); font-size: 14px; }

/* ---------- rating form ---------- */

.scorepick { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.scorepick .field__label { align-self: flex-start; }
.scorepick__num {
  display: grid; place-items: center;
  min-width: 132px; height: 100px; padding: 0 12px;
  border: 2px solid #15171B; border-radius: 18px; box-shadow: var(--shadow);
  font-size: 64px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1;
  direction: ltr;
}
.scorepick__label { min-height: 1.5em; font-weight: 700; }
.scorepick__row { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 4px; }
.scorepick__range { flex: 1; min-width: 0; height: 44px; accent-color: var(--ink); }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs__item { position: relative; border: 2px solid var(--border); border-radius: 10px; overflow: hidden; }
.thumbs__item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumbs__remove {
  position: absolute; top: 4px; inset-inline-end: 4px;
  display: grid; place-items: center; width: 32px; height: 32px;
  background: #fff; color: #15171B; border: 2px solid #15171B; border-radius: 50%;
}
.thumbs__remove svg { width: 16px; height: 16px; }
.thumbs__add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  aspect-ratio: 1;
  border: 2px dashed var(--border); border-radius: 10px;
  color: var(--muted); font-size: 13px; font-weight: 500; text-align: center; cursor: pointer;
}
.thumbs__add:hover { color: var(--ink); background: var(--soft); }
.thumbs__add:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- comments ---------- */

.comments { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.comment { display: flex; gap: 10px; }
.comment__body { flex: 1; min-width: 0; }
.comment__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.comment__text { overflow-wrap: anywhere; white-space: pre-wrap; text-align: start; }
.comment-form { display: flex; gap: 8px; }
.comment-form .input { flex: 1; min-width: 0; }

/* ---------- profile ---------- */

.profile { display: flex; flex-direction: column; gap: 14px; }
.profile__top { display: flex; align-items: center; gap: 14px; }
.profile__name { font-size: 24px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.profile__bio { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; text-align: start; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 0; border-block: 1px solid var(--soft); text-align: center; }
.stat__n { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat__label { color: var(--muted); font-size: 12px; }

/* ---------- welcome ---------- */

.welcome { padding-top: 24px; text-align: center; }
.welcome__sign {
  align-self: center; display: grid; place-items: center;
  width: 120px; height: 92px;
  background: var(--band-4); color: var(--badge-ink);
  border: 2px solid #15171B; border-radius: 18px; box-shadow: var(--shadow);
  font-size: 52px; font-weight: 900; line-height: 1;
  transform: rotate(-4deg);
}
.welcome__body { color: var(--muted); }
.welcome .input { text-align: center; }

/* ---------- pop-up panels (menus, the report form) ---------- */

dialog.sheet {
  width: min(100%, var(--width)); max-width: none; max-height: 90dvh;
  margin: auto auto 0; overflow: auto;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  background: var(--card); color: var(--ink);
  border: 2px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0;
}
dialog.sheet[open] { display: flex; flex-direction: column; gap: 8px; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
.sheet__title { font-size: 20px; font-weight: 900; }
.sheet__item {
  min-height: 50px; padding: 10px 14px;
  background: var(--soft); color: var(--ink);
  border: 0; border-radius: 12px;
  font-weight: 700; text-align: start;
}
.sheet__item.is-danger { color: var(--danger); }
.sheet__cancel { background: transparent; color: var(--muted); text-align: center; }

.choice { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; cursor: pointer; }
.choice input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }

/* ---------- terms, privacy and other reading pages ---------- */

.legal { gap: 10px; }
.legal p, .legal li { text-align: start; }
.legal__h { margin-top: 10px; font-size: 18px; font-weight: 700; }
.legal__list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-inline-start: 22px; }
.legal__link { font-weight: 500; text-decoration: underline; }

/* ---------- account options, blocked people, moderation ---------- */

.options { display: flex; flex-direction: column; margin-top: 8px; padding: 4px 14px; }
.options__row {
  display: flex; align-items: center; gap: 10px;
  min-height: 50px; border-bottom: 1px solid var(--soft);
  font-weight: 500;
}
.options__row:last-child { border-bottom: 0; }
.options__row > span:first-child { flex: 1; }
.options__row .icon { color: var(--muted); }
.options__row.is-danger { color: var(--danger); }
.options__count {
  min-width: 26px; padding: 2px 8px;
  background: var(--danger); color: var(--card);
  border-radius: 999px; font-size: 13px; font-weight: 700; text-align: center;
}

.people { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.people__row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--card); border: 2px solid var(--border); border-radius: 12px;
}
.people__name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }

.report { display: flex; flex-direction: column; gap: 8px; }
.report__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.report__quote {
  margin: 0; padding: 10px 12px;
  background: var(--soft); border-radius: 10px;
  overflow-wrap: anywhere; white-space: pre-wrap; text-align: start;
}

/* ---------- toast ---------- */

.toast {
  position: fixed; bottom: 96px; left: 50%; z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  background: var(--ink); color: var(--paper);
  border-radius: 12px; font-weight: 500;
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
