:root {
  --bg-overlay: rgba(0, 0, 0, 0.45);
  --card-bg: rgba(
    255,
    255,
    255,
    0.5
  ); /* was 0.92; align with current glass look */
  --text: #111;
  --text-invert: #fff;
  --accent: #2b6cb0;
  --maxw: 1100px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--text);
}

.page {
  min-height: 100%;
  position: relative;
  /* Taustakuva siirretty ::before-elementtiin mobiiliongelman korjaamiseksi */
}

.page::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image:
    linear-gradient(var(--bg-overlay), var(--bg-overlay)),
    url("../img/background1.webp");
  background-size: cover;
  background-position: center;
  /* background-attachment: fixed; <- Ei tarvita enää, koska elementti on fixed */
}

.topbar {
  position: relative; /* Changed from sticky to relative */
  z-index: 10;
  background: #8b8b8b8e;
  backdrop-filter: blur(3px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.324);
  /* Removed transition and top:0 */
}

/* Removed .topbar.hidden block */

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand {
  color: var(--text-invert);
  text-decoration: none;
  font-size: 1.5rem;
  font-family: Impact, "Arial Narrow Bold", sans-serif;
  font-weight: 100;
  letter-spacing: 0.5px;
  color: #fff;
}

.nav,
.lang {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto; /* Push to right */
}

.nav a,
.lang a {
  color: var(--text-invert);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition:
    background 300ms ease,
    border-color 300ms ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.nav a[aria-current="page"] {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

.lang a {
  font-size: 0.92rem;
  opacity: 0.95;
  position: relative;
  border-color: rgba(255, 255, 255, 0.18);
  transition:
    background 300ms ease,
    border-color 300ms ease,
    opacity 300ms ease;

  /* base bg */
  background-size: 22px 22px;
  background-repeat: no-repeat;
  background-position: 8px center;
  padding-left: 34px; /* room for the icon */
}

.lang a:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  opacity: 1;
}

/* Pick icon based on target language link */
.lang a[href*="/fi/"] {
  background-image: url("/assets/img/fi.svg");
}
.lang a[href*="/ru/"] {
  background-image: url("/assets/img/ru.svg");
}
.lang a[href*="/en/"] {
  background-image: url("/assets/img/gb.svg");
}

/* Active language link - preserve the flag icon */
.lang a.active {
  border-color: rgba(255, 255, 255, 0.61);
}
.lang a.active[href*="/fi/"] {
  background-image: url("/assets/img/fi.svg");
  background-color: rgba(255, 255, 255, 0.1);
}
.lang a.active[href*="/ru/"] {
  background-image: url("/assets/img/ru.svg");
  background-color: rgba(255, 255, 255, 0.1);
}
.lang a.active[href*="/en/"] {
  background-image: url("/assets/img/gb.svg");
  background-color: rgba(255, 255, 255, 0.1);
}

.main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 16px 60px;
}

.panel {
  background-color: var(--card-bg); /* use variable; avoids "unused var" */
  backdrop-filter: blur(2px);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.hero {
  display: grid;
  gap: 12px;
}

.hero h1 {
  margin: 0;
}
.hero p {
  margin: 0;
  line-height: 1.55;
}

.grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Make base framing for all gallery containers the single source of truth */
.card,
.service-block {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  background: var(--card-bg);
  backdrop-filter: blur(5px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Keep .card for shaping/border only, avoid duplicating background/blur */
.card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Gallery (carousel) is always at the top */
.card .gallery,
.service-block .gallery {
  position: relative;
  height: auto;
  aspect-ratio: 1 / 1; /* square images everywhere */
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
  border-radius: 0; /* no inner radius, outer card handles it */
}

/* Track setup */
.gallery-track {
  height: 100%;
  display: flex;
  transform: translateX(0%);
  transition: transform 320ms ease;
  will-change: transform;
}

.gallery-slide {
  flex: 0 0 100%;
  height: 100%;
}

.gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-track {
    transition: none;
  }
}

/* Navigation arrows */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 22px;
  line-height: 34px;
  cursor: pointer;
  z-index: 2;
  user-select: none;
}

.gallery-nav.prev {
  left: 10px;
}
.gallery-nav.next {
  right: 10px;
}

.gallery-nav:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* NEW: Hover/Active for gallery arrows */
.gallery-nav:hover {
  background: rgba(0, 0, 0, 0.65);
  border-color: #fff;
  transform: translateY(-50%) scale(1.1);
  transition: all 200ms ease;
}
.gallery-nav:active {
  transform: translateY(-50%) scale(0.95);
  background: rgba(0, 0, 0, 0.8);
}

/* Service blocks: slightly smaller arrows */
.service-block .gallery-nav {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 30px;
}

/* Content area below carousel - inherits gray background from parent */
.card-body,
.service-block > h4 {
  padding: 12px;
  background: transparent; /* let parent gray show through */
}

/* Service blocks: title separator stays subtle on gray */
.service-block > h4 {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin: 0;
}

/* If service-block wraps .card, neutralize nested framing */
.service-block .card {
  border: 0;
  border-radius: 0;
  overflow: visible;
  display: block; /* reset flex to avoid double flex */
}

/* Force carousel to top even if markup has title first (using order) */
.service-block .card {
  order: -1;
}

/* Small spacing for lists */
.card-body ul,
.tabpanel ul {
  margin-top: 8px;
}

.card-body h4 {
  margin: 10px 0 6px;
  font-size: 0.95rem;
}

.amenities {
  margin: 0;
  padding-left: 18px;
}

.amenities li {
  margin: 2px 0;
}

.card h3 {
  margin: 0 0 6px;
}
.card p {
  margin: 0;
  line-height: 1.45;
}

.actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* NEW: News section on front page */
.news-box {
  margin-top: 20px;
  padding: 16px;
  background: rgba(43, 108, 176, 0.1); /* Light accent color bg */
  border: 1px solid rgba(43, 108, 176, 0.2);
  border-radius: 12px;
  display: none; /* Hidden by default, shown by JS if content exists */
}

.news-box h3 {
  margin: 0 0 8px 0;
  color: var(--accent);
  font-size: 1.1rem;
}

.news-box p,
.news-box div {
  margin: 0;
  line-height: 1.5;
  font-size: 0.95rem;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  /* NEW: transitions */
  transition:
    background 200ms ease,
    transform 100ms ease,
    box-shadow 200ms ease;
  border: 1px solid transparent;
}

/* NEW: Hover/Active for main buttons */
.button:hover {
  background: #1a4971; /* Darker shade of accent */
  box-shadow: 0 4px 12px rgba(43, 108, 176, 0.4);
  transform: translateY(-2px);
}
.button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(43, 108, 176, 0.3);
  background: #163a5a;
}

