/* sunfest.hu – mobil-first */

:root {
  --ink: #102a43;
  --ink-soft: #243b53;
  --sky: #e8f4fc;
  --sky-deep: #b6e0fe;
  --sun: #ff9f1c;
  --sun-hot: #ff6b35;
  --foam: #ffffff;
  --mist: rgba(16, 42, 67, 0.08);
  --ok: #2a9d8f;
  --danger: #e63946;
  --shadow: 0 18px 40px rgba(16, 42, 67, 0.12);
  --radius: 18px;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 10% -10%, #fff6e8 0%, transparent 55%),
    radial-gradient(90% 70% at 100% 0%, var(--sky-deep) 0%, transparent 50%),
    linear-gradient(180deg, var(--sky) 0%, #f7fbff 45%, #ffffff 100%);
  line-height: 1.45;
}

img,
video {
  max-width: 100%;
  display: block;
}

a {
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ——— Landing ——— */

.landing {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
}

.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem 1.25rem calc(1.5rem + var(--safe-bottom));
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 42, 67, 0.15) 0%, rgba(16, 42, 67, 0.55) 55%, rgba(16, 42, 67, 0.82) 100%),
    url("../img/hero.svg") center / cover no-repeat;
  animation: heroDrift 18s ease-in-out infinite alternate;
}

@keyframes heroDrift {
  from { transform: scale(1.05) translate3d(0, 0, 0); }
  to { transform: scale(1.12) translate3d(-2%, 1%, 0); }
}

.hero-content {
  position: relative;
  z-index: 1;
  color: var(--foam);
  max-width: 28rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.8rem, 12vw, 4.5rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  margin: 0 0 1rem;
  animation: brandIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand span {
  color: var(--sun);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.65rem;
  max-width: 18ch;
  animation: brandIn 0.9s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero p {
  margin: 0 0 1.5rem;
  opacity: 0.92;
  font-size: 1.05rem;
  max-width: 32ch;
  animation: brandIn 0.9s 0.16s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes brandIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: brandIn 0.9s 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.35rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--sun);
  color: var(--ink);
}

.btn-primary:hover {
  background: #ffb347;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.16);
  color: var(--foam);
  backdrop-filter: blur(8px);
}

.btn-ink {
  background: var(--ink);
  color: var(--foam);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--mist);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auth sheet */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(16, 42, 67, 0.45);
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.sheet.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-panel {
  width: min(100%, 420px);
  background: var(--foam);
  border-radius: 24px 24px 20px 20px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  animation: sheetUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-panel h2 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.sheet-panel .muted {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.field {
  margin-bottom: 0.85rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  border: 0;
  background: #f1f7fb;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 0 0 2px transparent;
}

.field input:focus {
  box-shadow: inset 0 0 0 2px var(--sky-deep);
}

.form-error {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
}

.sheet-actions {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.switch-auth {
  text-align: center;
  margin-top: 0.85rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.switch-auth button {
  background: none;
  border: 0;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ——— App shell ——— */

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(72px + var(--safe-bottom));
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1.1rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(232, 244, 252, 0.96), rgba(232, 244, 252, 0.75) 70%, transparent);
  backdrop-filter: blur(10px);
}

.app-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  margin: 0;
}

.app-brand span {
  color: var(--sun-hot);
}

.app-user {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 550;
}

.view {
  display: none;
  padding: 0.5rem 1.1rem 1.25rem;
  flex: 1;
}

.view.active {
  display: block;
  animation: viewIn 0.28s ease;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin: 0.4rem 0 0.35rem;
}

.lead {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
}

.perm-list {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.perm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--mist);
}

.perm-item strong {
  display: block;
  font-size: 1rem;
}

.perm-item span {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #dceef9;
  color: var(--ink-soft);
  white-space: nowrap;
}

.badge.on {
  background: rgba(42, 157, 143, 0.18);
  color: #1b6b62;
}

.badge.off {
  background: rgba(230, 57, 70, 0.12);
  color: var(--danger);
}

.friend-list {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 1.25rem;
}

.friend-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--mist);
  overflow: hidden;
  transition: background 0.15s ease, transform 0.15s ease;
}

