/* Layout and components. Colours, type and radius come from tokens; the skin (base elements,
   cards, buttons, form controls) is in theme.css, loaded before this file. */
p { margin: 0 0 var(--space-3); }
img { max-width: 100%; height: auto; }

.container { width: 100%; max-width: 720px; margin: 0 auto; padding: var(--space-5) var(--space-4); }
.container--wide { max-width: 1180px; }


.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }
.small { font-size: var(--step-small); }
.btn--small { min-height: var(--tap); padding: 0 var(--space-4); }
.btn--quiet { border-color: transparent; background: none; color: var(--muted); }
.btn--quiet:hover { background: var(--accent-soft); color: var(--text-strong); }

/* ---- Two columns from 1024px: the page's own content, and a side column of what is coming up.
   Phones get one column (Home hides its side column: the Family tab carries the same things). */
.page-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
.page-cols__main { min-width: 0; }
.page-cols__side { min-width: 0; }
.page-cols__side > * + * { margin-top: var(--space-4); }
.home__side { display: none; }
@media (min-width: 1024px) {
  .page-cols { grid-template-columns: minmax(0, 700px) 340px; justify-content: center; align-items: start; gap: var(--space-7); }
  .page-cols__side { position: sticky; top: 88px; }
  .home__side { display: block; }
}
.side-card { padding: var(--space-4) calc(var(--card-pad) * 1.25) var(--space-3); background: var(--card-bg); border: var(--card-edge); border-radius: var(--card-radius); box-shadow: var(--card-elev); }
.side-card h2 { margin: 0; font-size: var(--step-name); }
.side-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.side-card__more { margin: 0; }
.side-card__more a, .event-past a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; }
.side-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; }
.side-row__text { display: flex; flex-direction: column; min-width: 0; }
.side-row__title { font-weight: 600; color: var(--text-strong); line-height: 1.35; overflow-wrap: anywhere; }
.side-row__meta { font-size: var(--step-small); }
.side-links { display: flex; flex-direction: column; padding: var(--space-2); }
.side-link { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text); font-weight: 600; text-decoration: none; }
.side-link:hover { background: var(--accent-soft); color: var(--text-strong); }
.side-link:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

/* ---- Empty states: one line of encouragement and the one action ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-7) var(--space-5); text-align: center; background: var(--card-bg); border: var(--card-edge); border-radius: var(--card-radius); }
.empty__line { margin: 0; max-width: 30ch; font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); font-size: var(--step-name); color: var(--text-strong); text-wrap: balance; }
.empty__hint { margin: 0; max-width: 42ch; }
.empty-line { margin: 0; color: var(--muted); }
.card { padding: var(--space-5) calc(var(--card-pad) * 1.25); }

.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; }
.field .help { font-size: var(--step-small); }
.field .error { font-size: var(--step-small); }

.btn--block { width: 100%; }
.auth { max-width: 440px; margin: var(--space-5) auto 0; }
.auth .error { color: var(--danger); font-size: var(--step-small); margin: 0; }

@media (min-width: 640px) {
  .container { padding-block: var(--space-6); }
}

.messages { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.messages li { padding: var(--space-3) var(--space-4); }
.messages li + li { margin-top: var(--space-2); }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.page-head h1 { margin: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.birthday-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; }
.people > li + li { margin-top: var(--space-3); }
.person { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) 0; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.birthday-row .muted { flex: none; }
.person__body { flex: 1; min-width: 0; }
.person__name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font-weight: 650; min-width: 0; }
.person__label { overflow-wrap: anywhere; min-width: 0; }
.pending .person__name { flex-wrap: nowrap; }
.pending .person__name .truncate { flex: 0 1 auto; }
.person__email { font-size: var(--step-small); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 650;
}
.badge { display: inline-block; padding: 0 var(--space-2); font-size: var(--step-small); font-weight: 600; vertical-align: middle; }

.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pending { display: flex; align-items: center; gap: var(--space-3); }
.pending + .pending { padding-top: var(--space-3); border-top: 1px solid var(--line); }
.copy-row { display: flex; flex-direction: column; gap: var(--space-2); }
.copy-row input { width: 100%; min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius); }
@media (min-width: 520px) { .copy-row { flex-direction: row; } .copy-row input { flex: 1; } }

/* ---- App shell ---- */
.topbar { background: var(--bar-bg); border-bottom: var(--bar-edge); position: sticky; top: 0; z-index: 20; }
.topbar__inner {
  display: flex; align-items: center; gap: var(--space-4);
  max-width: 1180px; margin: 0 auto; padding: var(--space-2) var(--space-4); min-height: 56px;
}
.topbar--minimal { display: flex; justify-content: center; align-items: center; min-height: 56px; padding: var(--space-2) var(--space-4); position: static; }
.brand { font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: calc(var(--step-name) * var(--title-scale)); letter-spacing: var(--heading-tracking); color: var(--bar-ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.topbar--minimal .brand { flex: none; max-width: 100%; }
.brand:hover { color: var(--bar-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.brand:focus-visible, .appnav__link:focus-visible, .account__button:focus-visible, .account__item:focus-visible, .nav-card:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm);
}

/* Navigation: bottom tab bar on phones, inline in the top bar from 768px */
.appnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.appnav__list { display: flex; list-style: none; margin: 0; padding: 0; }
.appnav__list > li { flex: 1; min-width: 0; }
.appnav__link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: var(--space-2) var(--space-1);
  color: var(--muted); text-decoration: none; font-size: var(--step-small); font-weight: 600;
}
.appnav__link:hover { color: var(--text); }
.appnav__link[aria-current="page"] { color: var(--accent-strong); }
.appnav__link[aria-current="page"] .appnav__icon { stroke-width: 2.3; }
.has-tabbar main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }

