/*
  Shared app styles: The Gow School website brand (2026.11) applied to the forms app.
  Load order on every page:
    1. ../brand/gow-brand-tokens.css  (brand tokens and fonts, copied unchanged from the brand kit)
    2. this file                       (shared components)
    3. the page stylesheet             (page layout only)
    4. <school>/css/brand.css          (school colors: --brand-* below)

  School variables (set in gow/css/brand.css and gssp/css/brand.css):
    --brand-primary / --brand-primary-text   top band
    --brand-heading                           headings, table headers, links
    --brand-button / --brand-button-hover     everyday buttons
    --brand-action / --brand-action-text / --brand-action-hover   the one parent action (Start Form)
    --brand-accent                            selected item marker
    --brand-link-hover                        link hover color
    --app-logo-height                         portal logo height

  Use tokens, not raw hex values. The status colors below are the one documented exception to the
  guide's palette (Jeff, 2026-11-18): muted shades chosen to sit beside navy and crimson.
*/

:root {
    --app-max: 1200px;
    --app-logo-height: 52px;

    /* Status colors (exception to the palette). Text on its background is at least 5.6:1. */
    --app-success: #1E6B4A;        /* text and borders */
    --app-success-bg: #E7F2EC;
    --app-success-rule: #A9D2BC;
    --app-success-bar: #2E7D5B;
    --app-warning: #7A4E00;
    --app-warning-bg: #FDF1D8;
    --app-warning-rule: #EBC77A;
    --app-warning-bar: #E0A21B;
    --app-error: var(--gow-crimson);
    --app-error-bg: var(--gow-blush);
    --app-error-rule: #E9B8C0;
    --app-info: var(--gow-navy);
    --app-info-bg: #E6EEF7;
    --app-info-rule: #B9CCE4;

    /* Compact app spacing (the website's spacing is for reading pages). */
    --app-control-height: 44px;
    --app-danger: var(--gow-crimson-deep);
    --app-danger-hover: #6E0F1E; /* crimson-deep, darkened for hover only */
    --app-field-stroke: #6B7785; /* the guide's accessible field border (4.6:1) */
}

/* ===== Base ===== */

html {
    -webkit-text-size-adjust: 100%;
}

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

body {
    margin: 0;
    background: var(--gow-mist); /* app pages: Mist behind white tiles */
    color: var(--gow-ink);
    font-family: var(--gow-font-body);
    font-size: var(--fs);
    line-height: var(--lh);
    letter-spacing: var(--ls);
    word-spacing: var(--ws);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--gow-navy);
    color: var(--gow-white);
}

h1,
h2,
h3,
h4 {
    color: var(--brand-heading, var(--gow-navy));
    font-family: var(--gow-font-display);
    font-weight: var(--gow-weight-heading);
    letter-spacing: 0;
    word-spacing: 0;
    text-wrap: balance;
}

/* App scale: page titles use the guide's section size, sub-sections its card size. */
h1 {
    margin: 0 0 6px;
    font-size: clamp(1.75rem, 2.6vw, 2.25rem);
    line-height: var(--gow-lh-heading);
}

h2 {
    margin: 0 0 12px;
    font-size: 1.35rem;
    line-height: 1.2;
}

h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    line-height: 1.3;
}

p {
    max-width: var(--gow-measure);
    text-wrap: pretty;
}

/* Inside tiles, text runs the full width of the tile (Jeff, 2026-11-18). */
.tile p,
.tile .help-text {
    max-width: none;
}

strong,
b {
    font-weight: var(--gow-weight-bold);
}

a {
    color: var(--brand-heading, var(--gow-navy));
    -webkit-tap-highlight-color: transparent;
}

a:hover {
    color: var(--brand-link-hover, var(--gow-crimson));
}

p a,
li a {
    text-decoration: underline;
    text-underline-offset: .3em;
    text-decoration-thickness: 1.5px;
    text-decoration-skip-ink: auto;
}

p a:hover,
li a:hover {
    text-decoration-thickness: 2px;
}

/* Focus: blue ring with a white halo; white ring with a navy halo on dark bands. */
:focus {
    outline: none;
}

:focus-visible {
    outline: var(--gow-focus);
    outline-offset: var(--gow-focus-offset);
    box-shadow: 0 0 0 3px var(--gow-white);
    border-radius: 2px;
}

.impersonation-banner :focus-visible,
.review-group summary:focus-visible,
th :focus-visible {
    outline-color: var(--gow-white);
    box-shadow: 0 0 0 3px var(--gow-navy);
}

/* ===== Page frame ===== */

/* Top band: the school color with the navy rep stripe underneath. */
.top-bar {
    padding: 10px max(var(--gow-gutter), calc((100% - var(--app-max)) / 2 + var(--gow-gutter))) calc(12px + var(--gow-stripe-height));
    background:
        var(--gow-stripes-navy) left bottom / 100% var(--gow-stripe-height) no-repeat,
        var(--brand-primary, var(--gow-crimson));
    color: var(--brand-primary-text, var(--gow-white));
    font-family: var(--gow-font-display);
    font-size: 1.25rem;
    font-weight: var(--gow-weight-heading);
    line-height: 1.2;
}

