/* ============================================================
 *  Hearthside Resident Directory
 *  Built for large type, high contrast, and big touch targets.
 *  ============================================================ */

:root {
  /* Palette: painted plaster, pine enamel, brass fittings */
  --ink: #14211d;
  --ink-soft: #3f4f49;
  --porcelain: #f1f4f1;
  --white: #ffffff;
  --pine: #1e5b47;
  --pine-dark: #143f31;
  --brass: #8a5c0c;
  --brass-bright: #f0b429;
  --line: #c6d1c9;
  --stripe: #e9eeea;

  --radius: 12px;
  --focus: 0 0 0 4px var(--brass-bright), 0 0 0 7px var(--ink);
}

/* Text size control: everything downstream is in rem */
html {
  font-size: 20px;
  background-color: #29332f;
  -webkit-text-size-adjust: 100%;
}
html[data-size='large'] { font-size: 24px; }
html[data-size='huge'] { font-size: 28px; }

/* Dimmed, vignetted photograph of the building */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background-image: url("images/hsIMG.webp");
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
}
body::after {
  background:
  radial-gradient(ellipse 85% 70% at 50% 40%, rgba(12, 20, 17, 0) 0%, rgba(12, 20, 17, 0.35) 55%, rgba(9, 14, 12, 0.82) 100%),
  linear-gradient(rgba(16, 26, 22, 0.5), rgba(16, 26, 22, 0.58));
}

body {
  margin: 0;
  padding: clamp(0.75rem, 3vw, 2rem) clamp(0.5rem, 3vw, 2rem) 3rem;
  font-family: 'Atkinson Hyperlegible', 'Verdana', sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
}

.page {
  max-width: 54rem;
  margin: 0 auto;
  background-color: var(--porcelain);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: var(--white);
  color: var(--ink);
  padding: 0.75rem 1rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 700;
  z-index: 10;
}
.skip-link:focus { left: 1rem; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

/* ---------- Masthead ---------- */
.masthead {
  padding: clamp(1.25rem, 4vw, 2.25rem) clamp(1rem, 4vw, 2.25rem) 1.5rem;
  text-align: center;
  border-bottom: 3px solid var(--ink);
  background: linear-gradient(var(--white), var(--porcelain));
}

.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
}

.masthead h1 {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  line-height: 1;
  margin: 0.35rem 0 0.6rem;
  color: var(--pine);
  letter-spacing: -0.015em;
}

.lede {
  margin: 0 auto;
  max-width: 30ch;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

/* ---------- Search plate ---------- */
.plate {
  background-color: var(--pine);
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 4vw, 2.25rem);
  border-bottom: 3px solid var(--ink);
  color: var(--white);
}

.plate-heading {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0 0 1.25rem;
  color: var(--white);
}

.steps {
  display: grid;
  gap: 1.25rem;
}

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background-color: var(--brass-bright);
  color: var(--pine-dark);
  border: 3px solid var(--pine-dark);
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}

.step-body { flex: 1 1 auto; min-width: 0; }

.step-body label {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

#searchType,
#searchbar {
width: 100%;
box-sizing: border-box;
min-height: 3.2rem;
padding: 0.65rem 0.85rem;
font-family: inherit;
font-size: 1.1rem;
color: var(--ink);
background-color: var(--white);
border: 3px solid var(--ink);
border-radius: 10px;
}

#searchType {
appearance: none;
background-image: linear-gradient(45deg, transparent 50%, var(--pine) 50%),
linear-gradient(135deg, var(--pine) 50%, transparent 50%);
background-position: right 1.4rem center, right 0.85rem center;
background-size: 0.6rem 0.6rem, 0.6rem 0.6rem;
background-repeat: no-repeat;
padding-right: 3rem;
cursor: pointer;
}

#searchbar::placeholder {
color: #6c7a74;
font-style: italic;
}

.plate-note {
  margin: 1.25rem 0 1rem;
  font-size: 0.95rem;
  color: #cfe3d9;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  background-color: var(--white);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { background-color: var(--brass-bright); }

.btn-primary {
  background-color: var(--pine);
  color: var(--white);
}
.btn-primary:hover {
  background-color: var(--pine-dark);
  color: var(--white);
}

.btn-quiet {
  background-color: transparent;
  color: var(--white);
  border-color: var(--white);
}
.btn-quiet:hover {
  background-color: var(--white);
  color: var(--pine-dark);
}

.btn-size[aria-pressed='true'] {
  background-color: var(--pine);
  color: var(--white);
}

/* ---------- Results ---------- */
.results {
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 4vw, 2.25rem);
}

.notice {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  background-color: #fdf3d8;
  border: 3px solid var(--brass);
  border-radius: 10px;
}

.tally {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--pine-dark);
}

#directory {
width: 100%;
border-collapse: collapse;
background-color: var(--white);
border: 3px solid var(--ink);
border-radius: 10px;
overflow: hidden;
}

#directory th {
padding: 0;
background-color: var(--pine);
border-bottom: 3px solid var(--ink);
text-align: left;
}

#directory th + th { border-left: 2px solid rgba(255, 255, 255, 0.25); }