/* Account menu (a <details>, so it works without JavaScript) */
.account { position: relative; flex: none; }
.account summary { list-style: none; }
.account summary::-webkit-details-marker { display: none; }
.account__button { display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-2); border-radius: var(--radius); cursor: pointer; color: var(--bar-ink); font-weight: 600; }
.account__button:hover { background: var(--bar-hover); }
.account__caret { color: var(--bar-nav); }
.account__name { position: absolute; width: 1px; height: 1px; clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap; max-width: 14ch; text-overflow: ellipsis; }
.account__caret { color: var(--muted); }
.avatar--sm { width: 32px; height: 32px; font-size: var(--step-small); }
.account__menu {
  position: absolute; right: 0; top: calc(100% + var(--space-1)); min-width: 220px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: var(--space-2);
}
.account__who { padding: var(--space-2) var(--space-3); font-size: var(--step-small); overflow-wrap: anywhere; }
.account__item {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text);
  font: inherit; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer;
}
.account__item:hover { background: var(--accent-soft); }

@media (min-width: 768px) {
  .appnav { position: static; border: 0; background: none; padding: 0; flex: none; }
  .appnav__list { gap: var(--space-1); }
  .appnav__list > li { flex: none; }
  .appnav__link { flex-direction: row; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-3); font-size: var(--step-small); border-radius: var(--radius); color: var(--bar-nav); }
  .appnav__link:hover { background: var(--bar-hover); color: var(--bar-ink); }
  .appnav__link[aria-current="page"] { background: var(--nav-active-bg); color: var(--bar-ink); font-weight: var(--nav-weight); border-radius: var(--radius) var(--radius) 0 0; box-shadow: inset 0 calc(-1 * var(--nav-line)) 0 currentColor; }
  .appnav__icon { width: 20px; height: 20px; }
  .brand { flex: none; margin-right: var(--space-3); max-width: 28ch; }
  .topbar__inner .appnav { margin-right: auto; }
  .account__name { position: static; width: auto; height: auto; clip: auto; }
  .has-tabbar main { padding-bottom: var(--space-6); }
}

