:root {
  --cream: #fbf6ec;
  --paper: #fffdf8;
  --ink: #2b2a26;
  --muted: #6f6a5f;
  --line: #e6dccb;
  --evergreen: #1f4d3a;
  --evergreen-dark: #163a2b;
  --cranberry: #9b2335;
  --cranberry-dark: #7c1b2a;
  --gold: #c8a24a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(43, 42, 38, .06), 0 4px 16px rgba(43, 42, 38, .06);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 17px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; color: var(--evergreen-dark); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
a { color: var(--evergreen); }
a:hover { color: var(--cranberry); }

.site-header {
  background: var(--evergreen); color: var(--cream);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 2rem);
}
.site-header a { color: var(--cream); text-decoration: none; }
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--cream); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.site-header nav a[aria-current="page"] { border-bottom: 2px solid var(--gold); }

.page { max-width: 960px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem) 4rem; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
}
.hero { padding: 1rem 0 2rem; text-align: center; }
/* Wide enough for the subtitle on one line on a computer; when it does wrap (phones), split it evenly
   rather than leaving one word alone on the last line. */
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 52rem; margin-left: auto; margin-right: auto; text-wrap: balance; }
.title-line { display: block; }
.btn.btn-hero { font-size: 1.3rem; padding: 1rem 2.25rem; }

/* A festive break between sections: striped red and green rules with a small mark in the middle. */
.divider { display: flex; align-items: center; gap: 1rem; margin: 2rem 0; color: var(--gold); }
.divider::before, .divider::after {
  content: ''; flex: 1; height: 4px; border-radius: 999px;
  background: repeating-linear-gradient(90deg,
    var(--cranberry) 0 18px, transparent 18px 24px, var(--evergreen) 24px 42px, transparent 42px 48px);
}
.divider span { font-size: 1.5rem; line-height: 1; }
/* Same dashes in everyday green and gold, for pages that aren't the Christmas Exchange. */
.divider-plain::before, .divider-plain::after {
  background: repeating-linear-gradient(90deg,
    var(--evergreen) 0 18px, transparent 18px 24px, var(--gold) 24px 42px, transparent 42px 48px);
}
.muted { color: var(--muted); }
.status { color: var(--muted); font-style: italic; }
.error { color: var(--cranberry); font-weight: 600; }
.back { margin: 0 0 1rem; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--evergreen); background: var(--paper);
  color: var(--evergreen); cursor: pointer; text-decoration: none;
}
.btn:hover { background: #eef3ef; color: var(--evergreen-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--cranberry); border-color: var(--cranberry); color: #fff; }
.btn-primary:hover { background: var(--cranberry-dark); color: #fff; }
.btn-danger { border-color: var(--cranberry); color: var(--cranberry); }
.btn-big { font-size: 1.1rem; padding: .8rem 1.5rem; }

.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }

.member-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 2rem; }
.member-list li { border-bottom: 1px solid var(--line); break-inside: avoid; }
.member-list a { display: block; padding: .6rem 0; font-family: var(--serif); font-size: 1.15rem; color: var(--evergreen-dark); text-decoration: none; }
.member-list a:hover { text-decoration: underline; }

.birthdays { list-style: none; padding: 0; margin: 0; }
.birthdays li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.birthdays li:last-child { border-bottom: 0; }
.home-columns { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: start; }
.home-columns > .card { margin-bottom: 0; }
.when { color: var(--muted); }
.when.today { color: var(--cranberry); font-weight: 600; }