.friend-row.selected {
  box-shadow: inset 0 0 0 2px var(--sun);
  background: #fff8ef;
}

.friend-select {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.95rem 0.75rem 0.95rem 1rem;
  text-align: left;
  border: 0;
  width: 100%;
  cursor: pointer;
  color: inherit;
  background: transparent;
  font: inherit;
}

.friend-select:active {
  transform: scale(0.99);
}

.friend-remove {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 0.85rem;
  cursor: pointer;
}

.friend-remove:hover {
  color: var(--danger);
}

.friend-row .name {
  font-weight: 700;
  font-size: 1.05rem;
}

.friend-row .meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.friend-row .live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c5d4e0;
  display: inline-block;
  margin-right: 0.35rem;
}

.friend-row .live-dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.2);
}

.empty-state {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--mist);
}

.mode-toggle button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
}

.mode-toggle button.active {
  background: var(--ink);
  color: var(--foam);
}

/* Nav bar */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  padding: 0.45rem 0.6rem calc(0.45rem + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 30px rgba(16, 42, 67, 0.08);
}

.tabbar button {
  border: 0;
  background: transparent;
  padding: 0.55rem 0.35rem;
  border-radius: 14px;
  font-weight: 650;
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.tabbar button.active {
  background: #edf6fc;
  color: var(--ink);
}

/* ——— Walk / Drive ——— */

.nav-stage {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: #0f1c2a;
  min-height: min(68dvh, 560px);
  box-shadow: var(--shadow);
}

#walkVideo {
  width: 100%;
  height: min(68dvh, 560px);
  object-fit: cover;
  background: #0f1c2a;
}

.walk-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(16, 42, 67, 0.15), transparent 30%, transparent 70%, rgba(16, 42, 67, 0.45));
}

.arrow-wrap {
  width: min(58vw, 220px);
  height: min(58vw, 220px);
  display: grid;
  place-items: center;
  /* A simítást a JS végzi – CSS transition ugrálást okozna */
  transition: none;
  will-change: transform;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.arrow-wrap svg {
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 1.1rem 1.15rem;
  color: var(--foam);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
}

.hud .target-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.hud .distance {
  font-size: 1.65rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  color: var(--sun);
}

.hud .hint {
  font-size: 0.85rem;
  opacity: 0.85;
}

#driveMap {
  width: 100%;
  height: min(68dvh, 560px);
}

.btn-follow-me {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 500;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(16, 42, 67, 0.18);
  cursor: pointer;
}

.sf-me-marker,
.sf-friend-marker {
  background: transparent !important;
  border: 0 !important;
}

.sf-me-dot {
  width: 18px;
  height: 18px;
  margin: 4px auto 0;
  border-radius: 50%;
  background: #ff9f1c;
  border: 3px solid #102a43;
  box-shadow: 0 0 0 6px rgba(255, 159, 28, 0.28);
}

.sf-me-label,
.sf-friend-label {
  margin-top: 2px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #102a43;
  text-shadow: 0 1px 0 #fff;
  white-space: nowrap;
}

.sf-friend-dot {
  width: 16px;
  height: 16px;
  margin: 4px auto 0;
  border-radius: 50%;
  background: #2a9d8f;
  border: 3px solid #102a43;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--foam);
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.92rem;
  max-width: min(92vw, 360px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: #c9d6e2;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.switch .slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--ok);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.result-box {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.result-box strong {
  color: var(--ink);
}

.stack {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 768px) {
  .hero {
    padding: 2.5rem;
  }

  .app,
  .view {
    max-width: 520px;
    margin-inline: auto;
    width: 100%;
  }

  .app-header,
  .tabbar {
    max-width: 520px;
    margin-inline: auto;
    left: 50%;
    right: auto;
    width: 100%;
    transform: translateX(-50%);
  }

  .app-header {
    transform: none;
    left: auto;
  }
}
