/* ==========================================================================
   Chestnuts (Arnesby) Limited — replica stylesheet

   Design tokens taken from the live site: ink #1c1915, slate #243246,
   paper #e7eef2, white #fbfcfd, brick #9c3b2e, line #c5d0d8.
   Body copy is Source Sans 3; headings are Source Serif 4.
   ========================================================================== */

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #f7f5f1;
}

a {
  color: inherit;
}

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

:root {
  --ink: #1c1915;
  --slate: #243246;
  --paper: #e7eef2;
  --white: #fbfcfd;
  --brick: #9c3b2e;
  --line: #c5d0d8;
  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

.page {
  --ink: #1c1915;
  --slate: #243246;
  --paper: #e7eef2;
  --white: #fbfcfd;
  --brick: #9c3b2e;
  --line: #c5d0d8;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body), "Segoe UI", sans-serif;
}

.page h1,
.page h2,
.counts strong,
.block legend {
  font-family: var(--font-display), Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */
.mast {
  background: var(--white);
  border-bottom: 3px solid var(--ink);
}

.mastTop,
.nav,
.opening,
.pair,
.hire,
.sheetPage,
.letter,
.footer {
  max-width: 1180px;
  margin: 0 auto;
}

.mastTop {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 18px 28px 8px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo {
  display: block;
  flex: none;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.footerLogo {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin-bottom: 12px;
  background: var(--white);
  border-radius: 3px;
}

.where {
  margin: 0;
  color: var(--slate);
  font-size: 14px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 0 12px;
}

.nav a {
  padding: 12px 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-top: 1px solid var(--line);
}

.nav a:hover,
.nav a:focus-visible {
  background: var(--paper);
}

.phone {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Small labels
   -------------------------------------------------------------------------- */
.index,
.kicker {
  margin: 0 0 8px;
  color: var(--brick);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */
.opening {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 36px;
  padding: 48px 28px 28px;
  background: var(--white);
}

.opening h1,
.sheetPage h1,
.letter h1 {
  margin: 0 0 14px;
  font-size: clamp(32px, 3.4vw, 46px);
  line-height: 1.08;
  max-width: 18ch;
}

.opening p,
.lede,
.letter p,
.pair p,
.houseRows p,
.lines p,
.roles p {
  font-size: 17px;
  line-height: 1.55;
}

.counts {
  display: flex;
  gap: 28px;
  margin-top: 28px;
}

.counts p {
  margin: 0;
}

.counts strong {
  display: block;
  color: var(--brick);
  font-size: 42px;
  line-height: 1;
}

.counts span {
  display: block;
  margin-top: 4px;
  font-weight: 600;
}

.aside {
  align-self: end;
  padding: 20px;
  background: var(--slate);
  color: white;
}

.aside p {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.5;
}

.aside a,
.pair a,
.hire a,
.roles a,
.sheetPage > a {
  color: inherit;
  font-weight: 600;
}

.banner {
  margin: 0;
  background: var(--ink);
}

.banner img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  object-position: center 40%;
}

.banner figcaption {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 28px 16px;
  color: #d5dde4;
  font-size: 14px;
}

.pair {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 48px 28px;
}

.pair article {
  background: var(--white);
  padding: 8px 8px 22px;
}

.pair h2,
.houseRows h2,
.lines h2,
.roles h2,
.receipt h2 {
  margin: 8px 14px 10px;
  font-size: 28px;
  line-height: 1.12;
}

.pair p,
.pair .index {
  margin-left: 14px;
  margin-right: 14px;
}

.pair img,
.houseRows img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.hire {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 0;
  padding: 36px 28px 48px;
  background: var(--slate);
  color: white;
  max-width: none;
  padding-left: max(28px, calc((100% - 1180px) / 2 + 28px));
  padding-right: max(28px, calc((100% - 1180px) / 2 + 28px));
}

.hire > div {
  max-width: 40rem;
}

.hire .index {
  color: #f0b7ae;
}

.hire h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.12;
}

/* --------------------------------------------------------------------------
   Interior pages
   -------------------------------------------------------------------------- */
.sheetPage {
  padding: 48px 28px 72px;
}

.lede {
  max-width: 42rem;
}

.houseRows {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 28px;
}

.houseRows article {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 22px;
  background: var(--white);
}

.houseRows h2,
.houseRows p,
.houseRows ul {
  margin-left: 0;
  margin-right: 18px;
}

.houseRows ul,
.roles ul,
.letter ul {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.5;
}

.lines {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
}

.lines li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.lines span {
  color: var(--brick);
  font-weight: 600;
}

.lines h2 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.15;
}

.lines p {
  margin: 0;
}

.note {
  max-width: 42rem;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 3px solid var(--brick);
}

/* --------------------------------------------------------------------------
   Rooms sheet
   -------------------------------------------------------------------------- */
.sheet {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 18px;
  margin-top: 24px;
}

.sheet figure {
  margin: 0;
  background: var(--white);
}

.sheet img {
  display: block;
  width: 100%;
  height: min(68vh, 640px);
  object-fit: cover;
}

.sheet figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 14px;
  font-weight: 600;
}

.sheet figcaption span {
  font-weight: 600;
}

.sheetHouse {
  color: var(--brick);
}

.sheetCaption {
  color: var(--ink);
}

.sheet ol {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(68vh, 640px);
  overflow: auto;
  background: var(--white);
}

.sheet button {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.sheet button[aria-current="true"] {
  background: var(--slate);
  color: white;
}

.sheet small {
  color: var(--brick);
  font-weight: 600;
}

.sheet button[aria-current="true"] small {
  color: #f0b7ae;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.letter {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 32px;
  padding: 48px 28px 72px;
}

.letter a {
  color: var(--brick);
  font-weight: 600;
}

.form {
  background: var(--white);
  padding: 18px 18px 22px;
  border-left: 6px solid var(--brick);
}

.block {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.block legend {
  margin-bottom: 12px;
  font-size: 20px;
  line-height: 1.2;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field,
.wide {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wide {
  grid-column: 1 / -1;
}

.field span,
.wide span,
.tick strong {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field i,
.wide i {
  color: var(--brick);
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}

.field input,
.field select,
.wide input,
.wide select,
.wide textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
  font: inherit;
}

.hint {
  color: #4d5964;
  font-size: 14px;
  line-height: 1.4;
}

.field em,
.wide em,
.formError {
  color: var(--brick);
  font-style: normal;
  font-size: 14px;
}

.tick {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 12px;
  background: var(--paper);
}

.tick input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brick);
}

.tick span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  line-height: 1.4;
}

.send {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 16px;
  border: 0;
  background: var(--ink);
  color: white;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.send:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* --------------------------------------------------------------------------
   Roles
   -------------------------------------------------------------------------- */
.roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

.roles article {
  padding: 18px;
  background: var(--white);
  border-top: 6px solid var(--ink);
}

.roles article:nth-child(2) {
  border-top-color: var(--brick);
}

.roles h2 {
  margin: 0 0 8px;
}

.openingFacts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 0 10px;
  font-size: 15px;
}

.vacancyCount {
  color: var(--ink);
  font-weight: 700;
}

.vacancyNone,
.applyOff {
  color: #8b939c;
  font-weight: 700;
}

.deadline,
.closedNote {
  color: #5c6770;
}

.applyOff {
  font-weight: 600;
  cursor: not-allowed;
}

.closedNote {
  margin: 8px 0 0;
}

/* Receipt */
.receipt h2 {
  margin-left: 0;
}

.receipt table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.receipt th,
.receipt td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.receipt th {
  width: 12rem;
  color: var(--slate);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reference {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1fr 1.2fr;
  gap: 22px;
  padding: 28px;
  background: var(--ink);
  color: #d5dde4;
  font-size: 14px;
  line-height: 1.5;
}

.footer strong {
  color: white;
}

.footer p {
  margin: 4px 0;
}

.footer a {
  color: #f0b7ae;
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */
.adminMain {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px 72px;
}

.adminHeading {
  margin: 0 0 18px;
  font-size: 32px;
}

.adminLogin {
  max-width: 30rem;
  margin: 40px auto;
}

.adminLogin h1 {
  margin: 0 0 18px;
  font-size: 32px;
}

.adminCards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.adminCard {
  display: block;
  padding: 18px 20px;
  background: var(--white);
  border-top: 6px solid var(--brick);
  text-decoration: none;
  color: inherit;
}

.adminCard strong {
  display: block;
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1;
  color: var(--brick);
}

.adminCard span {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.adminCard em {
  display: block;
  margin-top: 10px;
  color: var(--slate);
  font-style: normal;
  font-size: 14px;
}

.adminTools {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

.adminTools h1 {
  margin: 0;
}

.adminFilters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.adminFilters a {
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 600;
}

.adminFilters a[aria-current="page"] {
  background: var(--slate);
  color: white;
  border-color: var(--slate);
}

.adminTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.adminTable th,
.adminTable td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.adminTable th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate);
}

.adminTable tr:last-child td {
  border-bottom: 0;
}

.adminTable small {
  color: #5c6770;
}

.adminActions {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}

.editLink {
  color: var(--brick);
  font-weight: 600;
}

.deleteBtn {
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--brick);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.deleteBtn:hover {
  text-decoration: underline;
}

.adminEmpty {
  padding: 22px;
  background: var(--white);
}

.adminPairs {
  width: 100%;
  max-width: 46rem;
  border-collapse: collapse;
  background: var(--white);
}

.adminPairs th,
.adminPairs td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.adminPairs th {
  width: 14rem;
  color: var(--slate);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.adminPairs .notes {
  white-space: pre-wrap;
}

.adminActionsRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 22px 0;
}

.adminActionsRow form {
  margin: 0;
}

.ghostBtn,
.save {
  display: inline-block;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.ghostBtn {
  border: 2px solid var(--slate);
  background: transparent;
  color: var(--slate);
}

.ghostBtn:hover {
  background: var(--white);
}

.save {
  border: 0;
  background: var(--ink);
  color: white;
}

.adminHint {
  padding: 12px 14px;
  background: var(--white);
  border-left: 4px solid var(--slate);
}

.statusPill {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #cfd8dd;
  color: var(--slate);
}

.statusPill[data-status="new"] {
  background: #f2c9c1;
  color: #7d2a1c;
}

.statusPill[data-status="handled"],
.statusPill[data-status="sent"] {
  background: #cfe0d4;
  color: #1f5136;
}

.statusPill[data-status="failed"] {
  background: #f2c9c1;
  color: #7d2a1c;
}

.navBadge {
  display: inline-block;
  min-width: 22px;
  padding: 2px 7px;
  background: var(--brick);
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.flash {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.flash li {
  padding: 12px 14px;
  background: var(--white);
  border-left: 4px solid var(--brick);
  font-weight: 600;
}

.logoutForm {
  display: flex;
  margin: 0 0 0 auto;
}

.logoutForm button {
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.logoutForm button:hover {
  background: var(--paper);
}

/* Email history */
.emailLogTitle {
  margin: 34px 0 12px;
  font-family: var(--font-display);
  font-size: 22px;
}

.emailLog {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 46rem;
}

.emailLog li {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--white);
  border-left: 4px solid var(--slate);
}

.emailLogHead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.emailLogHead strong {
  flex: 1 1 auto;
  min-width: 12rem;
}

.emailLogHead time {
  color: #5c6770;
  font-size: 14px;
  white-space: nowrap;
}

.emailLogMeta {
  margin: 8px 0 0;
  color: #5c6770;
  font-size: 14px;
}

.emailLog details {
  margin-top: 8px;
}

.emailLog summary {
  cursor: pointer;
  color: var(--brick);
  font-size: 14px;
  font-weight: 600;
}

.emailLogBody {
  margin: 10px 0 0;
  padding: 12px;
  background: var(--paper);
  font-family: inherit;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   Narrow screens
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .mastTop {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .opening,
  .pair,
  .houseRows article,
  .sheet,
  .letter,
  .roles,
  .footer,
  .grid,
  .adminCards {
    grid-template-columns: 1fr;
  }

  .phone {
    margin-left: 0;
  }

  .opening h1,
  .sheetPage h1,
  .letter h1 {
    font-size: 32px;
  }

  .hire {
    flex-direction: column;
    align-items: flex-start;
  }

  .sheet img,
  .sheet ol {
    height: auto;
    max-height: none;
  }

  .sheet img {
    height: 240px;
  }

  .mastTop,
  .opening,
  .pair,
  .sheetPage,
  .letter,
  .footer,
  .adminMain {
    padding-left: 16px;
    padding-right: 16px;
  }
}
