/* ==========================================================================
   Kingswood Group — Legal Documents SPA
   Brand tokens lifted verbatim from the styling guide.
   ========================================================================== */

:root {
  /* Brand */
  --burgundy:        #8B0A3C;
  --burgundy-light:  #A61A4F;
  --burgundy-dark:   #6B0830;
  --pink-accent:     #F8E8EE;

  /* Neutrals */
  --ink:             #1a1a1a;
  --grey-dark:       #4A4A4A;
  --grey-mid:        #666666;
  --grey-light:      #999999;
  --border:          rgba(139, 10, 60, 0.08);
  --border-hover:    rgba(139, 10, 60, 0.18);

  /* Surfaces */
  --white:           #ffffff;
  --off-white:       #FAFAFA;

  /* Sizing */
  --header-height: 88px;
  --content-prose: 800px;
  --content-grid:  1200px;
  --content-long:  720px;
  --radius-card:   12px;
  --radius-btn:    6px;
  --radius-hero:   16px;
}

/* Reset ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--grey-dark);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--burgundy); text-decoration: none; }
a:hover { opacity: 0.75; text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* Focus ring */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--burgundy);
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-btn);
  z-index: 1000;
  font-weight: 500;
}
.skip-link:focus { top: 1rem; text-decoration: none; opacity: 1; }

/* Header / nav ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--content-grid);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: var(--header-height);
}
.brand img {
  height: auto;
  width: clamp(180px, 22vw, 240px);
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}
.mw-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: var(--pink-accent);
  color: var(--burgundy);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 100px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.2s;
}
.mw-badge:hover {
  background: var(--burgundy);
  color: var(--white);
  opacity: 1;
  text-decoration: none;
}
@media (max-width: 760px) {
  .mw-badge { display: none; }
}
.primary-nav,
.nav-toggle { display: none !important; }
.primary-nav {
  gap: 2rem;
  align-items: center;
}
.primary-nav a {
  position: relative;
  color: var(--grey-dark);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
}
.primary-nav a:hover { color: var(--burgundy); opacity: 1; text-decoration: none; }
.primary-nav a[aria-current="page"] {
  color: var(--burgundy);
}
.primary-nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--burgundy);
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle-bar {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Main -------------------------------------------------------------------- */
.main {
  position: relative;
  z-index: 1;
  padding: 2.5rem 1.5rem 3rem;
  outline: none;
}
.main:focus { outline: none; }

.view {
  max-width: var(--content-prose);
  margin: 0 auto;
}
.view--wide  { max-width: var(--content-grid); }
.view--long  { max-width: var(--content-long); }

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--burgundy);
  background: var(--pink-accent);
  padding: 0.5rem 1.25rem;
  border-radius: 100px;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

/* Typography -------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: 'Oswald', 'Lato', sans-serif;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin: 0 0 1rem;
}
h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
h2 { font-size: 1.5rem; margin-top: 3rem; scroll-margin-top: calc(var(--header-height) + 24px); }
h3 { font-size: 1.125rem; margin-top: 2rem; scroll-margin-top: calc(var(--header-height) + 24px); }
p  { margin: 0 0 1.5rem; }
strong { color: var(--ink); font-weight: 600; }
ul, ol { padding-left: 1.25rem; margin: 0 0 1.5rem; }
li { margin-bottom: 0.5rem; }

.lead { font-size: 1.0625rem; color: var(--grey-mid); }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-btn);
  border: 2px solid var(--burgundy);
  background: var(--burgundy);
  color: var(--white);
  transition: all 0.3s ease;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  background: var(--white);
  color: var(--burgundy);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(139, 10, 60, 0.18);
  opacity: 1;
  text-decoration: none;
}
.btn--lg { padding: 1rem 2.5rem; font-size: 1rem; }
.btn--ghost {
  background: var(--white);
  color: var(--burgundy);
}
.btn--ghost:hover {
  background: var(--burgundy);
  color: var(--white);
}

.link {
  color: var(--burgundy);
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}
.link:hover { opacity: 0.7; text-decoration: underline; }

/* Info card grid (landing) ----------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0 0;
}
.info-card {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.75rem 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}
.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--border-hover);
  text-decoration: none;
  opacity: 1;
}
.info-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--pink-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--burgundy);
}
.info-card .icon svg { width: 28px; height: 28px; }
.info-card h3 {
  margin: 0;
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.info-card p { margin: 0; color: var(--grey-mid); font-size: 0.95rem; }
.info-card .link { margin-top: auto; }

/* Document tile ----------------------------------------------------------- */
.doc-list { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 1rem; }
.doc-tile {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.25rem 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.doc-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--border-hover);
}
.doc-tile .doc-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--pink-accent);
  color: var(--burgundy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.doc-tile .doc-icon svg { width: 22px; height: 22px; }
.doc-tile .doc-body { flex-grow: 1; min-width: 0; }
.doc-tile .doc-title { font-weight: 600; color: var(--ink); margin: 0 0 0.15rem; }
.doc-tile .doc-meta { color: var(--grey-mid); font-size: 0.875rem; margin: 0; word-break: break-word; }
.doc-tile .doc-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  justify-content: center;
  flex-shrink: 0;
  min-width: 150px;
}
.doc-tile .doc-actions .btn {
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  width: 100%;
  justify-content: center;
}
.doc-tile .doc-actions .link {
  justify-content: center;
  font-size: 0.85rem;
  text-align: center;
}

