/* ==========================================================================
   Bermuuda / apartment "House Rules" pages — shared stylesheet
   Used by /rules/<ApartmentName>/index.html across all apartments.
   Single page per apartment: language content is fetched into #rules-content
   by ../rules.js — see that file for the switching behaviour.
   Mobile-first, no external fonts or assets, print-friendly.
   ========================================================================== */

:root {
  --ink: #23282f;
  --ink-soft: #565f6b;
  --paper: #faf8f4;
  --card: #ffffff;
  --line: #e7e1d6;
  --navy: #1c2b47;
  --navy-soft: #2f4265;
  --gold: #b8922f;
  --gold-soft: #f3e9d2;
  --wine: #9c3b2e;
  --wine-soft: #fbe4e0;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(28, 43, 71, 0.08);
  --max-width: 760px;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.page-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 56px;
}

/* -------------------- Header / brand (hero) -------------------- */

header.top {
  text-align: center;
  margin-top: 24px;
  padding: 44px 24px;
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--navy) 0%, var(--navy-soft) 100%);
  box-shadow: 0 10px 30px rgba(28, 43, 71, 0.22);
}

.brand {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 5.5vw, 2.5rem);
  font-weight: 700;
  color: #fdfaf3;
  letter-spacing: 0.01em;
}

.brand-tagline {
  margin: 10px 0 0;
  color: var(--gold-soft);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* -------------------- Decorative divider -------------------- */

.divider {
  position: relative;
  height: 1px;
  margin: 34px auto;
  width: 70%;
  background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent);
  opacity: 0.6;
}

.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--gold);
  border-radius: 1px;
}

/* -------------------- Welcome + language selector -------------------- */

.greeting {
  background: var(--card);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin: 32px 0;
}

.greeting p { margin: 0 0 12px; }
.greeting p:last-child { margin-bottom: 0; }
.greeting strong { color: var(--navy); }

.lang-select { margin: 40px 0; text-align: center; }

.lang-prompt {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.lang-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.lang-card:hover,
.lang-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(28, 43, 71, 0.14);
}

.lang-card.active {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.lang-card .flag {
  width: 40px;
  height: 30px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(28, 43, 71, 0.12);
  object-fit: cover;
}

.lang-card .lang-name {
  font-weight: 600;
  font-size: 0.95rem;
}

/* -------------------- Rules content (fetched fragment) -------------------- */

.rules-content {
  transition: opacity 0.15s ease;
  min-height: 120px;
}

.rules-content.fading { opacity: 0; }

.doc-title {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  font-weight: 700;
  color: var(--navy);
}

.doc-subtitle {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.intro {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 30px;
}

.intro p { margin: 0 0 12px; }
.intro p:last-child { margin-bottom: 0; }

/* -------------------- Table of contents -------------------- */

.toc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 8px;
  margin-bottom: 30px;
}

.toc-title {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--navy);
  font-size: 1.05rem;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

@media (min-width: 560px) {
  .toc-list { grid-template-columns: 1fr 1fr; }
}

.toc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.12s ease;
}

.toc-list a:hover,
.toc-list a:focus-visible {
  background: var(--gold-soft);
}

.toc-list .icon { color: var(--navy-soft); }

/* -------------------- Rule sections -------------------- */

article.rules section {
  margin-bottom: 28px;
  scroll-margin-top: 20px;
}

article.rules h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.12rem;
  color: var(--navy);
  border-bottom: 2px solid var(--gold-soft);
  padding-bottom: 8px;
  margin: 0 0 12px;
}

article.rules h2 .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--gold);
}

.icon path,
.icon circle,
.icon ellipse {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

article.rules p { margin: 0 0 12px; }

article.rules ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

article.rules li { margin-bottom: 6px; }

.badge {
  display: inline-block;
  padding: 2px 11px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--navy);
  font-weight: 700;
  border: 1px solid var(--gold);
  white-space: nowrap;
}

.badge-emergency {
  background: var(--wine-soft);
  color: var(--wine);
  border-color: var(--wine);
}

.closing {
  margin-top: 36px;
  padding: 20px 22px;
  background: var(--navy);
  color: #f4f1ea;
  border-radius: var(--radius);
}

.closing p { margin: 0 0 10px; }
.closing p:last-child { margin-bottom: 0; }
.closing strong { color: var(--gold); }

footer.page-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* -------------------- Small screens -------------------- */

@media (max-width: 420px) {
  .lang-grid { gap: 10px; }
  .lang-card { padding: 16px 6px; }
  .lang-card .flag { width: 32px; height: 24px; }
  body { font-size: 16px; }
  header.top { padding: 34px 18px; }
}

/* -------------------- Wider screens -------------------- */

@media (min-width: 900px) {
  body { font-size: 18px; }
  .page-wrap { padding-top: 10px; }
}

/* -------------------- Reduced motion -------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rules-content, .lang-card { transition: none; }
}

/* -------------------- Print -------------------- */

@media print {
  body { background: #fff; }
  .lang-select, .toc { display: none; }
  header.top { background: none; box-shadow: none; }
  .brand { color: var(--navy); }
  .greeting, .intro, article.rules h2 { box-shadow: none; }
  .closing { background: none; color: var(--ink); border: 1px solid var(--line); }
}
