/*
 * parent.css: screens that exist only in the parent portal.
 *
 * Part of the new stylesheet stack (redesign Step 3). Loaded by
 * templates/base.html.twig in this order, one <link> each: tokens.css,
 * base.css, layout.css, components.css, forms.css, admin.css, parent.css.
 * Never use @import here: every file is linked on its own so that
 * FileModifiedVersionStrategy versions each one by its modification time.
 */

/* ------------------------------------------------------ parent page rhythm
   The artboards set a parent page at text-body (16px, 25px lines), one step up
   from the admin's table size, with 32px above the title and 24px from the
   title block to the first section. The admin shares components.css and its
   own rhythm, so these are scoped to the pages without the app shell. The
   sign-in pages (body.login-page) are one centred card and keep their own
   spacing. */

body:not(.has-app-shell, .login-page) main.container { padding-top: var(--space-8); }

body:not(.has-app-shell) .page-head__sub,
body:not(.has-app-shell) .section__sub {
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

/* The title block already ends 24px (its own margin) above what follows. */
body:not(.has-app-shell) .page-head + .section { margin-top: 0; }

/* A one-line description sits 8px under its title on a parent page. */
body:not(.has-app-shell) .section__title:has(+ .section__sub) { margin-bottom: var(--space-2); }

/* ------------------------------------------------------- parent dashboard
   The dashboard's two card kinds. Parent pages read at text-body (16px) on
   the 1060px page column and have no sidebar. The grid is .card-grid
   (components.css); on this page its columns are 280px at the least, which is
   the artboard's three across at the full width and fewer as it narrows,
   without a new breakpoint. */

.card-grid--children,
.card-grid--cameras { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* A child: initial, name, age, room, one link. Flat like every in-page card. */
.child-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.child-card__avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--plum-tint);
    color: var(--plum-dark);
    font-family: var(--font-display);
    font-size: var(--text-display-card);
    line-height: 1;
    font-weight: var(--weight-semibold);
}

.child-card__meta { min-width: 0; }

.child-card__meta h3 {
    margin: 0;
    font-size: var(--text-body);
    line-height: var(--leading-table);
    font-weight: var(--weight-bold);
}

.child-card__meta p {
    margin: 0 0 var(--space-1);
    font-size: var(--text-label);
    line-height: var(--leading-label);
    color: var(--muted);
}

/* The room chip is the system's .tag (components.css); the link under it
   needs air. */
.child-card__meta .room-badge { margin-bottom: var(--space-1); }
.child-card__meta .room-badge + p { margin-top: var(--space-1); }

/* A camera: a dark screen with a play mark over the room name and place, and
   the Live pill on the right of the name. Same flat card as the child's. The
   screen is --ink: the system has no darker token. The card is one link, so
   its hover is the border going plum, as on a tile. */
.camera-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 120ms ease;
}

.camera-card:hover { border-color: var(--plum); }

.camera-card__screen {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    height: 132px;
    background: var(--ink);
    color: var(--on-plum);
}

.camera-card__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: var(--space-3) var(--space-4);
}

.camera-card__name {
    font-size: var(--text-button);
    line-height: var(--leading-table);
    font-weight: var(--weight-bold);
}

.camera-card__location {
    font-size: var(--text-small);
    line-height: var(--leading-small);
    color: var(--muted);
}

/* Live: the status pill's positive tone (sage-deep on sage-tint) with a
   breathing disc. The word is the signal; the dot only adds to it. */
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: var(--space-4);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--sage-tint);
    color: var(--sage-deep);
    font-size: var(--text-small);
    line-height: var(--leading-small);
    font-weight: var(--weight-semibold);
}

.live-pill__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: live-breathe 2.4s ease-in-out infinite;
}

@keyframes live-breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .live-pill__dot { animation: none; }
    .camera-card { transition: none; }
}

/* ------------------------------------------------- sign-in and invitation
   body.login-page with <main class="container login-main">: one centred card.
   Used on both hosts (the admin sign-in too), for the sign-in, one-time code,
   two-factor, invitation and no-account pages. The form controls inside
   .login-form are styled in forms.css. The old page's gradient wash is gone:
   the artboard is plain paper. */

.login-page { background: var(--paper); }

.login-main {
    --login-card-width: 420px;
    display: grid;
    place-items: center;
    /* The rows are as tall as their content and sit together in the middle:
       with a flash above the card the two stay one block, not two far apart. */
    align-content: center;
    padding: var(--space-16) var(--space-5);
}

/* A page-level message (a flash) is a sibling of the card in the same column:
   centred above it at the card's width. */