/* Settings */
.crumb { margin: 0; font-size: var(--step-small); }
.crumb a { text-decoration: none; }
/* More and Settings: one surface, one row per place, an icon, the name and a line about it */
.nav-cards > li + li { margin-top: var(--space-3); }
.nav-list { background: var(--card-bg); border: var(--card-edge); border-radius: var(--card-radius); box-shadow: var(--card-elev); overflow: hidden; }
.nav-list > li + li { border-top: 1px solid var(--line); }
.nav-card { display: flex; align-items: center; gap: var(--space-4); color: var(--text); text-decoration: none; min-height: 72px; padding: var(--space-3) var(--space-4); }
.nav-card:hover { background: var(--accent-soft); }
.nav-card > .icon { flex: none; color: var(--accent-strong); }
.nav-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-card__title { font-weight: 650; font-size: var(--step-name); color: var(--text-strong); }
.nav-card__chevron { flex: none; color: var(--muted); }
.more__signout { text-align: center; }
@media (min-width: 1024px) { .nav-list--grid { display: grid; grid-template-columns: 1fr 1fr; } .nav-list--grid > li { border-top: 1px solid var(--line); } .nav-list--grid > li:nth-child(-n+2) { border-top: 0; } }
.notice { margin: 0; padding: var(--space-3) var(--space-4); }

.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.choices legend { font-weight: 650; padding: 0; margin-bottom: var(--space-1); }
.choice { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); min-height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.choice input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice__body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.choice__title { font-weight: 600; }
.choice__help { font-size: var(--step-small); }

/* Page rhythm */
@media (min-width: 640px) { .card { padding: var(--space-6) calc(var(--card-pad) * 2); } }

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