.impersonation-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 8px max(var(--gow-gutter), calc((100% - var(--app-max)) / 2 + var(--gow-gutter)));
    background: var(--gow-navy);
    color: var(--gow-white);
    font-weight: var(--gow-weight-bold);
}

.impersonation-banner a {
    color: var(--gow-white);
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: .3em;
    text-decoration-thickness: 1.5px;
}

.impersonation-banner a:hover {
    color: var(--gow-white);
    text-decoration-thickness: 2px;
}

.page-wrap {
    max-width: var(--app-max);
    margin: 0 auto;
    padding: 20px var(--gow-gutter) 48px;
}

/* The outer page container sits flat on the Mist page; content goes in tiles. */
.portal-card,
.admin-card {
    background: transparent;
}

/* Tiles: white, square, Silver border, navy top edge, no shadow. They separate content. */
.tile {
    min-width: 0;
    padding: 14px 18px 16px;
    border: 1px solid var(--gow-rule);
    border-top: var(--gow-edge) solid var(--gow-navy);
    background: var(--gow-white);
}

.tile > h2:first-child,
.tile > .section-heading:first-child {
    margin-top: 0;
}


.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 0 0 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--gow-rule);
    font-size: var(--gow-fs-label);
    font-weight: var(--gow-weight-bold);
}

.card-header a {
    color: var(--brand-heading, var(--gow-navy));
}

.card-body {
    padding: 0;
}

/* Admin page intros run the full width, like the tiles under them (Jeff, 2026-11-18). */
.intro {
    max-width: none;
    text-wrap: pretty;
    margin: 0 0 20px;
    font-size: var(--gow-fs-body);
    line-height: var(--gow-lh-body);
}

.muted {
    color: var(--gow-muted);
    font-size: var(--gow-fs-small);
    font-weight: 400;
}

.admin-link {
    color: var(--brand-heading, var(--gow-navy));
    font-weight: var(--gow-weight-bold);
}

/* Panels: plain white boxes (empty states); a .tile.panel is a form tile. */
.panel {
    background: var(--gow-white);
    border: 1px solid var(--gow-rule);
    padding: 14px 18px;
}

.tile.panel {
    border-top: var(--gow-edge) solid var(--gow-navy);
}

/* ===== Buttons: solid fills, white text, 48px tall ===== */

.button,
.admin-button,
.action-button,
.response-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--app-control-height);
    padding: .55em 1.1em;
    border: 2px solid var(--brand-button, var(--gow-navy));
    border-radius: var(--gow-radius-control);
    background: var(--brand-button, var(--gow-navy));
    color: var(--gow-white);
    font-family: var(--gow-font-body);
    font-size: 1rem;
    font-weight: var(--gow-weight-bold);
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.button:hover,
.admin-button:hover,
.action-button:hover,
.response-button:hover {
    color: var(--gow-white);
}

@media (hover: hover) {
    .button:hover,
    .admin-button:hover,
    .action-button:hover,
    .response-button:hover {
        background: var(--brand-button-hover, var(--gow-navy-deep));
        border-color: var(--brand-button-hover, var(--gow-navy-deep));
    }
}

/* Smaller buttons in dense rows and tables still meet the 44px target. */
.button.small {
    min-height: 36px;
    padding: .35em .85em;
    font-size: var(--gow-fs-label);
}

/* Secondary: Muted fill (7.5:1 with white). */
.button.secondary,
.button.neutral {
    background: var(--gow-muted);
    border-color: var(--gow-muted);
    color: var(--gow-white);
}

/* Destructive: deep crimson, so it reads apart from the crimson parent action. */
.button.danger,
.button.warning,
.button.reject,
.button.danger-button {
    background: var(--app-danger);
    border-color: var(--app-danger);
    color: var(--gow-white);
}

@media (hover: hover) {
    .button.secondary:hover,
    .button.neutral:hover {
        background: var(--gow-ink);
        border-color: var(--gow-ink);
    }

    .button.danger:hover,
    .button.warning:hover,
    .button.reject:hover,
    .button.danger-button:hover {
        background: var(--app-danger-hover);
        border-color: var(--app-danger-hover);
    }
}

.button:disabled,
.button[aria-disabled="true"] {
    opacity: .55;
    cursor: not-allowed;
}

/* The one action a parent takes: crimson at Gow, the school color at GSSP. */
.action-button.orange {
    background: var(--brand-action, var(--gow-crimson));
    border-color: var(--brand-action, var(--gow-crimson));
    color: var(--brand-action-text, var(--gow-white));
}

.action-button.orange:hover {
    color: var(--brand-action-text, var(--gow-white));
}

@media (hover: hover) {
    .action-button.orange:hover {
        background: var(--brand-action-hover, var(--gow-crimson-deep));
        border-color: var(--brand-action-hover, var(--gow-crimson-deep));
    }
}

