/* ==========================================================================
   Legal pages (terms.html, privacy.html)
   Same navbar, colours and heading font as the main site; the document itself
   is kept plain: a dark panel with a thin gold outline, the text in Inter so it
   reads easily at length, and a simple footer.
   ========================================================================== */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Tokens (same values as css/styles.css) ---------- */
:root {
  --color-primary: #D6303B;
  --color-secondary: #dbb658;
  --color-accent: #CBB26A;
  --color-bg: #202024;
  --color-bg-alt: #131316;
  --color-surface: #1B1B1F;
  --color-text: #F2ECE4;
  --color-muted: #c0b5a4;

  --font-heading: 'Berkshire Swash', Georgia, serif;
  --font-body: 'Caveat Brush', 'Inter', Arial, sans-serif;
  --font-default: 'Inter', system-ui, Arial, sans-serif;

  --radius: 12px;
  --maxw: 1200px;
  --nav-h: 68px;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --press-scale: 0.95;
  --press-in: 0.08s ease-out;
  --press-out: 0.45s var(--ease-spring);
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  /* anchor jumps (contents links, #section-N) land below the sticky navbar */
  scroll-padding-top: calc(var(--nav-h) + 20px);
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --ease-spring: ease-out;
  }

  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-default);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* UI icons from svg/legal-icons.svg: 1em tall, each icon's own width */
.fa-ico {
  display: inline-block;
  height: 1em;
  width: auto;
  fill: currentColor;
  vertical-align: -0.125em;
  overflow: visible;
}

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

:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2000;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
  transform: translateY(-110%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ==========================================================================
   Navbar (as on the main site)
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.nav-inner {
  max-width: var(--maxw);
  height: var(--nav-h);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-primary);
  white-space: nowrap;
}

.logo-letter {
  display: inline-block;
}

/* the letters hop one after another on hover, like the main site's logo */
.logo.waving .logo-letter {
  animation: logo-wave 0.6s ease;
  animation-delay: calc(var(--n, 0) * 0.05s);
}

@keyframes logo-wave {

  0%,
  100% {
    transform: translateY(0);
  }

  35% {
    transform: translateY(-7px);
  }
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* language picker */
.lang-picker {
  position: relative;
}

.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--color-accent);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, scale var(--press-out);
}

.lang-current:hover {
  background: var(--color-accent);
  color: #fff;
}

.lang-current:active {
  scale: var(--press-scale);
  transition: scale var(--press-in);
}

.flag {
  width: 22px;
  height: 15px;
  display: block;
  flex: 0 0 auto;
  border-radius: 2px;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1200;
  display: none;
  min-width: 170px;
  padding: 4px;
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.lang-picker.open .lang-menu {
  display: block;
  transform-origin: top right;
  animation: menu-pop 0.35s var(--ease-spring);
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
  }
}

.lang-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.5rem 0.6rem;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
}

.lang-menu button:hover {
  background: var(--color-bg-alt);
}

/* gold, not red: red text on the dark menu is only 3.5:1 */
.lang-menu button[aria-current="true"] {
  color: var(--color-secondary);
}

/* red pill, like the main site's "Book Now" */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.4s var(--ease-spring), scale var(--press-out), opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  scale: var(--press-scale);
  transition: scale var(--press-in);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-back .fa-ico {
  font-size: 0.85em;
  transition: transform 0.4s var(--ease-spring);
}

.btn-back:hover .fa-ico {
  transform: translateX(-3px);
}

/* phones: just the arrow (the label stays for screen readers) */
@media (max-width: 479px) {
  .btn-back {
    padding: 0.55rem 0.8rem;
  }

  .btn-back .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
}

/* ==========================================================================
   Heading: the red title and the switch between the two documents
   ========================================================================== */
.legal-hero {
  padding: 3rem 1rem 2.25rem;
  text-align: center;
}

.legal-title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.15;
  color: var(--color-primary);
  text-wrap: balance;
}

/* <h1> takes focus from "back to top" (tabindex=-1); no ring of its own */
.legal-title:focus {
  outline: none;
}

/* switch between the two documents, styled like the package tabs */
.doc-switch {
  display: inline-flex;
  gap: 4px;
  margin-top: 1.5rem;
  padding: 4px;
  border: 1px solid rgba(203, 178, 106, 0.55);
  border-radius: 999px;
  background: var(--color-surface);
}

.doc-switch a {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--color-muted);
  transition: color 0.2s ease, background 0.2s ease, scale var(--press-out);
}

.doc-switch a:hover {
  color: var(--color-text);
}

.doc-switch a:active {
  scale: var(--press-scale);
  transition: scale var(--press-in);
}

.doc-switch a[aria-current="page"] {
  background: var(--color-primary);
  color: #fff;
}

/* ==========================================================================
   Layout: contents on the left, the document on the right
   ========================================================================== */
.legal-layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.5rem 1rem 6rem;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1025px) {
  .legal-layout {
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
  }
}

/* ---------- Contents ---------- */
.legal-toc {
  border: 1px solid rgba(203, 178, 106, 0.35);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.toc-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--color-secondary);
  cursor: pointer;
  list-style: none;
}

.toc-summary::-webkit-details-marker {
  display: none;
}

.toc-summary .fa-ico {
  font-size: 0.8em;
}

.toc-chevron {
  margin-left: auto;
  font-size: 0.75em;
  transition: transform 0.3s ease;
}

.legal-toc[open] .toc-chevron {
  transform: rotate(180deg);
}

