/* =============================================================================
   SNOWDAUGHTER — stylesheet for the Virginia Marie Brand memorial site
   ============================================================================= */

/* =============================================================================
   FONT-FACE DECLARATIONS
   ============================================================================= */

@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display-regular.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display-italic.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-regular.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* =============================================================================
   CSS CUSTOM PROPERTIES
   ============================================================================= */

:root {
  --color-bg:       #FAF9F6;
  --color-text:     #2D2D2D;
  --color-heading:  #2C3E6B;
  --color-link:     #3B5998;
  --color-divider:  #E0DDD8;
  --color-footer-bg: #F3F1ED;

  --font-serif:     'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans:      'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;

  --max-width:      800px;
  --content-padding: 1.5rem;

  --transition-fast: 150ms ease;
  --transition-med:  250ms ease;
}


/* =============================================================================
   RESET & BOX MODEL
   ============================================================================= */

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

ul,
ol {
  list-style: none;
}


/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

.skip-link {
  position: absolute;
  top: -9999px;
  left: 0;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--color-heading);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
  outline: none;
}

.skip-link:focus {
  top: 0;
}

/* Visible focus for all interactive elements */
:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 3px;
}


/* =============================================================================
   BASE TYPOGRAPHY
   ============================================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  color: var(--color-heading);
  line-height: 1.3;
  font-weight: 700;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.7rem; margin-top: 2.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.35rem; margin-top: 2rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.4rem; }
h5 { font-size: 1rem; margin-top: 1.25rem; margin-bottom: 0.4rem; }
h6 { font-size: 0.9rem; margin-top: 1rem; margin-bottom: 0.4rem; }

p {
  margin-bottom: 1.4rem;
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-heading);
}

strong,
b {
  font-weight: 700;
}

em,
i {
  font-style: italic;
}

small {
  font-size: 0.85rem;
}

hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 2.5rem 0;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}


/* =============================================================================
   PAGE WRAPPER
   ============================================================================= */

.page-wrapper {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}


/* =============================================================================
   HEADER
   ============================================================================= */

.site-header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
  padding: 1.75rem var(--content-padding) 0;
}

.site-header .page-wrapper {
  padding: 0;
}

.header-banner {
  width: 100%;
  height: auto;
  display: block;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
}

.site-branding {
  flex: 1;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1.15;
  margin: 0;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-title a:hover {
  color: var(--color-link);
}

.site-subtitle {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: #7a7672;
  margin-top: 0.25rem;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* Header controls: search toggle + nav toggle */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.25rem;
  flex-shrink: 0;
}


/* =============================================================================
   ICON BUTTONS (search toggle, nav toggle)
   ============================================================================= */

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-heading);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  padding: 0;
}

.icon-btn:hover {
  background-color: var(--color-divider);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}


/* =============================================================================
   SEARCH EXPAND
   ============================================================================= */

.search-toggle {
  /* inherits .icon-btn */
}

.search-toggle[aria-expanded="true"] {
  background-color: var(--color-divider);
}

.search-form {
  display: none;
  padding: 0.75rem 0 1rem;
  border-top: 1px solid var(--color-divider);
}

.search-form.open {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--color-divider);
  border-radius: 4px;
  background-color: #fff;
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}

.search-input::placeholder {
  color: #aaa;
}

.search-input:focus {
  border-color: var(--color-link);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 3px rgba(59, 89, 152, 0.15);
}

.search-submit {
  padding: 0.5rem 1.1rem;
  background-color: var(--color-heading);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
}

.search-submit:hover {
  background-color: var(--color-link);
}


/* =============================================================================
   NAVIGATION — hamburger toggle
   ============================================================================= */

.nav-toggle {
  /* inherits .icon-btn */
  display: none; /* hidden on desktop */
}

.nav-toggle[aria-expanded="true"] {
  background-color: var(--color-divider);
}


/* =============================================================================
   NAVIGATION — desktop (horizontal)
   ============================================================================= */

.site-nav {
  /* sits below header-top */
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: block;
  padding: 0.65rem 0.85rem;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover,
.nav-item.active > .nav-link {
  color: var(--color-heading);
  border-bottom-color: var(--color-heading);
}

/* Dropdown indicator arrow */
.nav-item.has-dropdown > .nav-link::after {
  content: ' ▾';
  font-size: 0.7em;
  opacity: 0.7;
  display: inline-block;
  margin-left: 0.15em;
}


/* =============================================================================
   NAVIGATION — dropdowns
   ============================================================================= */

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 200;
  min-width: 180px;
  background-color: #fff;
  border: 1px solid var(--color-divider);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 0.4rem 0;
  list-style: none;
  margin: 0;
}

