@font-face {
  font-family: 'Frutiger';
  src: url('fonts/Frutiger.ttf') format('truetype');
  font-weight: 400;
}

@font-face {
  font-family: 'Frutiger';
  src: url('fonts/Frutiger_bold.ttf') format('truetype');
  font-weight: 700;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }

@media (display-mode: standalone) {
  * { scrollbar-width: none; }
  *::-webkit-scrollbar { display: none; }
}

html { height: 100%; overflow-y: auto; }
body { min-height: 100%; overflow: visible; }

:root {
  --amber: #FAA801;
  --black: #0e0e0e;
  --bg:    #342519;
}

body {
  background: var(--bg);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  font-family: 'Frutiger', sans-serif;
  padding-top: var(--top-bar-height, 0px);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--bg);
  padding: calc(16px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) 16px calc(20px + env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-size: clamp(14px, 4vw, 22px);
  letter-spacing: 2px;
  transition: box-shadow 0.3s ease;
}

#top-bar.scrolled {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

html:has(#menu.open) {
  overflow: hidden;
}

body:has(#menu.open) #top-bar {
  background: transparent;
  box-shadow: none;
}


#weather {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(13px, 3.5vw, 18px);
  opacity: 0.9;
}

#weather-temp {
  font-weight: 700;
  letter-spacing: 0;
}

#weather-icon {
  font-size: clamp(14px, 4vw, 20px);
}


.metar-copy-btn {
  margin-left: 6px;
  cursor: pointer;
  opacity: 0.5;
}

#menu-btn {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 8px 16px 8px 0;
  margin: -8px 0;
  position: relative;
}

#menu-btn i {
  display: block;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

#menu-btn i.fa-xmark {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%) rotate(-90deg);
  opacity: 0;
}

#menu-btn.open i.fa-bars {
  opacity: 0;
  transform: rotate(90deg);
}

#menu-btn.open i.fa-xmark {
  opacity: 1;
  transform: translateY(-50%) rotate(0deg);
}

#menu {
  position: fixed;
  inset: 0;
  background: rgba(52, 37, 25, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 200;
}

#menu.open {
  opacity: 1;
  pointer-events: auto;
}

#menu nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 5vh, 40px);
}

#menu a {
  color: #fff;
  text-decoration: none;
  font-size: clamp(14px, 4vw, 22px);
  letter-spacing: 3px;
  transition: color 0.3s ease;
  text-transform: uppercase;
}

#cache-reset-btn {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.3);
  font-size: clamp(14px, 4vw, 20px);
  padding: 8px;
}

#lang-toggle {
  font-size: clamp(11px, 3vw, 16px);
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.3);
}

#lang-toggle [data-lang] {
  cursor: pointer;
  color: rgba(255, 255, 255, 0.3);
}

#lang-toggle [data-lang].active {
  color: var(--amber);
}

#list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg);
}

.status {
  text-align: center;
  padding: 40px;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(245,196,0,0.2);
}

.board-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slide-in 0.3s ease both;
}

.board-spotter {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(clamp(32px, 8vw, 44px) + 40px);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: clamp(14px, 3vh, 32px) 20px;
  justify-content: flex-start;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 0;
  container-type: size;
}

@container (max-height: 110px) {
  .board-wiki { display: none; }
}

.board-spotter a {
  text-decoration: none;
  width: clamp(32px, 8vw, 44px);
  height: clamp(32px, 8vw, 44px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-spotter-bubble {
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  border-radius: 999px;
  padding: 0;
}

.board-spotter-bubble i {
  font-size: clamp(18px, 4.5vw, 24px);
  color: var(--bg);
}

.board-wiki svg {
  width: clamp(18px, 4.5vw, 24px);
  height: clamp(18px, 4.5vw, 24px);
  fill: var(--bg);
  transform: rotate(-45deg);
  display: block;
}

.board-wrapper.swiped .board-spotter {
  transform: translateX(0);
}

.board {
  background: #FFC300;
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(14px, 3vh, 32px) clamp(16px, 5vw, 40px);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  z-index: 1;
}

.board-wrapper.swiped .board {
  transform: translateX(calc(clamp(32px, 8vw, 44px) + 40px));
}

.board::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at center, transparent 40%, rgba(255,140,0,0.35) 100%);
  pointer-events: none;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.board-name {
  font-size: clamp(24px, 8vw, 64px);
  font-weight: 700;
  color: var(--black);
  -webkit-text-stroke: 2px var(--black);
  letter-spacing: 2px;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: clamp(48px, 14vh, 110px);
  display: flex;
  align-items: center;
}

.board-icon {
  width: clamp(48px, 14vh, 110px);
  height: clamp(48px, 14vh, 110px);
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: clamp(12px, 3vw, 24px);
  color: var(--black);
}

.board-icon img {
  width: 55%;
  height: 55%;
  pointer-events: none;
}

#nav-arrows {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  position: relative;
  color: #fff;
  font-size: clamp(14px, 4vw, 22px);
  letter-spacing: 2px;
}

#nav-arrows #sync-time {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  transition: color 0.2s ease;
}

#nav-arrows #sync-time.history {
  color: var(--amber);
}

#nav-prev, #nav-next {
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s ease;
  width: clamp(32px, 8vw, 44px);
  height: clamp(32px, 8vw, 44px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
}

#nav-prev svg, #nav-next svg {
  width: 55%;
  height: 55%;
  pointer-events: none;
}

#nav-prev svg {
  transform: scaleX(-1);
}

#nav-prev:disabled, #nav-next:disabled {
  opacity: 0.25;
  cursor: default;
}


footer {
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  letter-spacing: 2px;
  color: #fff;
  position: relative;
  min-height: 48px;
}


footer > :first-child { flex: 1; }
footer > :last-child { flex: 1; display: flex; justify-content: flex-end; }

footer a { color: inherit; text-decoration: none; transition: color 0.3s ease; }
footer i { vertical-align: 0.02em; }

@media (display-mode: standalone) {
  footer { display: none; }
  #nav-arrows { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (orientation: portrait) and (max-width: 600px) {
  .board-icon { width: clamp(40px, 12vw, 80px); height: clamp(40px, 12vw, 80px); }
  .board-name { font-size: clamp(22px, 7vw, 48px); height: clamp(40px, 12vw, 80px); }
  footer { display: none; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .board { padding: clamp(8px, 2vh, 16px) clamp(16px, 5vw, 40px); }
  .board-icon { width: clamp(32px, 10vh, 64px); height: clamp(32px, 10vh, 64px); }
  .board-name { font-size: clamp(18px, 4vw, 36px); height: clamp(32px, 10vh, 64px); }
  #top-bar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  #nav-arrows { padding-left: 0; padding-right: 0; }
  .board-spotter { padding-left: 0; }
  footer { padding: 6px 0; padding-bottom: calc(6px + env(safe-area-inset-bottom)); font-size: 10px; }
}

@media (hover: hover) {
  #menu nav a:hover {
    color: var(--amber);
  }
  footer a:hover {
    color: var(--amber);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