/* ---- The Family page: birthdays as the headline, then a portrait of everyone ---- */
.birthdays h2, .family-page h2 { margin: 0 0 var(--space-3); }
.birthday-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
@media (min-width: 640px) { .birthday-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.birthday-card { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--card-bg); border: var(--card-edge); border-radius: var(--card-radius); box-shadow: var(--card-elev); }
.birthday-card--soon { background: var(--accent-soft); }
.birthday-card__text { min-width: 0; }
.birthday-card__line { margin: 0; font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); font-size: var(--step-name); line-height: 1.25; color: var(--text-strong); overflow-wrap: anywhere; }
.birthday-card__date { margin: var(--space-1) 0 0; font-size: var(--step-small); }
.portraits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--space-4); }
@media (min-width: 640px) { .portraits { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .portraits { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.portrait { position: relative; display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.portrait > .avatar { width: 100% !important; height: auto !important; aspect-ratio: 1; border-radius: var(--radius-lg); font-size: clamp(2.5rem, 9vw, 3.5rem) !important; }
.portrait__text { display: flex; flex-direction: column; min-width: 0; }
.portrait__name { font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); font-size: var(--step-name); line-height: 1.25; color: var(--text-strong); overflow-wrap: anywhere; }
.portrait__meta { color: var(--muted); font-size: var(--step-small); overflow-wrap: anywhere; }
.portrait .menu--on-media { top: var(--space-2); right: var(--space-2); }
.manage-people__intro { margin: 0; }
.manage-people h3 { margin: 0; }
.manage-list > li + li { border-top: 1px solid var(--line); }
.manage-list .pending { padding: var(--space-3) 0; }

/* Events */
.event-list > li + li { border-top: 1px solid var(--line); }
.event-row__link { display: flex; align-items: center; gap: var(--space-3); min-height: 56px; padding: var(--space-2) 0; color: inherit; text-decoration: none; }
a.event-row__link:hover .event-row__title { color: var(--accent-strong); }
a.event-row__link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.event-row__body { display: flex; flex-direction: column; min-width: 0; }
.event-row__title { font-weight: 650; overflow-wrap: anywhere; }
.event-row__meta { font-size: var(--step-small); overflow-wrap: anywhere; }
.date-badge { flex: none; width: 52px; height: 56px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.date-badge__month { font-size: var(--step-small); font-weight: 700; }
.date-badge__day { font-family: var(--font-heading); font-size: var(--step-h2); font-weight: var(--heading-weight); }
.event__head { display: flex; align-items: center; gap: var(--space-3); }
.event__title { margin: 0; overflow-wrap: anywhere; }
.event p { margin: 0; }
.event__description { overflow-wrap: anywhere; }
.event-past { margin: 0; }

/* Comments and hearts: the heart and a comment count on one line; the count opens the thread (a
   <details> in the feed, always open on a post's own page). Delete lives in each comment's "⋯". */
.social { position: relative; margin-top: var(--space-1); }
.social__heart { position: absolute; left: calc(-1 * var(--space-2)); top: 0; margin: 0; z-index: 1; }
.heart-btn { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); min-width: 72px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius); background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.heart-btn:hover { background: var(--accent-soft); }
.heart-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.heart-btn__icon { fill: none; }
.heart-btn[aria-pressed="true"] { color: var(--danger); }
.heart-btn[aria-pressed="true"] .heart-btn__icon { fill: currentColor; }
.heart-btn:disabled { cursor: default; opacity: 0.7; }
.social__thread > summary { list-style: none; }
.social__thread > summary::-webkit-details-marker { display: none; }
.social__comments-link { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); margin-left: 72px; padding: 0 var(--space-3); border-radius: var(--radius); color: var(--muted); font-weight: 600; cursor: pointer; }
.social__comments-link:hover, .social__thread[open] > .social__comments-link { background: var(--accent-soft); color: var(--text-strong); }
.social__comments-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.social__panel { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-2) 0 var(--space-3); }
.social__thread--open { padding-top: var(--tap); }
.social--full .social__panel { padding-top: var(--space-3); }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.comments[hidden] { display: none; }
.comment { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius); background: var(--surface-2); overflow-wrap: anywhere; }
.comment__text { flex: 1; min-width: 0; padding-block: var(--space-1); }
.comment__author { font-weight: 700; color: var(--text-strong); margin-right: var(--space-1); }
.comment__body { display: inline; }
.comment__time { color: var(--muted); font-size: var(--step-small); margin-left: var(--space-2); white-space: nowrap; }
.comment__menu { margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-2)) 0 0; }
.comment__confirm { margin: 0; }
.social__more { margin: 0; }
.social__more a { display: inline-flex; align-items: center; min-height: var(--tap); }
.comment-form { display: flex; gap: var(--space-2); align-items: flex-end; }
.comment-form textarea { flex: 1; min-width: 0; resize: vertical; border-radius: var(--radius); }
.comment-error { margin: 0; }
.comment-quote { overflow-wrap: anywhere; padding: var(--space-3); border-left: 3px solid var(--line-strong); margin: 0; }

/* Storage card */
.storage__figure { margin: 0; font-size: var(--step-name); }
.storage-bar { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; }
.storage-bar__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.storage-bar--warn .storage-bar__fill { background: var(--danger); }
.storage__warning { margin: 0; color: var(--danger); font-weight: 600; }

/* Theme specimen (developer page, settings/template/specimen/) */
.specimen__themes { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.specimen__themes .btn { padding: 0 var(--space-4); }
.specimen__swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); }
.specimen__fill-42 { width: 42%; }
.specimen__fill-93 { width: 93%; }
/* The lightbox sample is a contained box with the lightbox tokens, never the fixed .lightbox overlay. */
.specimen__lightbox { position: relative; display: flex; flex-direction: column; height: 240px; padding-bottom: var(--space-3); background: var(--viewer); color: var(--on-media); color-scheme: dark; border-radius: var(--radius); overflow: hidden; }
.specimen__lightbox .pv__frame { flex: 1; min-height: 0; }
.specimen__lightbox .pv__who { padding: 0 var(--space-4); }
.specimen__photo { display: block; width: 160px; height: 120px; border-radius: var(--radius-sm); background: var(--accent-soft); }

