/* Application styles; Tailwind, Trix, and Action Text are linked separately. */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&family=Yeseva+One&display=swap');

.inter-tight-regular {
  font-family: 'Inter Tight', sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.yeseva-one-regular {
  font-family: 'Yeseva One', serif;
  font-weight: 400;
  font-style: normal;
}

/* A single, gentle entrance for the homepage branding and dark overlay. */
@media (prefers-reduced-motion: no-preference) {
  .home-hero-entrance {
    animation: home-hero-entrance 1.2s ease-out;
  }

  .home-hero-overlay {
    animation: home-hero-darken 1.2s ease-out;
  }

  .home-hero-scroll-prompt {
    animation: home-hero-prompt 800ms ease-out 800ms backwards;
  }

  @keyframes home-hero-prompt {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes home-hero-entrance {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes home-hero-darken {
    from { background-color: transparent; }
  }
}

/* Linked cards lift gently without enlarging their contents. */
.card-hover:focus-visible > .card {
  box-shadow: 0 12px 20px -6px rgb(2 37 66 / 0.2), 0 4px 8px -4px rgb(2 37 66 / 0.12);
}

@media (hover: hover) and (pointer: fine) {
  .card-hover:hover > .card {
    box-shadow: 0 12px 20px -6px rgb(2 37 66 / 0.2), 0 4px 8px -4px rgb(2 37 66 / 0.12);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card-hover { transition: transform 200ms ease-out; }
  .card-hover > .card { transition: box-shadow 200ms ease-out; }
  .card-hover:focus-visible { transform: translateY(-3px); }

  @media (hover: hover) and (pointer: fine) {
    .card-hover:hover { transform: translateY(-3px); }
  }
}

/* Desktop links reveal a fine underline; mobile links soften their colour change. */
.desktop-navigation :is(a, button) {
  position: relative;
  display: inline-block;
  color: #fff;
}

.desktop-navigation :is(a, button)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.4rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
}

.desktop-navigation :is(a, button):is(:hover, :focus-visible) { color: #ff595d; }
.desktop-navigation :is(a, button):is(:hover, :focus-visible)::after { transform: scaleX(1); }
.site-navigation .menu-content :is(a, button):focus-visible { background-color: #ff595d; }
.site-navigation :is(a, button):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .desktop-navigation :is(a, button) { transition: color 180ms ease-out; }
  .desktop-navigation :is(a, button)::after { transition: transform 180ms ease-out; }
  .site-navigation .menu-content :is(a, button) { transition: background-color 180ms ease-out; }
}

/* The residents' handbook keeps long clauses readable at every screen size. */
.house-rules {
  max-width: 80rem;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.rules-header {
  max-width: 42rem;
  margin: 0 auto 3rem;
  text-align: center;
}

.rules-header-divider {
  width: 9rem;
  height: 0.25rem;
  margin: 2rem auto;
  background: #e7e0c9;
}

.rules-edition {
  margin-bottom: 0.75rem;
  color: #705400;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.rules-subtitle { margin-top: 0.5rem; }
.rules-intro { margin-top: 1.25rem; line-height: 1.7; }
.rules-layout { display: grid; gap: 2.5rem; align-items: start; }

.rules-contents {
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: #e7e0c9;
}

.rules-contents h2 { margin-bottom: 1rem; font-size: 1.5rem; }
.rules-contents ol { margin: 0; padding: 0; list-style: none; }
.rules-contents li + li { margin-top: 0.25rem; }

.rules-contents a {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.4;
  text-decoration: none;
}

.rules-contents a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.rules-section-number { flex-shrink: 0; min-width: 2rem; font-variant-numeric: tabular-nums; }
.rules-document { min-width: 0; }

.rules-source-note {
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  border-left: 3px solid #a67c00;
  background: #f3f0e5;
  font-size: 0.9rem;
  line-height: 1.7;
}

.rules-source-note p { margin-top: 0.35rem; }
.rules-section { padding-bottom: 2.5rem; scroll-margin-top: 2rem; }
.rules-section + .rules-section { padding-top: 2.5rem; border-top: 1px solid #e7e0c9; }
.rules-section h2 { margin-bottom: 1.75rem; font-size: 1.9rem; line-height: 1.3; }
.rules-section h2 .rules-section-number { margin-right: 0.5rem; color: #705400; }
.rules-section h3 { margin: 2rem 0 1rem; font-size: 1.15rem; font-weight: 600; line-height: 1.5; scroll-margin-top: 2rem; }
.rules-section > h3:first-child { margin-top: 0; }
.rules-section p { margin: 0.85rem 0; line-height: 1.8; overflow-wrap: anywhere; }
.rules-section .rules-clause { padding-left: 1.5rem; text-indent: -1.5rem; }
.rules-clause-label { font-weight: 600; }
.rules-section .rules-table-note { font-size: 0.9rem; }
.rules-section h4 { margin: 1.5rem 0 0.75rem; font-weight: 600; scroll-margin-top: 2rem; }
.rules-measures { padding-left: 1.5rem; list-style: disc; line-height: 1.8; }
.rules-measures li + li { margin-top: 0.5rem; }
.rules-temporary { margin-top: 1.5rem; padding: 1.25rem; border: 1px solid #e7e0c9; border-radius: 0.5rem; background: #f6f4ec; }
.rules-section .rules-reference {
  display: block;
  margin-top: 0.35rem;
  color: #705400;
  font-size: 0.85rem;
  line-height: 1.6;
  text-indent: 0;
}
.rules-section address { margin-top: 1rem; font-style: normal; line-height: 1.8; }
.rules-section a, .rules-end a { color: #705400; text-decoration: underline; text-underline-offset: 0.2em; }
.house-rules a:focus-visible, .rules-table-scroll:focus-visible { outline: 2px solid #022542; outline-offset: 4px; border-radius: 2px; }

.rules-table-scroll { max-width: 100%; margin: 1.25rem 0; overflow-x: auto; }
.rules-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.95rem; line-height: 1.6; }
.rules-table caption { padding-bottom: 0.75rem; text-align: left; font-weight: 600; }
.rules-table th, .rules-table td { padding: 0.85rem 1rem; border: 1px solid #ddd7c4; vertical-align: top; }
.rules-table thead th { background: #e7e0c9; font-weight: 600; }
.rules-table tbody th { font-weight: 400; }
.rules-table tbody tr:nth-child(even) { background: #f6f4ec; }
.rules-table td:last-child { min-width: 9rem; }
.rules-end { padding-top: 1.5rem; border-top: 1px solid #e7e0c9; }

/* Clause search stays separate from the original handbook wording. */
.rules-search { max-width: 54rem; margin: 0 auto 3rem; padding: 1.5rem; border: 1px solid #ddd7c4; border-radius: 0.75rem; background: #f3f0e5; }
.rules-search[hidden], .rules-search [hidden] { display: none; }
.rules-search label { display: block; font-size: 1.5rem; }
.rules-search form > p { margin: 0.5rem 0 1rem; font-size: 0.95rem; line-height: 1.6; }
.rules-search-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rules-search input { flex: 1 1 15rem; min-width: 0; padding: 0.8rem 1rem; border: 1px solid #9b947e; border-radius: 0.35rem; background: #fff; color: #022542; font: inherit; }
.rules-search button { padding: 0.65rem 1rem; border-radius: 0.35rem; cursor: pointer; font: inherit; }
.rules-search-submit { background: #022542; color: #fff; }
.rules-search-clear, .rules-search-more { border: 1px solid #9b947e; background: #fff; }
.rules-search-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; margin-top: 0.75rem; font-size: 0.85rem; }
.rules-search-examples button { padding: 0.25rem 0; color: #705400; text-decoration: underline; text-underline-offset: 0.2em; }
.rules-search-status:not(:empty) { margin: 1.5rem 0 0.75rem; font-size: 0.9rem; }
.rules-search-results { list-style: none; margin: 0; padding: 0; }
.rules-search-result { padding: 1.5rem 0; border-top: 1px solid #ddd7c4; overflow-wrap: anywhere; }
.rules-search-result h3 { font-weight: 600; font-size: 1.05rem; line-height: 1.5; }
.rules-search-result blockquote { margin: 0.75rem 0; line-height: 1.8; }
.rules-search-context { margin-top: 0.5rem; font-size: 0.9rem; line-height: 1.6; }
.rules-search-reference { margin: 0.65rem 0; color: #705400; font-size: 0.85rem; line-height: 1.6; }
.rules-search-badge { margin-top: 0.5rem; font-size: 0.8rem; font-weight: 600; color: #705400; }
.rules-search-result a { color: #705400; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 0.2em; }
.rules-search mark { padding: 0.05em 0.1em; background: #f1dc8b; color: #022542; }
.rules-search input:focus-visible, .rules-search button:focus-visible { outline: 2px solid #022542; outline-offset: 3px; }
.rules-section p[id], .rules-section li[id], .rules-section tr[id] { scroll-margin-top: 2rem; }
.rules-section :target { outline: 2px solid #a67c00; outline-offset: 0.3rem; background: #f3f0e5; }

/* Plain-language answers link back to the complete handbook. */
.rules-faqs { max-width: 54rem; margin: 0 auto 3rem; padding: 1.5rem; border: 1px solid #ddd7c4; border-radius: 0.75rem; scroll-margin-top: 2rem; }
.rules-faqs h2 { font-size: 1.7rem; line-height: 1.4; }
.rules-faqs-intro { margin-top: 0.75rem; line-height: 1.7; }
.rules-faqs-browse { margin: 0.75rem 0; }
.rules-faqs a { color: #705400; text-decoration: underline; text-underline-offset: 0.2em; }
.rules-faq-topics { display: flex; flex-wrap: wrap; gap: 0.65rem 1rem; margin: 1.25rem 0; font-size: 0.9rem; }
.rules-faq-group { margin-top: 2rem; scroll-margin-top: 2rem; }
.rules-faq-group h3 { margin-bottom: 0.75rem; font-size: 1.25rem; line-height: 1.5; }
.rules-faq-item { border-top: 1px solid #ddd7c4; scroll-margin-top: 2rem; }
.rules-faq-item summary { padding: 1rem 0; cursor: pointer; font-weight: 600; line-height: 1.6; }
.rules-faq-item summary::marker { color: #705400; }
.rules-faq-item summary:focus-visible { outline: 2px solid #022542; outline-offset: 3px; }
.rules-faq-item:target { outline: 2px solid #a67c00; outline-offset: 0.4rem; }
.rules-faq-answer { padding-bottom: 1.25rem; }
.rules-faq-answer > p { margin: 0.65rem 0; line-height: 1.8; overflow-wrap: anywhere; }
.rules-faq-sources { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font-size: 0.85rem; }
.rules-faq-reference { color: #705400; font-size: 0.85rem; }
.rules-search-answer { margin: 0.75rem 0; line-height: 1.8; }
.rules-search-sources { display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; margin: 0.75rem 0; }

@media (min-width: 1024px) {
  .rules-layout { grid-template-columns: 16rem minmax(0, 1fr); gap: 4rem; }
  .rules-contents { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; }
}

@media (max-width: 639px) {
  .house-rules { padding: 2.5rem 1.25rem 5rem; }
  .rules-header { margin-bottom: 2rem; }
  .rules-section h2 { font-size: 1.6rem; }
  .rules-contents { padding: 1.25rem; }
  .rules-table th, .rules-table td { padding: 0.65rem; }
}

@media print {
  body:has(.house-rules) > nav,
  body:has(.house-rules) > footer,
  body:has(.house-rules) > a.fixed,
  .rules-contents,
  .rules-search,
  .rules-faqs,
  .rules-end { display: none; }
  .house-rules { padding: 0; max-width: none; color: #000; }
  .rules-layout { display: block; }
  .rules-header { margin-bottom: 2rem; }
  .rules-table-scroll { overflow: visible; }
  .rules-section h2, .rules-section h3 { break-after: avoid; }
  .rules-table tr { break-inside: avoid; }
  .rules-section p { orphans: 3; widows: 3; }
}