.button-row,
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button-row {
    margin-top: 16px;
}

.row-actions {
    gap: 8px;
}

/* ===== Forms: labels above fields, 48px fields, 16px text ===== */

label {
    display: block;
    margin: 12px 0 4px;
    color: var(--brand-heading, var(--gow-navy));
    font-size: var(--gow-fs-label);
    font-weight: var(--gow-weight-bold);
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="date"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: var(--app-control-height);
    padding: .55em .75em;
    border: 1px solid var(--app-field-stroke);
    border-radius: var(--gow-radius-control);
    background: var(--gow-white);
    color: var(--gow-ink);
    font: inherit;
    font-size: 16px;
    line-height: 1.3;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--gow-navy);
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    margin-top: 12px;
}

.checkbox-row label,
.status-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 36px;
    color: var(--gow-ink);
    font-size: 1rem;
    font-weight: 400;
}

/* Form fields: one group per field (label, control, help), separated by hairlines. */
.field-group {
    min-width: 0;
    margin: 0;
    padding: 0 0 14px;
    border: 0;
    border-bottom: 1px solid var(--gow-rule);
}

.field-group + .field-group {
    padding-top: 2px;
}

.field-group > legend {
    float: left; /* keeps the legend inside the group, like a label */
    width: 100%;
    margin: 12px 0 4px;
    padding: 0;
    color: var(--brand-heading, var(--gow-navy));
    font-size: var(--gow-fs-label);
    font-weight: var(--gow-weight-bold);
}

.field-group > legend + * {
    clear: both;
}

.field-group > .checkbox-row:first-child {
    margin-top: 14px;
}

.help-text {
    margin-top: 6px;
    color: var(--gow-muted);
    font-size: var(--gow-fs-small);
    line-height: 1.45;
}

::placeholder {
    color: var(--gow-muted);
    opacity: 1;
}

/* ===== Messages ===== */

.notice,
.error-box {
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px solid var(--app-success-rule);
    border-top: var(--gow-edge) solid var(--app-success);
    background: var(--app-success-bg);
    color: var(--app-success);
    font-size: 1rem;
}

.error-box,
.notice.error {
    border-color: var(--app-error-rule);
    border-top-color: var(--app-error);
    background: var(--app-error-bg);
    color: var(--app-error);
}

.notice.warning {
    border-color: var(--app-warning-rule);
    border-top-color: var(--app-warning-bar);
    background: var(--app-warning-bg);
    color: var(--app-warning);
}

.notice.info {
    border-color: var(--app-info-rule);
    border-top-color: var(--app-info);
    background: var(--app-info-bg);
    color: var(--app-info);
}

.error-box ul {
    margin: 6px 0 0 20px;
    padding: 0;
}

.empty-state {
    padding: 20px;
    border: 1px solid var(--gow-rule);
    background: var(--gow-white);
    color: var(--gow-muted);
    text-align: center;
}

/* ===== Tables ===== */

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

th {
    padding: 8px 10px;
    background: var(--brand-heading, var(--gow-navy));
    color: var(--gow-white);
    font-size: var(--gow-fs-label);
    font-weight: var(--gow-weight-bold);
    text-align: left;
    vertical-align: bottom;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--gow-rule);
    font-size: var(--gow-fs-small);
    vertical-align: top;
}

/* ===== Badges and status labels (text always says the state) ===== */

.badge,
.status,
.scope-badge {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--gow-rule);
    border-radius: var(--gow-radius-control);
    background: var(--gow-white);
    color: var(--gow-muted);
    font-size: .875rem;
    font-weight: var(--gow-weight-bold);
    line-height: 1.5;
    white-space: nowrap;
}

.badge.active,
.status.complete {
    border-color: var(--app-success-rule);
    background: var(--app-success-bg);
    color: var(--app-success);
}

.status.incomplete {
    border-color: var(--app-warning-rule);
    background: var(--app-warning-bg);
    color: var(--app-warning);
}

.scope-badge {
    font-weight: 400;
}

/* ===== Phones ===== */

@media (max-width: 860px) {
    .page-wrap {
        padding-top: 16px;
        padding-bottom: 40px;
    }

    .card-header {
        display: block;
    }
}

@media (max-width: 700px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    th,
    td {
        white-space: normal;
    }
}

@media (max-width: 560px) {
    .page-wrap {
        padding-left: var(--gow-gutter-phone);
        padding-right: var(--gow-gutter-phone);
    }

    .top-bar,
    .impersonation-banner {
        padding-left: var(--gow-gutter-phone);
        padding-right: var(--gow-gutter-phone);
    }

    .top-bar {
        font-size: 1.15rem;
    }

    .impersonation-banner {
        display: block;
    }

    .impersonation-banner a {
        display: inline-block;
        margin-top: 6px;
    }

    .button-row .button,
    .admin-button {
        width: 100%;
    }
}

/* Motion: state changes only, and none when the visitor asks for less. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