.toc-list {
  list-style: none;
  padding: 0 0.6rem 0.6rem;
}

.toc-list a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  transition: color 0.2s ease, background 0.2s ease;
}

.toc-list a:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.04);
}

.toc-num {
  flex: 0 0 1.4rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  letter-spacing: 0;
  color: var(--color-primary);
  text-align: right;
}

/* the section being read (scroll-spy) */
.toc-list a[aria-current="true"] {
  color: var(--color-text);
  background: rgba(214, 48, 59, 0.14);
}

.toc-list a[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 3px;
  border-radius: 3px;
  background: var(--color-primary);
}

.toc-print {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: calc(100% - 1.2rem);
  margin: 0 0.6rem 0.9rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, scale var(--press-out);
}

.toc-print:hover {
  background: var(--color-accent);
  color: #1b1b1f;
}

.toc-print:active {
  scale: var(--press-scale);
  transition: scale var(--press-in);
}

/* desktop: always open, sticky beside the letter (the script keeps it open) */
@media (min-width: 1025px) {
  .legal-toc {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
    max-height: calc(100vh - var(--nav-h) - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(203, 178, 106, 0.45) transparent;
  }

  .toc-summary {
    cursor: default;
    pointer-events: none;
  }

  .toc-chevron {
    display: none;
  }
}

/* ==========================================================================
   The document
   ========================================================================== */
.legal-doc {
  min-width: 0;
  padding: clamp(1.4rem, 4vw, 3rem);
  border: 1px solid rgba(203, 178, 106, 0.45);
  border-radius: var(--radius);
  background: var(--color-surface);
}

/* skip-link target (tabindex=-1); no ring of its own */
.legal-doc:focus {
  outline: none;
}

.legal-body .pp-lang {
  display: none;
}

html[data-lang="en"] .legal-body .pp-lang-en,
html[data-lang="es"] .legal-body .pp-lang-es,
html[data-lang="ca"] .legal-body .pp-lang-ca,
html[data-lang="cz"] .legal-body .pp-lang-cz {
  display: block;
}

.legal-loading {
  color: var(--color-muted);
}

/* sections: gold title, a plain line above each one after the first */
.legal-body h2 {
  margin: 2.5rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
}

.legal-body .pp-lang>h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* headings take focus from the contents links; the scroll shows where you are */
.legal-body h2:focus {
  outline: none;
}

.legal-body h3 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

.legal-body p,
.legal-body ul {
  max-width: 72ch;
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--color-muted);
}

.legal-body p {
  margin: 0 0 0.85rem;
}

.legal-body ul {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.legal-body li {
  margin-bottom: 0.35rem;
  padding-left: 0.2rem;
}

.legal-body li::marker {
  color: var(--color-accent);
}

.legal-body strong {
  color: var(--color-text);
}

/* email addresses and web addresses in the text become links (legal.js) */
.legal-body a {
  color: var(--color-secondary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.legal-body a:hover {
  text-decoration-thickness: 2px;
}

/* ==========================================================================
   Back to top (styled like the main site's video button)
   ========================================================================== */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 995;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  color: #1b1b1f;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.4s var(--ease-spring), opacity 0.25s ease, visibility 0.25s, background 0.2s ease, scale var(--press-out);
}

.to-top:hover {
  background: var(--color-secondary);
  transform: scale(1.08);
}

/* out of the way while the footer is on screen, so it never covers its links
   (as the main site does with its video button) */
.to-top.over-footer {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(24px);
}

.to-top:active {
  scale: var(--press-scale);
  transition: scale var(--press-in);
}

.to-top[hidden] {
  display: grid;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px);
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.25s ease, visibility 0s 0.3s;
}

@media (max-width: 767px) {
  .to-top {
    right: 14px;
    bottom: 14px;
    width: 46px;
    height: 46px;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.legal-footer {
  border-top: 1px solid rgba(203, 178, 106, 0.3);
  background: var(--color-bg-alt);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.legal-footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
  text-align: center;
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1rem;
}

.legal-footer-links a {
  color: var(--color-text);
  text-underline-offset: 3px;
}

.legal-footer-links a:hover,
.legal-footer-links a[aria-current="page"] {
  color: var(--color-secondary);
  text-decoration: underline;
}

.legal-footer-company,
.legal-footer-copy {
  line-height: 1.6;
}

.legal-footer-copy {
  margin-top: 0.35rem;
  opacity: 0.8;
}

/* ==========================================================================
   Reduced motion and print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

  .logo.waving .logo-letter,
  .lang-picker.open .lang-menu {
    animation: none;
  }

  .btn:hover,
  .to-top:hover {
    transform: none;
  }
}

/* printing (or "Save as PDF") gives just the document, in black on white */
@media print {

  .skip-link,
  .navbar,
  .doc-switch,
  .legal-toc,
  .to-top,
  .legal-footer {
    display: none !important;
  }

  body,
  .legal-hero,
  .legal-doc {
    background: #fff !important;
    color: #000;
  }

  .legal-hero {
    padding: 0 0 1rem;
    text-align: left;
  }

  .legal-title {
    color: #000;
  }

  .legal-layout {
    display: block;
    padding: 0;
  }

  .legal-doc {
    padding: 0;
    border: none;
  }

  .legal-body h2 {
    break-after: avoid;
    color: #000;
    border-color: #ccc;
  }

  .legal-body h3 {
    break-after: avoid;
    color: #000;
  }

  .legal-body p,
  .legal-body ul,
  .legal-body strong,
  .legal-body a {
    color: #000;
  }

}
