/* ==========================================================================
   Hushfield Design System
   Brand Palette:
   - Primary Background: Dark Mineral (#171C1A)
   - Primary Text:       Warm Cream (#F2EBDD)
   - Accent:             Muted Warm Gold (#C5A46D)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap');

:root {
  /* Colors */
  --bg-primary:         #171C1A;
  --bg-surface:         #1D2320;
  --bg-surface-hover:   #242C28;
  --text-primary:       #F2EBDD;
  --text-muted:         rgba(242, 235, 221, 0.72);
  --text-subtle:        rgba(242, 235, 221, 0.48);
  
  --accent-gold:        #C5A46D;
  --accent-gold-hover:  #D4B67F;
  --accent-gold-muted:  rgba(197, 164, 109, 0.15);
  --border-subtle:      rgba(242, 235, 221, 0.1);
  --border-gold:        rgba(197, 164, 109, 0.25);
  --border-gold-hover:  rgba(197, 164, 109, 0.45);

  /* Fonts */
  --font-serif:         'Cormorant Garamond', 'Georgia', 'Cambria', serif;
  --font-sans:          'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:          ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* Layout */
  --content-max-width:  760px;
  --header-max-width:   840px;
  --radius-sm:          6px;
  --radius-md:          12px;
  --radius-lg:          20px;
  --transition-fast:    0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  color-scheme: dark;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.0625rem; /* 17px base for legal readability */
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Link Reset & Color Control (Prevents Browser-Default Purple Visited Links)
   -------------------------------------------------------------------------- */
a, a:visited {
  color: var(--accent-gold);
  text-decoration: underline;
  text-decoration-color: rgba(197, 164, 109, 0.35);
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
  word-break: break-word;
  overflow-wrap: anywhere;
}

a:hover, a:active {
  color: var(--accent-gold-hover);
  text-decoration-color: var(--accent-gold-hover);
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Container & Header Structure
   -------------------------------------------------------------------------- */
.site-wrapper {
  width: 100%;
  max-width: var(--header-max-width);
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header.site-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2rem;
  margin-bottom: 3.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
}

/* Brand Link & Logo Styling */
.brand-link, .brand-link:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-link:hover, .brand-link:focus-visible, .brand-link:active {
  text-decoration: none;
  color: var(--text-primary);
}

.brand-link:hover .brand-wordmark,
.brand-link:focus-visible .brand-wordmark {
  color: var(--accent-gold-hover);
}

.brand-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: border-color var(--transition-fast);
}

.brand-link:hover .brand-logo-mark,
.brand-link:focus-visible .brand-logo-mark {
  border-color: var(--accent-gold-hover);
}

.brand-wordmark, .brand-wordmark:visited {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1;
  transition: color var(--transition-fast);
}

/* Header Navigation */
nav.site-nav {
  display: flex;
  align-items: center;
}

nav.site-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

nav.site-nav a, nav.site-nav a:visited {
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

nav.site-nav a:hover,
nav.site-nav a:focus-visible,
nav.site-nav a.active,
nav.site-nav a.active:visited {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   Main Content Layout
   -------------------------------------------------------------------------- */
main.site-main {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  flex: 1;
  text-align: left; /* Strict left alignment everywhere */
}

/* Eyebrow badge */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 0.75rem;
  display: inline-block;
}

/* Typography Hierarchy */
h1 {
  font-family: var(--font-serif);
  font-size: 2.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  scroll-margin-top: 2rem;
}

h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.effective-date {
  font-size: 0.9375rem;
  color: var(--text-subtle);
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* Lists */
ul, ol {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.65rem;
}

li::marker {
  color: var(--accent-gold);
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Homepage Hero */
.hero {
  padding: 1.5rem 0 3.5rem;
  text-align: left;
}

.hero h1 {
  font-size: 3.25rem;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  max-width: 640px;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 580px;
  margin-bottom: 3rem;
}

.brand-pillar-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 3.5rem;
}

.brand-pillar-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-pillar-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-gold);
}

.brand-pillar-box p {
  margin-bottom: 0;
  font-size: 0.975rem;
  color: var(--text-muted);
}

/* Section Cards & Grid */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 3.5rem;
}