.this-year p { margin: .25rem 0; font-size: 1.1rem; }
.details { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; }
.details dt { font-weight: 600; color: var(--muted); }
.details dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tools { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
/* Click-to-edit on member pages. The pencil shows always (phones have no hover), stronger on hover. */
.editable { font: inherit; color: inherit; text-align: left; background: none; border: 0; border-radius: 6px; padding: .05rem .35rem; margin: -.05rem -.35rem; cursor: pointer; white-space: pre-wrap; overflow-wrap: anywhere; }
.editable::after { content: ' ✎'; color: var(--muted); font-size: .8em; opacity: .45; }
.editable:hover, .editable:focus-visible { background: #eef3ef; }
.editable:hover::after, .editable:focus-visible::after { opacity: 1; }
.empty { color: var(--muted); font-style: italic; }
.edit-hint { margin-top: -.25rem; }
.wish-link { margin-top: 1rem; }
.inline-edit { display: grid; gap: .5rem; }
.inline-edit input, .inline-edit select, .inline-edit textarea { font: inherit; width: 100%; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.inline-edit .form-errors:empty { display: none; }
.name-slot { margin-bottom: .5em; }
.name-slot h1 { margin: 0; }
.name-slot .inline-edit input { font-family: var(--serif); font-size: 1.6rem; }

.member-form { display: grid; gap: 1rem; }
.field { display: grid; gap: .3rem; }
.field-label { font-weight: 600; }
.member-form input[type="text"], .member-form input[type="url"], .member-form input[type="number"],
.member-form input[type="email"], .member-form input[type="password"],
.member-form select, .member-form textarea, .modal input:not([type="checkbox"]) {
  font: inherit; width: 100%; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.birthday-inputs { display: grid; grid-template-columns: 2fr 1fr 1.5fr; gap: .5rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.form-actions { display: flex; gap: .75rem; }

.modal {
  border: 0; border-radius: var(--radius); padding: 1.5rem; width: min(32rem, 92vw);
  background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.modal::backdrop { background: rgba(22, 58, 43, .45); }
.modal-buttons { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }
.modal { max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 1.05rem; margin: 1rem 0 .25rem; }
.help-steps { margin: 0 0 .5rem; padding-left: 1.25rem; }
.help-steps li { margin-bottom: .25rem; overflow-wrap: anywhere; }
/* "How do I get the link?": a button that reads as a link. */
.link-help { background: none; border: 0; padding: 0; font: inherit; color: var(--evergreen); text-decoration: underline; cursor: pointer; }
.link-help:hover { color: var(--cranberry); }
.change-list { padding-left: 1.25rem; }
.change-list li { overflow-wrap: anywhere; }

.auth-card { max-width: 30rem; margin: 1rem auto; }
.auth-tabs { display: flex; gap: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.auth-tabs a { padding: .4rem 0; text-decoration: none; font-weight: 600; color: var(--muted); }
.auth-tabs a[aria-current="page"] { color: var(--evergreen-dark); border-bottom: 2px solid var(--cranberry); }
.btn-wide { width: 100%; text-align: center; }
.providers { display: grid; gap: .6rem; margin-top: 1rem; }
.or { text-align: center; color: var(--muted); margin: 0; }
.notice { color: var(--evergreen); font-weight: 600; }
.choices { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; }
.choices legend { font-weight: 600; margin-bottom: .5rem; padding: 0; }
.choices .check { font-weight: 400; }

.welcome { text-align: center; padding: 4rem 0; }
.welcome p { margin-left: auto; margin-right: auto; }
.welcome .form-actions { justify-content: center; flex-wrap: wrap; }

.whose { margin: -.25rem 0 1rem; }

.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table select { font: inherit; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-width: 12rem; }
.family-admin-list { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 2rem; }
.family-admin-list li { break-inside: avoid; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.family-admin-list .check { font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: .25rem; background: #eef3ef; border-radius: 999px; padding: .1rem .3rem .1rem .65rem; font-size: .95rem; }
.chip-x { border: 0; background: none; font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 .25rem; }
.chip-x:hover { color: var(--cranberry); }
.btn-small { padding: .3rem .8rem; font-size: .95rem; }

/* ---------- Family Photos ---------- */
.form-status:empty { margin: 0; }
.inline-field { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-field input { flex: 1 1 16rem; font: inherit; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.album-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.album-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.album-cover { display: block; aspect-ratio: 4 / 3; background: #eef3ef; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-info { padding: .75rem 1rem 1rem; }
.album-info h2 { font-size: 1.15rem; margin: 0 0 .25rem; }
.album-info h2 a { color: var(--evergreen-dark); text-decoration: none; }
.album-info p { margin: 0 0 .35rem; }
.photo-grid { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin-bottom: 1rem; }
.photo-tile { position: relative; aspect-ratio: 1; padding: 0; border: 0; background: #eef3ef; cursor: pointer; overflow: hidden; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The album's chosen cover, marked in its grid. */
.photo-tile.is-cover { outline: 3px solid var(--gold); outline-offset: -3px; }
.photo-tile.is-cover::before { content: 'Cover'; position: absolute; left: .3rem; top: .3rem; z-index: 1; background: var(--gold); color: var(--evergreen-dark); font-size: .75rem; font-weight: 600; padding: 0 .35rem; border-radius: 4px; }
.viewer-cover { margin-top: .5rem; color: var(--ink); }
.photo-tile.is-video::after { content: '▶'; position: absolute; right: .35rem; bottom: .25rem; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.sentinel { min-height: 1px; }
.viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #111; color: #fff; }
.viewer[open] { display: grid; grid-template-columns: 3rem 1fr 3rem; grid-template-rows: 1fr auto; }
.viewer::backdrop { background: #111; }
.viewer-stage { grid-column: 2; display: flex; align-items: center; justify-content: center; min-height: 0; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100vh - 6rem); object-fit: contain; }
.viewer-stage picture { display: contents; }
.viewer-note { color: #ccc; }
.viewer-info { grid-column: 1 / -1; padding: .5rem 1rem 1rem; text-align: center; }
.viewer-info p { margin: .15rem 0; color: #ddd; }
.viewer-info a { color: #fff; }
.viewer-caption { font-weight: 600; }
.viewer-nav, .viewer-close { background: none; border: 0; color: #fff; font-size: 2.5rem; cursor: pointer; }
.viewer-nav:disabled { opacity: .25; cursor: default; }
.viewer-prev { grid-column: 1; grid-row: 1; }
.viewer-next { grid-column: 3; grid-row: 1; }
.viewer-close { position: absolute; top: .5rem; right: .75rem; font-size: 2rem; z-index: 1; }

/* ---------- Family Calendar ---------- */
.dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--dot); margin-right: .4em; vertical-align: baseline; }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid #fff; background: var(--swatch); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink); }
.swatch:disabled { cursor: not-allowed; opacity: .35; background-image: linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%); }
.calendar-key { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.calendar-key li { display: flex; align-items: center; }
.key-status:not(:empty) { margin-left: .35em; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.upcoming-title { margin-top: .5rem; }
.event-list { list-style: none; padding: 0; margin: 0; }
.event { border-left: 4px solid var(--event); padding: .4rem 0 .4rem .75rem; margin-bottom: .6rem; }
.event p { margin: 0; }
.event-when { font-size: .9rem; color: var(--muted); }
.event-title { font-weight: 600; }
.event-notes { white-space: pre-wrap; }
.event-who { font-size: .9rem; }
.month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.month-head h2 { margin: 0; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.month-dayname { font-weight: 600; font-size: .85rem; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.month-cell { min-height: 5.5rem; padding: .25rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.month-cell.other-month { background: #f6f1e6; color: var(--muted); }
.month-cell.today .month-date { background: var(--cranberry); color: #fff; border-radius: 999px; padding: 0 .4em; }
.month-date { font-size: .85rem; align-self: flex-start; }
.event-chip { display: block; width: 100%; text-align: left; font: inherit; font-size: .78rem; border: 0; border-left: 3px solid var(--event); background: #f3efe6; padding: 1px 4px; border-radius: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 640px) {
  .details { grid-template-columns: 1fr; gap: .1rem; }
  .details dd { margin-bottom: .6rem; }
  .birthday-inputs { grid-template-columns: 1fr 1fr; }
  .family-admin-list { columns: 1; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .viewer[open] { grid-template-columns: 2rem 1fr 2rem; }
  .month-cell { min-height: 4rem; }
  .event-chip { font-size: .7rem; }
}