.muted {
  opacity: 0.8;
}

.footer {
  max-width: 100%;
  margin: 18px auto 0;
  padding: 14px 16px 22px;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.92rem;

  /* subtle gradient and rounded container */
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.12),
    rgba(0, 0, 0, 0.694)
  );
  /* center content and allow wrapping on small screens */
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* slightly emphasize site name in footer */
.footer span {
  font-weight: 700;
  margin-right: 6px;
}

/* ensure footer links inherit color and have even spacing */
.footer a {
  color: inherit;
  text-decoration: none;
  margin: 0 6px;
  transition:
    text-decoration 200ms ease,
    opacity 200ms ease;
}

.footer a:hover {
  text-decoration: underline;
  opacity: 0.95;
}

.tabs {
  margin-top: 18px;
}

.tablist {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.tab {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.5); /* Changed from #fff */
  backdrop-filter: blur(5px);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
  /* NEW: transitions */
  transition:
    background 200ms ease,
    transform 100ms ease,
    border-color 200ms ease;
}

/* NEW: Hover/Active for tabs */
.tab:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.tab:active {
  transform: translateY(1px);
  background: rgba(255, 255, 255, 0.6);
}

.tab[aria-selected="true"] {
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  /* Ensure selected tab stands out */
  background: #fff;
  color: var(--accent);
}

.tabpanel {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5); /* Changed from #fff */
  backdrop-filter: blur(5px);
  padding: 12px;
}

.tabpanel[hidden] {
  display: none !important;
}

.tabpanel h3,
.tabpanel h4 {
  margin-top: 0;
}

.breakfast-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  margin-top: 10px;
}

/* NEW: mobile nav toggle button */
.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-invert);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  transition:
    background 300ms ease,
    border-color 300ms ease;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
}

.nav-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* === Services gallery: make it look like room cards === */
.service-gallery {
  margin-top: 12px;
  display: grid;
  gap: 14px;
}

/* 2 columns already above 700px, 1 column on small */
@media (min-width: 701px) {
  .service-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 700px) {
  .service-gallery {
    grid-template-columns: 1fr;
  }
}

/* Turn each service block into a "card-like" tile */
.service-block {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.5); /* Changed from #8b8b8b */
  backdrop-filter: blur(5px);
  padding: 0; /* let inner spacing be like card-body */
}

.service-gallery h4 {
  margin: 0;
  font-size: 1rem;
}

/* Make title area look like card-body */
.service-block > h4 {
  padding: 12px;
}

/* If service gallery wraps the carousel in .card, neutralize extra framing */
.service-block .card {
  border: 0;
  border-radius: 0;
}

/* Square images for services only */
.service-block .gallery {
  height: auto; /* override current fixed heights */
  aspect-ratio: 1 / 1; /* square */
  background: #000;
}

.service-block .gallery-slide img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

/* Slightly smaller arrows for compact look */
.service-block .gallery-nav {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 30px;
}