.sort {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.9rem 0.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  color: var(--white);
  background: none;
  border: 0;
  cursor: pointer;
}
.sort:hover { background-color: var(--pine-dark); }
.sort .arrow { font-size: 0.85rem; color: var(--brass-bright); }

#directory td {
padding: 0.9rem 0.75rem;
font-size: 1rem;
border-bottom: 2px solid var(--line);
vertical-align: top;
}

#directory tbody tr:nth-child(even) { background-color: var(--stripe); }
#directory tbody tr:last-child td { border-bottom: 0; }

#directory a {
color: var(--pine-dark);
font-weight: 700;
text-decoration-thickness: 2px;
text-underline-offset: 3px;
}
#directory a:hover { background-color: var(--brass-bright); }

.blank-slate {
  margin: 1.25rem 0 0;
  padding: 1.5rem;
  font-size: 1.05rem;
  text-align: center;
  background-color: var(--white);
  border: 3px dashed var(--ink-soft);
  border-radius: 10px;
}

/* ---------- Snapshot ---------- */
.snapshot {
  margin: 0;
  padding: 0 clamp(1rem, 4vw, 2.25rem) clamp(1.25rem, 4vw, 2rem);
  text-align: center;
}
.snapshot img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 3px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
  background-color: var(--stripe);
}
.snapshot figcaption {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- Footer tools ---------- */
.footer {
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 4vw, 2.25rem);
  border-top: 3px solid var(--ink);
  background-color: var(--stripe);
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tool-label {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 7rem;
}

.size-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.staff {
  margin-top: 1.5rem;
  background-color: var(--white);
  border: 3px solid var(--ink);
  border-radius: 10px;
}

.staff > summary {
  padding: 0.9rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.staff[open] > summary { border-bottom: 3px solid var(--ink); }

.staff-body { padding: 1rem; }
.staff-body p { margin: 0 0 1rem; font-size: 0.95rem; }

.file-btn { cursor: pointer; }
#fileInput:focus-visible + .file-btn { box-shadow: var(--focus); }

.file-status {
  margin: 1rem 0 0 !important;
  font-weight: 700;
}
.file-status[data-state='error'] { color: #9a1414; }
.file-status[data-state='ok'] { color: var(--pine-dark); }

/* ---------- Small screens: rows become stacked cards ---------- */
@media (max-width: 46rem) {
  #directory thead { display: none; }
  #directory,
  #directory tbody,
  #directory tr,
  #directory td { display: block; width: 100%; box-sizing: border-box; }

  #directory tr {
  border-bottom: 3px solid var(--ink);
  padding: 0.35rem 0;
  }
  #directory tbody tr:last-child { border-bottom: 0; }

  #directory td {
  border-bottom: 0;
  padding: 0.35rem 0.9rem;
  }
  #directory td::before {
  content: attr(data-label) ': ';
  font-weight: 700;
  color: var(--pine-dark);
  }
  #directory td:first-child {
  font-size: 1.15rem;
  font-weight: 700;
  padding-top: 0.75rem;
  }
  #directory td:first-child::before { content: ''; }
  #directory td:last-child { padding-bottom: 0.75rem; }
}

/* ---------- Printing ---------- */
@media print {
  html { font-size: 12pt; background: none; }
  body { padding: 0; color: #000; }
  body::before,
  body::after { display: none; }
  .page {
    max-width: none;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .plate,
  .snapshot,
  .footer,
  .notice,
  .skip-link { display: none; }
  .masthead { border-bottom: 2pt solid #000; }
  #directory th { background: none; border-bottom: 2pt solid #000; }
  .sort { color: #000; }
  #directory a { color: #000; text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.updated-line { margin: -0.5rem 0 1rem; font-size: 0.85rem; color: var(--ink-soft); }

.conn-status {
  margin: 0 0 1rem !important;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  background-color: var(--stripe);
  border: 2px solid var(--line);
}
.conn-status[data-state='ok']    { color: var(--pine-dark); border-color: var(--pine); background-color: #e6f1eb; }
.conn-status[data-state='error'] { color: #7a1010; border-color: #b03535; background-color: #fdeaea; }

.auth-form .field { margin-bottom: 1rem; }
.auth-form label,
.staff-body label:not(.btn) { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.35rem; }

.text-field {
  width: 100%; box-sizing: border-box; min-height: 3rem;
  padding: 0.6rem 0.8rem;
  font-family: inherit; font-size: 1rem; color: var(--ink);
  background-color: var(--white); border: 3px solid var(--ink); border-radius: 10px;
}

.form-error {
  margin: 1rem 0 0 !important; padding: 0.6rem 0.75rem;
  font-size: 0.9rem; font-weight: 700; color: #7a1010;
  background-color: #fdeaea; border: 3px solid #b03535; border-radius: 8px;
}

.fine-print { margin: 1rem 0 0 !important; font-size: 0.8rem !important; color: var(--ink-soft); }
.whoami { margin: 0 0 1rem !important; font-weight: 700; color: var(--pine-dark); }
#staffTools .btn { margin-right: 0.5rem; }

[hidden] { display: none !important; }