.card, .card:visited {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.card:hover, .card:focus-visible {
  border-color: var(--border-gold-hover);
  background-color: var(--bg-surface-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-arrow {
  color: var(--accent-gold);
  font-size: 1.1rem;
  transition: transform var(--transition-fast);
}

.card:hover .card-arrow,
.card:focus-visible .card-arrow {
  transform: translateX(4px);
}

.card-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0;
}

/* Table of Contents (TOC) for Legal Document */
.toc-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 3rem;
}

.toc-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.toc-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem 1.25rem;
}

.toc-list li {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.toc-list a, .toc-list a:visited {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Button & Action Links */
.back-link, .back-link:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  color: var(--accent-gold);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.back-link:hover, .back-link:focus-visible {
  color: var(--accent-gold-hover);
  transform: translateX(-3px);
  text-decoration: none;
}

/* Footer */
footer.site-footer {
  width: 100%;
  max-width: var(--header-max-width);
  margin: 4rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.84375rem;
  color: var(--text-subtle);
}

.footer-info p {
  color: var(--text-subtle);
  margin-bottom: 0.25rem;
  font-size: 0.84375rem;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
}

.footer-nav a, .footer-nav a:visited {
  color: var(--text-subtle);
  text-decoration: none;
  font-size: 0.84375rem;
  transition: color var(--transition-fast);
}

.footer-nav a:hover, .footer-nav a:focus-visible {
  color: var(--accent-gold);
}

/* --------------------------------------------------------------------------
   Focused Mobile Responsive Rules (iPhone & Mobile Safari Optimization)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .site-wrapper {
    padding: 1.25rem 1.25rem 3rem;
    min-height: auto; /* Avoid 100vh jump issues on Mobile Safari */
  }

  header.site-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    margin-bottom: 2rem;
    gap: 0.75rem;
  }

  .brand-logo-mark {
    width: 28px;
    height: 28px;
  }

  .brand-wordmark, .brand-wordmark:visited {
    font-size: 1.3rem;
  }

  nav.site-nav ul {
    gap: 1.15rem;
  }

  nav.site-nav a, nav.site-nav a:visited {
    font-size: 0.875rem;
    padding: 0.2rem 0;
  }

  .hero {
    padding: 0.5rem 0 2.25rem;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 7vw, 2.6rem);
    line-height: 1.18;
    margin-bottom: 0.85rem;
  }

  .hero-subtitle {
    font-size: clamp(1.0625rem, 4vw, 1.1875rem);
    line-height: 1.5;
    margin-bottom: 1.75rem;
  }

  .brand-pillar-box {
    padding: 1.25rem 1.35rem;
    margin-bottom: 2.25rem;
  }

  .brand-pillar-title {
    font-size: 1.1rem;
  }

  .brand-pillar-box p {
    font-size: 0.9375rem;
  }

  .section-grid {
    margin-top: 1rem;
    margin-bottom: 2.25rem;
    gap: 1rem;
  }

  .card, .card:visited {
    padding: 1.35rem;
  }

  .card-title {
    font-size: 1.2rem;
  }

  .card-desc {
    font-size: 0.875rem;
  }

  h1 {
    font-size: 2.15rem;
    line-height: 1.2;
    margin-bottom: 1rem;
  }

  h2 {
    font-size: 1.45rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-top: 1rem;
  }

  h3 {
    font-size: 1.1875rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .effective-date {
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
  }

  .toc-box {
    padding: 1.25rem;
    margin-bottom: 2rem;
  }

  .toc-list {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  footer.site-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

@media (max-width: 430px) {
  .site-wrapper {
    padding-inline: 20px;
    padding-top: 1.15rem;
  }

  header.site-header {
    margin-bottom: 1.65rem;
    padding-bottom: 1.15rem;
  }

  .brand-link {
    gap: 0.55rem;
  }

  .brand-wordmark, .brand-wordmark:visited {
    font-size: 1.25rem;
  }

  .hero h1 {
    font-size: clamp(2rem, 8vw, 2.35rem);
    line-height: 1.16;
  }

  .hero-subtitle {
    font-size: 1.0625rem;
    line-height: 1.5;
  }
}

/* Motion Accessibility */
@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;
  }
}