.login-main > .callout {
    width: 100%;
    max-width: var(--login-card-width);
}

.login-card {
    width: 100%;
    max-width: var(--login-card-width);
    padding: var(--space-8);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.login-card__brand {
    margin-bottom: var(--space-6);
    text-align: center;
}

.login-card__brand .acorn { width: 44px; height: 44px; }

.login-card__name {
    margin: var(--space-3) 0 var(--space-1);
    font-family: var(--font-display);
    font-size: var(--text-display-section);
    line-height: var(--leading-display-section);
    font-weight: var(--weight-semibold);
}

.login-card__tag {
    margin: 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
    color: var(--muted);
}

.login-card__tag em { color: var(--plum); }

.login-card__intro {
    margin: 0 0 var(--space-4);
    font-size: var(--text-table);
    line-height: var(--leading-table);
    text-align: center;
}

/* Under the brand the form follows directly; after an intro or a help line it
   gets a gap. Touch-sized controls: this is the page most often opened on a
   phone from an email. */
.login-form { margin-top: var(--space-5); }
.login-card__brand + .login-form { margin-top: 0; }

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="tel"],
.login-form input[type="password"],
.login-form input[type="number"],
.login-form select,
.login-card .btn { min-height: 44px; }

.login-card__help {
    margin: var(--space-4) 0 0;
    font-size: var(--text-label);
    line-height: var(--leading-label);
    color: var(--muted);
    text-align: center;
}

.login-card__divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-6) 0 var(--space-4);
    font-size: var(--text-overline);
    line-height: var(--leading-overline);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-overline);
    text-transform: uppercase;
    color: var(--muted);
}

.login-card__divider::before,
.login-card__divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.login-card__oauth {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

@media (max-width: 560px) {
    .login-main { padding: var(--space-8) var(--space-4); }
    .login-card { padding: var(--space-6); }
}

/* ----------------------------------------------- rendered Markdown documents
   Terms and conditions, the fee agreement and the camera terms are authored
   by admins as Markdown (see TermsVersionType) and rendered to HTML by the
   markdown_to_html Twig filter; this styles the resulting tags. It reads at
   text-body: it is something a person is being asked to sign. */

/* The document's own title, above its content, on the standalone pages. */
.terms-doc > h2 {
    margin: 0 0 var(--space-1);
    font-family: var(--font-display);
    font-size: var(--text-display-section);
    line-height: var(--leading-display-section);
    font-weight: var(--weight-semibold);
}

.terms-doc > h2 + .muted { margin: 0 0 var(--space-5); }

/* A document page is a .card (a .form-card paints a bare <ul> red) and keeps
   the 680px measure a form card has, so the line length is the one it always
   had. The fee gate's own panel is not a page and is not capped. */
.terms-doc--page { max-width: 680px; }

.terms-doc__content {
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

.terms-doc__content h1,
.terms-doc__content h2,
.terms-doc__content h3,
.terms-doc__content h4 {
    margin: var(--space-6) 0 var(--space-2);
    color: var(--ink);
    font-weight: var(--weight-semibold);
}

.terms-doc__content h1:first-child,
.terms-doc__content h2:first-child,
.terms-doc__content h3:first-child,
.terms-doc__content h4:first-child { margin-top: 0; }

.terms-doc__content h1,
.terms-doc__content h2 {
    font-family: var(--font-display);
}

.terms-doc__content h1 {
    font-size: var(--text-display-section);
    line-height: var(--leading-display-section);
}

.terms-doc__content h2 {
    font-size: var(--text-display-card);
    line-height: var(--leading-display-card);
}

.terms-doc__content h3,
.terms-doc__content h4 {
    font-family: var(--font-body);
    font-weight: var(--weight-bold);
}

.terms-doc__content h3 {
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

.terms-doc__content h4 {
    font-size: var(--text-label);
    line-height: var(--leading-label);
}

.terms-doc__content p,
.terms-doc__content ul,
.terms-doc__content ol { margin: 0 0 var(--space-4); }

.terms-doc__content ul,
.terms-doc__content ol { padding-left: var(--space-6); }

.terms-doc__content li { margin-bottom: var(--space-1); }

.terms-doc__content hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: var(--space-6) 0;
}

/* Tables in an admin-authored document: a parties block, a fee schedule, a
   signature grid. Unstyled they arrive as bare browser default rows, which
   reads as broken in a document somebody is being asked to sign. Scrollable
   rather than squeezed: a legal table is wider than a phone. */
.terms-doc__content table {
    display: block;
    width: 100%;
    margin: 0 0 var(--space-5);
    border-collapse: collapse;
    overflow-x: auto;
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

.terms-doc__content th,
.terms-doc__content td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.terms-doc__content thead th {
    background: var(--sunken);
    font-weight: var(--weight-bold);
}

/* An empty cell is a blank to be filled: in a signature block that is the
   whole point of the row, so it must not collapse to nothing. */
.terms-doc__content td:empty::after {
    content: "";
    display: inline-block;
    min-height: 1.2em;
}

/* A quoted passage: a tinted block, no coloured edge. */
.terms-doc__content blockquote {
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--sunken);
    color: var(--ink);
}

.terms-doc__content blockquote > :last-child { margin-bottom: 0; }

.terms-doc__content code {
    padding: 0 var(--space-1);
    border-radius: var(--radius-sm);
    background: var(--sunken);
    font-family: monospace;
    font-size: 0.9em;
}

.terms-doc__content a { color: var(--plum); }

/* -------------------------------------------------------- fee agreement gate
   A blocking overlay, not a dialog with a way out: a family that has not
   signed cannot subscribe, pay, or accept the camera terms, so offering a
   close button would only defer the same wall to the next click. The document
   scrolls inside the panel; the page behind it does not. It sits on every
   parent page, above the onboarding guide (z-index 60). */

.fee-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: color-mix(in srgb, var(--ink) 72%, transparent);
    overflow-y: auto;
}

.fee-gate__panel {
    display: flex;
    flex-direction: column;
    width: min(56rem, 100%);
    max-height: min(90vh, 60rem);
    border-radius: var(--radius-lg);
    background: var(--card);
    box-shadow: var(--shadow-overlay);
    overflow: hidden;
}

.fee-gate__head {
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--line);
}