/* Settings: template gallery, accent swatches, preview bar, cover photo editor, photo picker */
:root { --preview-h: 92px; }
@media (min-width: 640px) { :root { --preview-h: 60px; } }
.preview-bar {
  position: sticky; top: 0; z-index: 30; box-sizing: border-box; min-height: var(--preview-h);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-4); background: var(--accent-soft); color: var(--text-strong); border-bottom: 2px solid var(--accent);
}
.preview-bar__text { margin: 0; flex: 1 1 14ch; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-bar__actions { display: flex; gap: var(--space-2); }
.has-preview .topbar { top: var(--preview-h); }
.container--wide { max-width: 1120px; }

.swatches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.swatch, .picker__item { position: relative; cursor: pointer; }
.swatch { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.swatch:has(.swatch__input:checked) { border-color: var(--text-strong); background: var(--accent-soft); }
.swatch__input, .picker__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch__dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); }
.swatch__check { flex: none; opacity: 0; }
.swatch__input:checked ~ .swatch__check { opacity: 1; }
.swatch__input:checked ~ .swatch__name { font-weight: 700; }
.swatch__input:checked ~ .swatch__dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-strong); }
.swatch__input:focus-visible ~ .swatch__dot, .picker__input:focus-visible ~ .picker__thumb { outline: 3px solid var(--focus); outline-offset: 3px; }

.tgallery { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 600px) { .tgallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .tgallery { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .tgallery { grid-template-columns: repeat(4, 1fr); } }
.tcard-item { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.tcard { background: var(--bg); color: var(--text); font-family: var(--font-body); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.tcard__cover { display: flex; height: 84px; background: var(--surface-2); }
.tcard__a, .tcard__b { display: block; flex: 1; }
.tcard--hero .tcard__a { background: var(--accent-strong); }
.tcard--hero .tcard__b { display: none; }
.tcard--split .tcard__a { background: var(--surface); }
.tcard--split .tcard__b { background: var(--accent); }
.tcard--framed .tcard__cover { padding: 10px 24px; background: var(--bg); }
.tcard--framed .tcard__a { border: 3px solid var(--surface); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--line-strong); }
.tcard--framed .tcard__b { display: none; }
.tcard__page { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); }
.tcard__title { margin: 0; font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); font-size: var(--step-name); color: var(--text-strong); }
.tcard__line { display: block; height: 6px; border-radius: 3px; background: var(--line-strong); }
.tcard__line--short { width: 60%; }
.tcard__pill { justify-self: start; margin-top: var(--space-1); padding: 5px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: var(--step-small); font-weight: 600; }
.tcard__meta { display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.tcard__meta > * { margin: 0; }
.tcard__name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--step-name); }
.tcard__dots { display: flex; gap: var(--space-2); }
.tcard__dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong); }
.tcard__meta .actions { margin-top: auto; padding-top: var(--space-2); }
.actions form { display: inline; }

.focus__stage { position: relative; width: 100%; max-width: 520px; line-height: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.focus__stage img { display: block; width: 100%; height: auto; }
.focus__stage--live { cursor: crosshair; }
.focus__marker { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--text-strong); pointer-events: none; }
.focus__previews { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .focus__previews { grid-template-columns: minmax(0, 200px) minmax(0, 1fr); align-items: start; } }
.focus__figure { margin: 0; display: flex; flex-direction: column; gap: var(--space-1); max-width: 100%; }
.focus__figure--phone { max-width: 200px; }
.focus__frame { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface-2); }
.focus__frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.upload-status { display: flex; flex-direction: column; gap: var(--space-1); }
.confirm > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.confirm > summary::-webkit-details-marker { display: none; }
.confirm[open] > summary { margin-bottom: var(--space-3); }
.photo-page__current { display: flex; align-items: center; gap: var(--space-4); }
.photo-page__current p { margin: 0; }

.picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.picker__grid { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); }
@media (min-width: 640px) { .picker__grid { grid-template-columns: repeat(5, 1fr); } }
.picker__item { display: block; aspect-ratio: 1; }
.picker__thumb { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.picker__check { position: absolute; top: 6px; right: 6px; box-sizing: content-box; padding: 3px; border-radius: 50%; background: var(--accent); color: var(--on-accent); opacity: 0; }
.picker__input:checked ~ .picker__thumb { outline: 4px solid var(--accent); outline-offset: -4px; }
.picker__input:checked ~ .picker__check { opacity: 1; }

/* First-run setup guide and the Home "Finish setting up" card */
.setup-progress { display: flex; flex-direction: column; gap: var(--space-2); }
.setup-progress__label { margin: 0; }
.setup-progress__dots { display: flex; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.setup-progress__dot { flex: 1 1 0; height: 6px; border-radius: 999px; background: var(--line); }
.setup-progress__dot.is-done, .setup-progress__dot.is-current { background: var(--accent); }
.setup-nav { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.setup-nav form { display: inline; }
.setup-nav__go { margin-left: auto; }
.setup-list { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.setup-list__item { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; }
.setup-list__number { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.setup-person { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.setup-person legend { padding: 0 var(--space-2); font-weight: 600; }
.setup-person__name { margin: 0; font-size: var(--step-name); overflow-wrap: anywhere; }
.setup-done-links { display: flex; flex-direction: column; gap: var(--space-2); }
.setup-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.setup-card__title { margin: 0; font-size: var(--step-name); }
.setup-card__items { display: flex; flex-direction: column; gap: var(--space-1); }
.setup-card__item { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); text-decoration: none; }
.setup-card__box { flex: none; width: 18px; height: 18px; border: 2px solid var(--line-strong); border-radius: 4px; }

/* Billing: the plan card and the "we couldn't renew" banner (warning tones, never loud). */
.plan__price { margin: 0; }
.plan__alert { padding: var(--space-3) var(--space-4); background: var(--warning-soft); border-left: 4px solid var(--warning); border-radius: var(--radius); }
.plan__alert p { margin: 0; }
.plan-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4); background: var(--warning-soft); border-left: 4px solid var(--warning); border-radius: var(--radius); }
.plan-banner p { margin: 0; flex: 1 1 16rem; }
.plan-banner__link { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 650; color: var(--warning); }
.stepper { max-width: 8rem; font-size: var(--step-name); }
@media (max-width: 639px) { .btn--block-phone { width: 100%; } }

/* Settings → Web address: the address, the DNS records to copy, and picking another address. */
.address__name { overflow-wrap: anywhere; font-weight: 650; }
.dns-records { display: flex; flex-direction: column; gap: var(--space-2); }
.dns-record { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.dns-record__row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); min-width: 0; }
.dns-record__key { flex: 0 0 3.5rem; font-size: var(--step-small); color: var(--muted); }
.dns-record code { overflow-wrap: anywhere; user-select: all; }
.address-pick { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.address-pick input { flex: 1 1 auto; min-width: 0; }
.address-pick select { flex: 0 0 5.5rem; width: 5.5rem; }
.address-result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.address-result__name { flex: 1 1 12rem; font-weight: 600; overflow-wrap: anywhere; }
.address-result form { flex: 1 1 100%; }
@media (min-width: 640px) { .address-result form { flex: 0 0 auto; } }

/* ---- The "⋯" menu: every Edit / Delete / Set as cover / Remove / Manage lives here, out of the
   reading surface. A <details>, so it opens without JavaScript and by keyboard (Enter/Space on the
   summary, Tab through the items); shell.js only closes it on an outside tap or Escape. The
   destructive item is always last and still leads to its confirmation. */
.menu { position: relative; flex: none; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__button {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border-radius: 50%;
  color: var(--muted); cursor: pointer;
}
.menu__button:hover, .menu[open] > .menu__button { background: var(--accent-soft); color: var(--accent-strong); }
.menu__button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.menu__list {
  position: absolute; right: 0; top: calc(100% + var(--space-1)); z-index: 26;
  display: flex; flex-direction: column; min-width: 13.5rem; padding: var(--space-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.menu--up .menu__list { top: auto; bottom: calc(100% + var(--space-1)); }
.menu--left .menu__list { right: auto; left: 0; }
.menu__list form { margin: 0; }
.menu__item {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text);
  font: inherit; font-weight: 600; text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.menu__item:hover { background: var(--accent-soft); color: var(--text-strong); }
.menu__item:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.menu__item--danger { color: var(--danger); margin-top: var(--space-1); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__confirm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); padding: var(--space-1) var(--space-3); }
.menu__confirm[hidden] { display: none; }
.menu__confirm .menu__item { width: auto; flex: 1 1 auto; justify-content: center; }
/* Over a photo: a round dark button that stays visible on any picture */
.menu--on-media { position: absolute; top: var(--space-1); right: var(--space-1); z-index: 2; }
.menu--on-media > .menu__button { background: var(--scrim); color: var(--on-media); }
.menu--on-media > .menu__button:hover, .menu--on-media[open] > .menu__button { background: var(--overlay); color: var(--on-media); }

.manage-people { padding: 0; }
.manage-people__summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 64px; padding: var(--space-3) var(--space-5); cursor: pointer; list-style: none; border-radius: var(--radius-lg); }
.manage-people__summary::-webkit-details-marker { display: none; }
.manage-people__summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.manage-people__summary::after { content: "Show"; font-weight: 600; color: var(--accent-strong); }
.manage-people[open] .manage-people__summary::after { content: "Hide"; }
.manage-people__title { flex: 1; font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: var(--step-name); color: var(--text-strong); }
.manage-people__body { padding: 0 var(--space-5) var(--space-5); }
.brand { display: inline-flex; align-items: center; min-height: var(--tap); }

/* ---- Settings: the list beside the open page from 1024px; "← Settings" above it on smaller screens */
.settings-side { display: none; }
.settings-panel { min-width: 0; max-width: 760px; }
.crumb a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
@media (min-width: 1024px) {
  .settings-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-7); align-items: start; }
  .settings-side { display: block; position: sticky; top: 88px; padding: var(--space-3); background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
  .settings-crumb { display: none; }
  .settings-panel { max-width: none; }
}
.settings-side__title { display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-3); font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: var(--step-name); color: var(--text-strong); text-decoration: none; }
.settings-side__link { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text); font-weight: 600; text-decoration: none; }
.settings-side__link .icon { flex: none; width: 20px; height: 20px; color: var(--muted); }
.settings-side__link:hover { background: var(--accent-soft); }
.settings-side__link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.settings-side__link[aria-current="page"] .icon { color: var(--accent-strong); }
.settings-side__link:focus-visible, .settings-side__title:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

/* The bar above a page's content: the way back on the left, the page's "⋯" on the right */
.page-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.page-bar .crumb { margin: 0; }
.page-bar__end { display: flex; align-items: center; gap: var(--space-2); }
.menu__list--wide { min-width: min(20rem, calc(100vw - 32px)); }
.menu__sub > summary { list-style: none; }
.menu__sub > summary::-webkit-details-marker { display: none; }
.menu__confirm-form { padding: var(--space-2) var(--space-3) var(--space-3); white-space: normal; }
.menu__confirm-form p { margin: 0; }
.photo-grid > li { position: relative; }
.timezone-hint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 0; }
.setup-nav { justify-content: space-between; }
@media (max-width: 479px) { .setup-nav .setup-nav__go { order: -1; width: 100%; margin-left: 0; } .setup-nav > a.btn:not(.setup-nav__go) { flex: 1 1 0; } }
.family-page .page-head .actions { flex-wrap: nowrap; align-items: center; }
.family-page .page-head .btn { white-space: nowrap; padding: 0 var(--space-4); }