/* Remove the now-redundant older breakpoint that forced 2 cols at 901px */
/* (keep it harmless if present, but override here explicitly) */
@media (min-width: 901px) {
  .service-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Layout: brand left, lang+toggle right, nav below (centered) */
  .topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "brand lang toggle"
      "nav   nav  nav";
    align-items: center;
    gap: 10px;
  }

  .brand {
    grid-area: brand;
  }

  .lang {
    grid-area: lang;
    justify-content: flex-end;
    margin-left: 0;
  }

  .nav-toggle {
    display: inline-flex;
    grid-area: toggle;
    align-items: center;
    justify-content: center;
  }

  .nav {
    grid-area: nav;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 0;

    /* Animation: hidden by default */
    display: flex;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition:
      max-height 400ms ease,
      opacity 300ms ease,
      padding 300ms ease;
    padding: 0;
  }

  .nav a {
    width: 100%;
    max-width: 180px;
    text-align: center;
    padding: 5px 14px;
    transition:
      background 300ms ease,
      border-color 300ms ease,
      transform 300ms ease;
    transform: translateY(-250px);
    opacity: 0;
  }

  body.nav-open .nav {
    max-height: 300px;
    opacity: 1;
    padding: 10px 0;
  }

  body.nav-open .nav a {
    transform: translateY(0);
    opacity: 1;
  }

  /* Staggered animation for each nav link */
  body.nav-open .nav a:nth-child(1) {
    transition-delay: 50ms;
  }
  body.nav-open .nav a:nth-child(2) {
    transition-delay: 100ms;
  }
  body.nav-open .nav a:nth-child(3) {
    transition-delay: 150ms;
  }
  body.nav-open .nav a:nth-child(4) {
    transition-delay: 200ms;
  }

  .nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
  }
}

@media (max-width: 700px) {
  .grid {
    grid-template-columns: 1fr;
  }

  /* services: keep blocks single-column */
  .service-gallery {
    grid-template-columns: 1fr;
  }

  /* FIX: previously added padding here can cause visual offset with overflow:hidden.
     Keep service tiles fully aligned with the grid. */
  .service-block {
    padding: 0;
  }

  /* ensure service galleries stay centered inside their tile */
  .service-block .gallery {
    width: 100%;
    margin: 0 auto;
  }

  /* remove old fixed heights in mobile for services (square stays square) */
  .service-block .gallery {
    height: auto;
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 600px) {
  .topbar-inner {
    padding: 12px 12px;
  }

  .nav a {
    padding: 10px 14px;
  }

  .lang a {
    padding: 6px 8px;
    padding-left: 30px;
    font-size: 0.85rem;
  }

  .lang {
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand lang"
      "toggle toggle"
      "nav nav";
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }

  .brand {
    grid-area: brand;
    font-size: 1.1rem;
  }

  .lang {
    grid-area: lang;
    justify-content: flex-end;
    gap: 4px;
  }

  .lang a {
    padding: 4px 6px;
    padding-left: 26px;
    font-size: 0.8rem;
    background-size: 18px 18px;
    background-position: 5px center;
  }

  .nav-toggle {
    grid-area: toggle;
    margin-left: 30%;
    width: 40%;
    justify-content: center;
    margin-top: 4px;
  }

  .nav {
    grid-area: nav;
  }

  .nav a {
    padding: 2px 0px;
    max-width: 140px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .nav,
  .nav a {
    transition: none;
  }
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  transition: color 200ms ease;
}

.social-link:hover {
  color: #1877f2; /* Facebook blue */
  text-decoration: underline;
}

.social-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  max-width: 20px;
  flex: 0 0 20px;
  display: block;
  transition: transform 200ms ease;
}

.social-link:hover .social-icon {
  transform: scale(1.2);
}

/* WhatsApp floating button */
.wa-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #25d366;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  text-decoration: none;
  transition:
    transform 200ms ease,
    box-shadow 200ms ease,
    background 200ms ease;
}

.wa-fab:hover {
  background: #1ebe5d;
  transform: scale(1.12);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
}

.wa-fab:active {
  transform: scale(0.96);
}

.wa-fab svg {
  width: 28px;
  height: 28px;
  display: block;
}

/* === News cards === */
#news-container {
  margin-top: 20px;
  display: none; /* shown by JS */
  flex-direction: column;
  gap: 14px;
}

.news-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: rgba(43, 108, 176, 0.08);
  border: 1px solid rgba(43, 108, 176, 0.18);
  border-radius: 14px;
  padding: 16px;
  flex-wrap: wrap;
}

.news-card-text {
  flex: 1 1 200px;
  min-width: 0;
}

.news-card-text h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 1.05rem;
}

.news-card-body {
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Image side: fixed square, right-aligned */
.news-card-img {
  flex: 0 0 160px;
  width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  order: 2; /* always on the right */
}

.news-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Gallery inside news card */
.news-card-img .gallery {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #000;
  border-radius: 0;
}

.news-card-img .gallery-track {
  height: 100%;
}

@media (max-width: 500px) {
  .news-card {
    flex-direction: column;
  }

  .news-card-img {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1 / 1;
    order: -1; /* image on top on mobile */
  }
}

/* Remove old .news-box styles (replaced by .news-card) */
.news-box {
  display: none !important;
}