.nav-item.has-dropdown.open > .nav-dropdown {
  display: block;
}

.nav-dropdown li {
  /* no positioning needed */
}

.nav-dropdown a {
  display: block;
  padding: 0.5rem 1.1rem;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.nav-dropdown a:hover {
  background-color: var(--color-bg);
  color: var(--color-heading);
}



/* =============================================================================
   MAIN CONTENT AREA
   ============================================================================= */

main {
  flex: 1;
  padding: 2.5rem var(--content-padding);
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
}

.content {
  /* prose container */
  font-size: 1rem;
  line-height: 1.8;
  color: var(--color-text);
}

.content > * + * {
  margin-top: 1.4rem;
}

.content h2:first-child,
.content h1:first-child {
  margin-top: 0;
}

/* Lead / intro paragraph */
.content .lead {
  font-size: 1.15rem;
  line-height: 1.75;
  color: #4a4a4a;
}

/* Inline images */
.content img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  margin: 1.5rem auto;
}

.content figure {
  margin: 2rem 0;
  text-align: center;
}

.content figcaption {
  font-size: 0.82rem;
  color: #8a8680;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Lists */
.content ul,
.content ol {
  padding-left: 1.6rem;
  margin-bottom: 1.4rem;
}

.content ul {
  list-style: disc;
}

.content ol {
  list-style: decimal;
}

.content li {
  margin-bottom: 0.4rem;
}

.content li::marker {
  color: var(--color-heading);
}

/* Blockquote */
blockquote,
.content blockquote {
  border-left: 3px solid var(--color-divider);
  margin: 2rem 0;
  padding: 0.75rem 0 0.75rem 1.5rem;
  color: #555;
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.75;
}

blockquote cite,
.content blockquote cite {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-style: normal;
  color: #8a8680;
}

blockquote cite::before {
  content: '— ';
}

/* Code */
code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88em;
  background-color: #F0EDE8;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background-color: #F0EDE8;
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.5rem 0;
}

.content th,
.content td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--color-divider);
  text-align: left;
  vertical-align: top;
}

.content th {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--color-heading);
  border-bottom-width: 2px;
}

.content tr:last-child td {
  border-bottom: none;
}


/* =============================================================================
   LETTERS PAGE — individual letter sections
   ============================================================================= */

.letter {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--color-divider);
}

.letter:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.letter-header {
  margin-bottom: 1.25rem;
}

.letter-meta {
  font-size: 0.85rem;
  color: #8a8680;
  font-family: var(--font-sans);
  margin-top: 0.3rem;
}

.letter-body {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--color-text);
}

.letter-body p {
  margin-bottom: 1.2rem;
}

.letter-salutation {
  font-style: italic;
  margin-bottom: 1.1rem;
}

.letter-closing {
  margin-top: 1.5rem;
  font-style: italic;
}


/* =============================================================================
   SEARCH RESULTS PAGE
   ============================================================================= */

.search-results-heading {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--color-heading);
  margin-bottom: 0.5rem;
}

.search-results-count {
  font-size: 0.9rem;
  color: #8a8680;
  margin-bottom: 2rem;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-results li {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-divider);
}

.search-results li:last-child {
  border-bottom: none;
}

.search-result-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.search-result-title a {
  color: var(--color-heading);
  text-decoration: none;
}

.search-result-title a:hover {
  text-decoration: underline;
}

.search-result-url {
  font-size: 0.8rem;
  color: #8a8680;
  margin-bottom: 0.4rem;
}

.search-result-snippet {
  font-size: 0.92rem;
  color: #4a4a4a;
  line-height: 1.65;
}

/* Highlighted match text */
.search-highlight,
mark {
  background-color: #FFF3B8;
  color: var(--color-text);
  padding: 0.05em 0.15em;
  border-radius: 2px;
  font-style: normal;
}

.search-no-results {
  color: #8a8680;
  font-style: italic;
  margin-top: 1.5rem;
}


/* =============================================================================
   FOOTER
   ============================================================================= */

.site-footer {
  background-color: var(--color-footer-bg);
  border-top: 1px solid var(--color-divider);
  padding: 2rem var(--content-padding);
  margin-top: auto;
}

.site-footer .page-wrapper {
  padding: 0;
  text-align: center;
}