.fee-gate__head h2 {
    margin: 0 0 var(--space-1);
    font-family: var(--font-display);
    font-size: var(--text-display-section);
    line-height: var(--leading-display-section);
    font-weight: var(--weight-semibold);
}

.fee-gate__head p {
    margin: 0;
    font-size: var(--text-table);
    line-height: var(--leading-table);
}

/* The only scrolling region: the agreement is long, and the accept control
   must stay in view rather than being hunted for at the bottom of it. */
.fee-gate__body {
    flex: 1 1 auto;
    padding: var(--space-5) var(--space-6);
    overflow-y: auto;
}

.fee-gate__foot {
    padding: var(--space-5) var(--space-6) var(--space-6);
    border-top: 1px solid var(--line);
    background: var(--paper);
}

/* The shared accept form is a card in its own right on the standalone page;
   inside the panel it is already framed. */
.fee-gate__foot .form-card {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
}

@media (max-width: 560px) {
    .fee-gate { padding: 0; }
    .fee-gate__panel { max-height: 100vh; border-radius: 0; }
    .fee-gate__head,
    .fee-gate__body,
    .fee-gate__foot { padding-left: var(--space-4); padding-right: var(--space-4); }
}

/* ------------------------------------------------ waitlist check-in page
   The page a OneList parent reaches from their check-in email (no account),
   and the choice rows of the staff life-insurance election. */

.check-in { max-width: 640px; }

.check-in__child {
    margin: 0 0 var(--space-5);
    padding: 0;
    border: 0;
}

.check-in__child legend {
    margin-bottom: var(--space-2);
    padding: 0;
    font-weight: var(--weight-bold);
}

.check-in__choice {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-1) 0;
    font-size: var(--text-body);
    line-height: var(--leading-body);
    font-weight: var(--weight-regular);
}

.check-in__yes,
.check-in__no { margin: var(--space-4) 0; }

.check-in__small {
    font-size: var(--text-small);
    line-height: var(--leading-small);
}

/* ------------------------------------------------------ enrolment form
   Each child on the enrolment form is a real <fieldset> that is also a
   .form-card (the same 680px card as every other parent form), titled by its
   <legend class="section__title">. A legend sits on the fieldset's border
   unless it is floated out of it, so it is floated full width and the first
   field clears it: the title then reads as the card's heading. The "Add
   another child" script builds the same classes. */

.enrollment-child { min-width: 0; margin-left: 0; margin-right: 0; }

.enrollment-child > legend {
    float: left;
    width: 100%;
    padding: 0;
}

.enrollment-child > legend + * { clear: both; }

/* The note and the bar that end the form keep the cards' 680px measure, with
   room between the note and the bar's rule. */
.enrollment-end { max-width: 680px; }
.enrollment-end .form-help { margin-bottom: var(--space-4); }