/* ---- The invitation card: what a relative receives (join page), and what the person inviting sees
   before and after making it. The family's name printed on a paper card with cut corners, on the
   family's cover photo. ---- */
.invitation { position: relative; display: grid; place-items: center; margin: 0; padding: var(--space-7) var(--space-4); overflow: hidden; border-radius: var(--radius-lg); background: var(--accent-strong); }
.invitation__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.invitation__card { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); width: min(100%, 380px); padding: var(--space-7) var(--space-5) var(--space-6); background: var(--surface); color: var(--text); text-align: center; clip-path: var(--scallop); }
.invitation__to { margin: 0; font-size: var(--step-small); font-weight: 700; color: var(--accent-strong); overflow-wrap: anywhere; }
.invitation__family { margin: 0; font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: -0.02em; font-size: clamp(2.25rem, 1.8rem + 2vw, 3rem); line-height: 1; color: var(--text-strong); text-wrap: balance; overflow-wrap: anywhere; }
.invitation__line { margin: var(--space-1) 0 0; max-width: 26ch; }
.invitation__address { margin: 0; font-weight: 650; color: var(--text-strong); overflow-wrap: anywhere; }
.invitation__join { display: inline-flex; align-items: center; min-height: var(--tap); margin-top: var(--space-3); padding: 0 var(--space-5); border-radius: var(--radius); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.invite-page { display: grid; gap: var(--space-5); }
.invite-page__card { display: flex; flex-direction: column; gap: var(--space-2); }
.invite-page__caption { margin: 0; font-size: var(--step-small); text-align: center; }
.invite-page__form h1 { margin: 0; }
.invite-more > summary { display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 600; color: var(--accent-strong); }
.invite-more[open] > summary { margin-bottom: var(--space-3); }
.invite-page--ready .invite-page__form { order: -1; }
.send-link__copy { min-height: 60px; font-size: var(--step-name); }
.send-link__status { min-height: 1.4em; margin: 0; }
.send-link__ways { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.send-link input { width: 100%; }
.join-card { margin-bottom: var(--space-4); }
.join-card .invitation { padding: var(--space-6) var(--space-4); }
@media (min-width: 900px) {
  .invite-page { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-7); align-items: start; max-width: 1040px; margin: 0 auto; }
  .invite-page__card { position: sticky; top: 88px; }
  .invitation { min-height: 560px; }
  .invite-page--ready .invite-page__form { order: 0; }
}
.join-card .invitation__join { display: none; }

/* The family's name in the bar: centred on phones in the templates that print it like a masthead */
@media (max-width: 767px) { .topbar__inner .brand { justify-content: var(--brand-justify); } }

/* ---- The template gallery's live miniatures: the family's own top bar, cover and feed, at phone width
   (390px) in a phone-shaped frame, scaled to half. The real classes, so each card shows its template. ---- */
.tmini { position: relative; display: flex; justify-content: center; height: 330px; padding-top: var(--space-4); overflow: hidden; background: var(--bg); }
.tmini__screen {
  flex: none; width: 390px; height: 820px; margin-bottom: -410px; overflow: hidden;
  transform: scale(0.5); transform-origin: top center;
  background: var(--bg); color: var(--text); font: 400 var(--step-body)/1.55 var(--font-body);
  border: 12px solid var(--text-strong); border-radius: 44px;
}
.tmini .topbar { position: static; }
.tmini .topbar__inner { min-height: 60px; }
.tmini__me { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.tmini__cover { height: 190px; overflow: hidden; background: var(--accent-strong); display: flex; align-items: center; justify-content: center; }
.tmini__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tmini__monogram { font-family: var(--font-heading); font-weight: var(--heading-weight); font-size: 5rem; color: var(--on-accent); }
.tmini__page { padding: var(--space-4); }
.tmini .home__hello { font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); color: var(--text-strong); text-align: var(--title-align); }
.tmini .post { margin-top: var(--gap-cards); }
.tmini .tile img { height: 240px; object-fit: cover; }
.tmini .post__date { margin: 0; min-height: 0; }
.tcard { transition: transform 0.2s ease; }
.tcard-item:hover .tcard { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .tcard, .tcard-item:hover .tcard { transition: none; transform: none; } }
@media (min-width: 1280px) { .settings-panel .tgallery { grid-template-columns: repeat(3, 1fr); } }