/* Trust banner ------------------------------------------------------------ */
.trust-banner {
  background: linear-gradient(135deg, var(--burgundy) 0%, var(--burgundy-dark) 100%);
  color: var(--white);
  border-radius: var(--radius-hero);
  padding: 2.5rem 2rem;
  margin-top: 3rem;
}
.trust-banner h2 { color: var(--white); margin-top: 0; }
.trust-banner p { color: rgba(255, 255, 255, 0.92); }
.trust-banner .btn { border-color: var(--white); background: var(--white); color: var(--burgundy); }
.trust-banner .btn:hover { background: transparent; color: var(--white); }

/* Contact card ------------------------------------------------------------ */
.contact-card {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
}
.contact-card p { margin: 0.25rem 0; }

/* Prose layout with TOC --------------------------------------------------- */
.prose-layout {
  max-width: var(--content-grid);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
}
.prose-layout__body { max-width: var(--content-long); margin: 0 auto; }
.toc {
  display: none;
}
.toc h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--burgundy);
  margin: 0 0 1rem;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.875rem;
}
.toc li { margin-bottom: 0.4rem; }
.toc a {
  color: var(--grey-mid);
  font-weight: 500;
}
.toc a:hover { color: var(--burgundy); }

@media (min-width: 1024px) {
  .prose-layout {
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: start;
  }
  .prose-layout__body { margin: 0; max-width: var(--content-long); }
  .toc {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + 24px);
    padding: 1.25rem 1.25rem;
    border-left: 2px solid var(--border);
  }
}

/* Logo lockup above the footer ------------------------------------------- */
.logo-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem 1.5rem;
  flex-wrap: wrap;
  background: var(--white);
}
.logo-lockup img { height: auto; display: block; }
.logo-lockup .lockup-kw { max-width: 220px; width: 100%; }
.logo-lockup .lockup-mw { max-width: 180px; width: 100%; }
.logo-lockup .lockup-plus {
  color: var(--burgundy);
  font-size: 1.5rem;
  font-weight: 300;
  opacity: 0.7;
}
@media (max-width: 640px) {
  .logo-lockup { gap: 0.75rem; padding: 0.75rem 1rem 1.25rem; }
  .logo-lockup .lockup-kw { max-width: 160px; }
  .logo-lockup .lockup-mw { max-width: 130px; }
}

/* Footer ------------------------------------------------------------------ */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--grey-mid);
  background: var(--white);
}
.footer p { max-width: 920px; margin: 0 auto 1rem; }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.footer-links a {
  color: var(--burgundy);
  font-weight: 500;
}

/* PDF viewer modal -------------------------------------------------------- */
.pdf-viewer {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.85);
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.pdf-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.pdf-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  flex-grow: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.pdf-controls button,
.pdf-controls .pdf-download {
  background: var(--white);
  border: 1px solid var(--border-hover);
  color: var(--burgundy);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}
.pdf-controls button:hover,
.pdf-controls .pdf-download:hover {
  background: var(--burgundy);
  color: var(--white);
  opacity: 1;
  text-decoration: none;
}
.pdf-controls input.pdf-pagenum {
  width: 56px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  text-align: center;
  font-family: inherit;
}
.pdf-controls .pdf-pagecount {
  color: var(--grey-mid);
  font-size: 0.875rem;
}
.pdf-controls button[data-action="close"] {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.2rem 0.6rem;
}

.pdf-pages {
  flex-grow: 1;
  overflow: auto;
  padding: 1.5rem;
  text-align: center;
}
.pdf-pages canvas.pdf-page {
  display: block;
  margin: 0 auto 1rem;
  background: var(--white);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  max-width: 100%;
  height: auto;
}
.pdf-loading,
.pdf-error {
  background: var(--white);
  padding: 2.5rem;
  border-radius: var(--radius-card);
  display: inline-block;
  margin: 4rem auto;
  text-align: center;
  max-width: 480px;
}
.pdf-error .btn { margin-top: 1rem; }

/* Animations -------------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
  animation: fadeInUp 0.8s ease-out both;
}
.fade-in-up > * { animation: fadeInUp 0.8s ease-out both; }
.fade-in-up > *:nth-child(2) { animation-delay: 0.1s; }
.fade-in-up > *:nth-child(3) { animation-delay: 0.2s; }
.fade-in-up > *:nth-child(4) { animation-delay: 0.3s; }
.fade-in-up > *:nth-child(5) { animation-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in-up, .fade-in-up > * { animation: none !important; opacity: 1; transform: none; }
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 900px) {
  .main { padding: 2rem 1rem 3rem; }
  .header-inner { padding: 0.75rem 1rem; }
  .nav-toggle { display: flex; }
  .primary-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--white);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem 1.25rem;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
  }
  .primary-nav a:last-child { border-bottom: 0; }
  .primary-nav a[aria-current="page"]::after { display: none; }

  .doc-tile { flex-wrap: wrap; }
  .doc-tile .doc-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 540px) {
  h1 { font-size: 1.65rem; }
  .pdf-toolbar { padding: 0.6rem 0.75rem; gap: 0.5rem; }
  .pdf-title { font-size: 0.85rem; flex-basis: 100%; }
}