.footer-text {
  font-size: 0.83rem;
  color: #9a9690;
  line-height: 1.65;
}

.footer-text a {
  color: #7a7672;
  text-decoration: none;
}

.footer-text a:hover {
  color: var(--color-link);
  text-decoration: underline;
}

.footer-nav {
  margin-bottom: 0.75rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-nav a {
  font-size: 0.83rem;
  color: #7a7672;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--color-link);
  text-decoration: underline;
}


/* =============================================================================
   404 NOT FOUND PAGE
   ============================================================================= */

.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem var(--content-padding);
  min-height: 40vh;
}

.not-found-code {
  font-family: var(--font-serif);
  font-size: 5rem;
  font-weight: 700;
  color: var(--color-divider);
  line-height: 1;
  margin-bottom: 0.5rem;
  display: block;
}

.not-found h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.not-found p {
  font-size: 0.98rem;
  color: #7a7672;
  max-width: 420px;
  margin: 0 auto 1.5rem;
}

.not-found .btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  background-color: var(--color-heading);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: background-color var(--transition-fast);
}

.not-found .btn:hover {
  background-color: var(--color-link);
  color: #fff;
}


/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */

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

.text-center { text-align: center; }
.text-right  { text-align: right; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }


/* =============================================================================
   BACK TO TOP BUTTON
   ============================================================================= */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background-color: var(--color-heading);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-med), visibility var(--transition-med),
              background-color var(--transition-fast);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 0.75;
  visibility: visible;
}

.back-to-top:hover {
  opacity: 1;
  background-color: var(--color-link);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* =============================================================================
   RESPONSIVE — 768px breakpoint
   ============================================================================= */

@media (max-width: 768px) {

  /* Typography scale down slightly */
  html { font-size: 17px; }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.45rem; }
  h3 { font-size: 1.2rem; }

  /* Header */
  .site-header {
    padding: 1.25rem var(--content-padding) 0;
  }

  .site-title {
    font-size: 1.6rem;
  }

  /* Show hamburger, hide nothing else extra */
  .nav-toggle {
    display: flex;
  }

  /* Nav: collapsed by default on mobile */
  .site-nav {
    overflow: hidden;
    max-height: 0;
    transition: max-height var(--transition-med);
  }

  .site-nav.open {
    max-height: 1200px; /* large enough to never clip */
  }

  /* Flat vertical list */
  .nav-list {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0 1rem;
    border-top: 1px solid var(--color-divider);
  }

  .nav-link {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--color-divider);
    border-bottom-width: 1px; /* override desktop 2px indicator */
  }

  .nav-item:last-child .nav-link {
    border-bottom: none;
  }

  /* Dropdowns: inline, not absolute */
  .nav-item.has-dropdown > .nav-link::after {
    content: ' ▾';
  }

  .nav-item.has-dropdown.open > .nav-link::after {
    content: ' ▴';
  }

  .nav-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    background-color: transparent;
    border-top: none;
  }

  .nav-item.has-dropdown.open > .nav-dropdown {
    display: block;
  }

  .nav-dropdown a {
    padding: 0.6rem 1rem 0.6rem 1.5rem;
    font-size: 0.88rem;
    color: #555;
    border-bottom: 1px solid var(--color-divider);
  }

  .nav-dropdown li:last-child a {
    border-bottom: none;
  }

  /* Touch-friendly: ensure 44px minimum tap targets */
  .nav-link,
  .nav-dropdown a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Main */
  main {
    padding: 1.75rem var(--content-padding);
  }

  /* Search form full width */
  .search-form.open {
    flex-direction: column;
    align-items: stretch;
  }

  .search-submit {
    width: 100%;
  }

  /* Letter sections */
  .letter {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
  }

  /* Footer */
  .site-footer {
    padding: 1.5rem var(--content-padding);
  }

  /* 404 */
  .not-found-code {
    font-size: 4rem;
  }

  .not-found h1 {
    font-size: 1.5rem;
  }
}


/* =============================================================================
   PRINT
   ============================================================================= */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.6;
  }

  .site-header,
  .site-footer,
  .site-nav,
  .search-form,
  .nav-toggle,
  .search-toggle,
  .skip-link,
  .back-to-top {
    display: none !important;
  }

  main {
    padding: 0;
    max-width: 100%;
  }

  a {
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
  }

  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: '';
  }

  blockquote {
    border-left: 2pt solid #999;
    page-break-inside: avoid;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
