:root {
  color-scheme: light;
}

/* Windows/Edge/Opera lack flag glyphs in Segoe UI Emoji. */
@font-face {
  font-family: "Twemoji Country Flags";
  unicode-range: U+1F1E6-1F1FF;
  src: url("../fonts/TwemojiCountryFlags.woff2") format("woff2");
  font-display: swap;
}

/* Shared load/error states */
.load-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0.5rem 0;
}

.load-wrap p { display: none; }

.skel {
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(28, 43, 58, 0.06) 25%,
    rgba(28, 43, 58, 0.11) 50%,
    rgba(28, 43, 58, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: skel-sweep 1.4s ease-in-out infinite;
}

@keyframes skel-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Global header — all pages */
.site {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 16px 8px 16px 14px;
  background: rgba(245, 240, 232, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(217, 208, 195, 0.6);
  flex-shrink: 0;
  min-width: 0;
}

.site-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  flex: 1;
  text-decoration: none;
}

.site-brand img {
  display: block;
  height: 26px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.site-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.site .lang {
  position: relative;
  display: block;
}

.site .lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #E0D9CF;
  border-radius: 999px;
  background: #FFFCF7;
  color: #1C2B3A;
  font-family: "Twemoji Country Flags", Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-flag {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.lang-chev {
  font-size: 10px;
  opacity: 0.7;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  min-width: 168px;
  background: #FFFCF7;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(28, 43, 58, 0.16);
}

.site .lang-menu button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  color: #1C2B3A;
  font-family: "Twemoji Country Flags", Inter, system-ui, sans-serif;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}

.site .lang-menu .lang-flag {
  width: 22px;
  height: 22px;
}

.site .lang-menu button.is-on {
  color: #0A7A8C;
  font-weight: 600;
}

.menu-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: #1C2B3A;
  cursor: pointer;
  padding: 0;
}

.menu-btn svg { display: block; }

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 250ms ease-out, visibility 250ms ease-out;
}

.nav-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: 80%;
  max-width: 320px;
  background: #1C2B3A;
  color: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 250ms ease-out;
  padding: 8px 0 20px;
}

body.nav-open { overflow: hidden; }
body.nav-open .nav-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
body.nav-open .nav-panel {
  transform: translateX(0);
}

.nav-close {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  margin: 4px 8px 8px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.nav-panel nav {
  display: flex;
  flex-direction: column;
}

.nav-panel nav a {
  display: block;
  padding: 20px 24px;
  color: #fff;
  font-family: "Playfair Display", Palatino, Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-panel nav a.is-active {
  border-left: 3px solid #0A7A8C;
  padding-left: 21px;
  color: rgba(255, 255, 255, 0.9);
}

.nav-panel .ext {
  margin-top: auto;
  padding: 20px 24px 8px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}

/* Guest bottom tabs — one menu, hamburger hidden */
body.guest-nav .menu-btn {
  display: none;
}

body.guest-nav .app {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

.guest-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 4px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(245, 240, 232, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(217, 208, 195, 0.6);
  box-shadow:
    0 -1px 0 rgba(28, 43, 58, 0.06),
    0 -4px 16px rgba(28, 43, 58, 0.07),
    0 -12px 32px rgba(28, 43, 58, 0.04);
}

.guest-tabs a,
.guest-tabs button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 2px 4px;
  border: 0;
  background: none;
  color: rgba(28, 43, 58, 0.52);
  font-family: Inter, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}

.guest-tabs a.is-on,
.guest-tabs button.is-on {
  color: #0A7A8C;
}

.guest-tabs svg {
  display: block;
}

/* View Transitions */
@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: 220ms cubic-bezier(0.4, 0, 1, 1) both vt-fade-out;
}
::view-transition-new(root) {
  animation: 280ms cubic-bezier(0, 0, 0.2, 1) both vt-fade-in;
}

@keyframes vt-fade-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}
@keyframes vt-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Undvik transition på header och bottom bar — de ska stå still */
.site          { view-transition-name: site-header; }
.guest-tabs    { view-transition-name: guest-tabs; }

::view-transition-old(site-header),
::view-transition-new(site-header),
::view-transition-old(guest-tabs),
::view-transition-new(guest-tabs) {
  animation: none;
}

@media (min-width: 768px) {
  .site {
    padding: 0.9rem 1.5rem;
  }

  .site-brand img {
    height: 30px;
  }

  .guest-tabs {
    max-width: 780px;
  }
}

@media (min-width: 1024px) {
  .guest-tabs {
    max-width: 960px;
  }
}

.app-footer {
  text-align: center;
  padding: 12px 16px 20px;
  background: var(--porcelain, #F5F0E8);
}
.app-footer-branding {
  font-size: 0.7rem;
  color: #94a3b8;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.app-footer-branding strong {
  color: #64748b;
  font-weight: 600;
}
.app-footer-branding:hover strong { color: var(--navy, #1C2B3A); }
