@import url('./typography.css');

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
main { flex: 1; }
img { max-width: 100%; }
a { color: inherit; text-underline-offset: .25em; }
a:hover { color: var(--green); }
button, input, textarea { font: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 1rem; min-height: 48px; padding: .85rem 1.4rem; border: 1px solid transparent; border-radius: .25rem; background: var(--blue); color: var(--navy); font-size: .9375rem; font-weight: 700; line-height: 1.4; cursor: pointer; }
button:hover { background: var(--blue-hover); }
button:disabled { opacity: .65; cursor: wait; }
[hidden] { display: none !important; }
:where(a, button, input, textarea, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 5px; }
.wrap { width: min(var(--content-width), calc(100% - 3rem)); margin-inline: auto; }
[id] { scroll-margin-top: 1.5rem; }
.skip { position: absolute; left: 1rem; top: -10rem; padding: 1rem; background: white; color: var(--navy); z-index: 20; }
.skip:focus { top: 1rem; }

/* Navy header shared with the main Be Safe site. */
body > header, body > footer { background: var(--navy-gradient); color: white; --focus: #ffd28b; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.brand img { display: block; width: 158px; height: auto; }
header nav { display: flex; align-items: center; gap: 1.8rem; font-size: .875rem; }
header nav a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; font-weight: 700; }
header a:hover, footer a:hover { color: var(--mint); }

/* Light knowledge-centre hero, matching the website's FAQ/interior pages. */
.hero { background: var(--surface-alt); padding: clamp(3rem, 5vw, 4.5rem) max(1.5rem, calc((100% - var(--content-width)) / 2)); color: var(--navy); }
.hero > h1 { max-width: 20ch; }
.hero > p:not(.eyebrow) { max-width: 61ch; color: var(--muted); font-size: var(--text-lead); }
.eyebrow { display: inline-block; max-width: 100%; margin: 0 0 1rem; padding: .35rem 1.15rem; border-radius: 999px; background: #e8eef0; color: var(--interior-green); font-size: .75rem; font-weight: 700; letter-spacing: .14em; line-height: 1.5; text-transform: uppercase; overflow-wrap: anywhere; }
.search { max-width: 840px; margin-top: 2rem; }
.search > label { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.search > div { display: flex; gap: .5rem; padding: .5rem; background: white; border: 1px solid #7a8a7f; border-radius: var(--radius); }
.search input { flex: 1; min-width: 0; padding: .65rem 1rem; border: 0; background: transparent; color: var(--navy); font-size: 1rem; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search button span { margin-left: 1rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin-top: 1rem; font-size: .875rem; font-weight: 700; }
.hero-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--interior-green); text-decoration: none; }
.hero-links a:hover { text-decoration: underline; }
.compact { padding-bottom: 3rem; }
.page-main > section:not(.hero) { width: min(var(--content-width), calc(100% - 3rem)); margin-inline: auto; padding-block: var(--section-space); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; }
.section-heading h2 { margin-bottom: 0; }
#result-count { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; margin-top: 2.5rem; }
.card { display: flex; flex-direction: column; padding: 2rem; background: white; border: 1px solid var(--border); border-top: 3px solid var(--blue); border-radius: 0 0 var(--radius) var(--radius); text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.card:hover { color: var(--navy); border-color: var(--interior-green); box-shadow: 0 8px 24px #1d1d370a; }
.card .eyebrow { width: fit-content; margin-bottom: 1.5rem; padding: .25rem .6rem; border-radius: .2rem; font-size: .6875rem; letter-spacing: .08em; background: var(--surface-alt); }
.card p { margin-bottom: 1.5rem; color: var(--muted); font-size: .9375rem; }
.card-end { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1.25rem; border-top: 1px solid var(--border); color: var(--interior-green); font-size: .875rem; font-weight: 700; }
.footer-inner { min-height: 112px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; padding-block: 1.5rem; padding-inline-end: 4.5rem; border-top: 1px solid #ffffff29; color: #d7dcdf; font-size: .8125rem; }
.footer-inner a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }

/* Readable article column, using the same sans-serif hierarchy. */
.article-layout { max-width: var(--content-width); padding-block: 2.5rem var(--section-space); }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 2rem; color: var(--interior-green); font-size: .875rem; font-weight: 700; text-decoration: none; }
.article-layout article > h1 { max-width: none; margin: 0 0 1rem; font-size: 1.875rem; line-height: 1.3; letter-spacing: -.02em; text-wrap: pretty; overflow-wrap: anywhere; }
.article-layout .lead { margin: .75rem 0 1.75rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 1.0625rem; }
.prose { color: var(--text); font-size: 1.0625rem; overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { max-width: none; margin: 1.75rem 0 .75rem; line-height: 1.35; letter-spacing: -.01em; text-wrap: pretty; }
.prose h1 { font-size: 1.625rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose h4 { font-size: 1.125rem; }
.prose h5, .prose h6 { font-size: 1.0625rem; }
.prose > :first-child { margin-top: 0; }
.prose pre { max-width: 100%; overflow: auto; background: var(--surface-alt); padding: 1.25rem; border-radius: var(--radius); }
.prose blockquote { margin-left: 0; border-left: 3px solid var(--blue); padding-left: 1.5rem; }
.prose table { display: block; max-width: 100%; overflow: auto; border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--border); padding: .65rem; }
.prose a { color: var(--interior-green); }
.prose img { max-width: 100%; }
#status, #support-status { color: var(--muted); font-size: .9375rem; overflow-wrap: anywhere; }
#status:empty { display: none; }

/* Same typography, surfaces and controls inside the embedded panel. */
.widget-body { background: var(--surface); font-size: .9375rem; color: var(--navy); }
.widget-body main { padding: 1.5rem; }
.widget-body h1 { max-width: 14ch; margin: .25rem 0 1.5rem; font-size: 2rem; }
.widget-body #widget-browse > h1 { max-width: none; font-size: clamp(1.5rem, 7.5vw, 2rem); }
.widget-body h2 { margin-top: 0; font-size: 1.5rem; }
.widget-body .eyebrow { padding: .3rem .75rem; font-size: .6875rem; }
.widget-body .search { margin-top: 0; }
.widget-body .search input { padding: .5rem; font-size: 1rem; }
.widget-body .search button { padding: .65rem .9rem; }
.widget-body .search button span { display: none; }
.widget-body hr { margin: 1.75rem 0; border: 0; border-top: 1px solid var(--border); }
.widget-results { display: grid; gap: 1rem; margin: 1.25rem 0; }
.widget-results .card { padding: 1.25rem; }
.widget-results h3 { font-size: 1.125rem; }
.widget-results .eyebrow { margin-bottom: .75rem; }
.widget-results .card-end { display: none; }
.widget-results p { margin-bottom: 0; font-size: .875rem; }
.widget-body main > a { min-height: 44px; display: inline-flex; align-items: center; color: var(--interior-green); font-size: .875rem; font-weight: 700; }
.widget-body form:not(.search) label { display: block; margin: 1rem 0 .4rem; font-size: .875rem; font-weight: 700; }
.widget-body form:not(.search) input, .widget-body textarea { width: 100%; min-height: 48px; padding: .75rem; border: 1px solid #7a8a7f; border-radius: .25rem; background: white; font-size: 1rem; }
.widget-body textarea { resize: vertical; }
.widget-body main > button { margin: .5rem .5rem 0 0; }
.small { color: var(--muted); font-size: .8125rem; }

@media (max-width: 960px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .topbar { min-height: 76px; gap: 1rem; } .brand img { width: 135px; } header nav { gap: 1rem; } }
@media (max-width: 540px) {
  .wrap, .page-main > section:not(.hero) { width: calc(100% - 2rem); }

  .topbar { gap: .75rem; } .brand img { width: 104px; }
  header nav { gap: .75rem; font-size: .8125rem; } header nav a:first-child { display: none; }
  header nav .quiet { min-height: 44px; padding: .65rem .9rem; font-size: .8125rem; }
  .hero { padding: 3rem 1rem; } .hero h1 { font-size: clamp(2.4rem, 9vw, 3.5rem); }
  .hero > p:not(.eyebrow) { font-size: 1.0625rem; }
  .hero-links { gap: .25rem 1.5rem; } .hero-links a { font-size: .8125rem; }
  .search input { padding-inline: .65rem; } .search button { padding-inline: .9rem; } .search button span { display: none; }
  .section-heading { align-items: center; gap: .75rem; } .section-heading h2 { font-size: 1.875rem; }
  .cards { grid-template-columns: minmax(0, 1fr); margin-top: 1.75rem; }
  .card { padding: 1.5rem; }
  .footer-inner { padding-block: 1.5rem; min-height: 0; flex-direction: column; align-items: flex-start; gap: .75rem; }
  .article-layout { padding-top: 1.5rem; }
}
@media (max-width: 360px) { .brand img { width: 92px; } header nav { gap: .5rem; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card { transition: none; } }
@media print { header, footer, .back, #besafe-help-widget { display: none; } .wrap { width: 100%; } .prose { color: black; } }

/* Keep the article list close to the landing-page search. */
.hero.home-hero { padding-block: clamp(2rem, 4vw, 3.5rem); }
.page-main > #guides { padding-top: clamp(1.5rem, 2.5vw, 2.5rem); }
#guides .cards { margin-top: 1.5rem; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .25rem 1.5rem; font-size: .8125rem; }
@media (max-width: 540px) { .footer-links { justify-content: flex-start; gap: .25rem 1.25rem; } }

/* Heading navigation is generated alongside each article's HTML. */
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.article-grid > article { min-width: 0; }
.article-sidebar { min-width: 0; }
.article-toc { border: 1px solid var(--border); border-radius: var(--radius); background: white; font-size: .875rem; line-height: 1.45; overflow-wrap: anywhere; }
.article-toc summary { padding: 1rem; min-height: 48px; color: var(--navy); font-weight: 700; cursor: pointer; }
.article-toc summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.article-toc nav { max-height: 60svh; overflow-y: auto; padding: 0 1rem 1rem; }
.article-toc ol { margin: 0; padding-left: 1rem; list-style: none; }
.article-toc nav > ol { padding-left: 0; }
.article-toc a { display: block; padding: .5rem .25rem; text-decoration: none; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.article-toc a:hover { color: var(--interior-green); text-decoration: underline; }
.prose [id]:focus-visible { outline: 3px solid var(--focus); outline-offset: 5px; }
@media (min-width: 1100px) {
  .article-grid { grid-template-columns: 320px minmax(0, 1fr); gap: 2.5rem; }
  .article-grid > article:only-child { grid-column: 1 / -1; max-width: 850px; margin-inline: auto; }
  .article-sidebar { position: sticky; top: 1.5rem; align-self: start; }
  .article-toc nav { max-height: calc(100svh - 9rem); }
}
@media print { .article-sidebar { display: none; } .article-grid { display: block; } }

/* Explain member access next to the action, including on narrow screens. */
.member-access { max-width: 680px; margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--border); border-left: 4px solid var(--interior-green); border-radius: var(--radius); background: white; }
.member-access h2 { max-width: none; margin: 0 0 .5rem; font-size: 1.375rem; line-height: 1.35; letter-spacing: -.01em; }
.member-access p { max-width: 58ch; margin: 0 0 1rem; color: var(--muted); font-size: 1rem; }
.member-access p:last-child { margin-bottom: 0; }
@media (max-width: 540px) { .member-access { padding: 1.25rem; } .member-access button { max-width: 100%; } }

/* Keep public phone screenshots readable without cropping their contents. */
.prose img[src^="/article-images/"] { max-width: 100%; max-height: 75svh; width: auto; height: auto; }

/* Access labels use words as well as colour and never alter result order. */
.card-meta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; margin-bottom: 1.25rem; }
.card .card-meta .eyebrow { margin-bottom: 0; }
.guide-access { display: inline-block; max-width: 100%; padding: .2rem .55rem; border: 1px solid #b9d6c3; border-radius: .2rem; background: #edf7f0; color: #27593f; font-size: .75rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.guide-access[data-visibility="private"] { border-color: #b8c7e0; background: #edf1fc; color: #243b64; }
.search-audience { max-width: 68ch; margin: .75rem 0 1.25rem; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.widget-body .search-audience { margin-top: -.5rem; font-size: .875rem; }
.widget-results .card-meta { margin-bottom: .75rem; }

.page-main > section.auth-page { width: min(100% - 2rem, 540px); margin: clamp(2rem, 6vw, 4rem) auto; padding: clamp(1.5rem, 4vw, 2.5rem); background: white; border: 1px solid var(--border); border-radius: var(--radius); }
.auth-page h1 {font-size: clamp(1.75rem, 5vw, 2.25rem);line-height:1.2;letter-spacing:-.02em;margin:.75rem 0 1rem;}
.auth-page p {color:var(--muted);line-height:1.6;}
.auth-page label {display:block;font-weight:700;color:var(--navy);margin:1.25rem 0 .4rem;}
.auth-page input {display:block;width:100%;min-height:48px;border:1px solid #8b96a5;border-radius:.35rem;padding:.7rem .8rem;font:inherit;color:var(--navy);background:white;}
.auth-page input:focus-visible {outline:3px solid var(--focus);outline-offset:2px;}
.auth-page form > button {margin-top:1.5rem;max-width:100%;}
.auth-page button:disabled {opacity:.65;cursor:wait;}
.auth-page .auth-recovery {margin-top:1.5rem;font-size:.875rem;}
#login-status {min-height:1.6em;color:var(--navy);}
@media(max-width:540px){.page-main > section.auth-page{width:calc(100% - 2rem);padding:1.25rem}.auth-page form > button{width:100%}}

.auth-page button.quiet {background:transparent;color:var(--interior-green);padding:.5rem 0;min-height:44px;font-size:.875rem;text-decoration:underline;text-underline-offset:.25em;}

.widget-account {padding:1rem;margin-bottom:1.25rem;border:1px solid var(--border);border-radius:var(--radius);background:white;}
.widget-account p{margin:0 0 .75rem;font-size:.875rem;line-height:1.5;}
.widget-account button{font-size:.875rem;max-width:100%;}

/* Compact account header and an article reader that stay within the help panel. */
.widget-header {position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:flex-end;gap:.75rem;padding:.85rem 1rem;margin:-1.5rem -1.5rem .75rem;background:var(--navy-gradient);color:white;border-bottom:1px solid #ffffff29;}
.widget-header {transition:transform .18s ease;}
.widget-header.is-scrolled-away {transform:translateY(-100%);}
.widget-header:focus-within {transform:none;transition:none;}
@media (prefers-reduced-motion: reduce) {.widget-header {transition:none;}}
.widget-header .widget-account {display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:.35rem .65rem;margin:0;padding:0;border:0;background:transparent;}
.widget-header .widget-account p {margin:0;font-size:.75rem;font-weight:700;}
.widget-header .widget-account p::before {content:'';display:inline-block;width:.5rem;height:.5rem;border-radius:50%;margin-right:.35rem;background:#7a8580;}
.widget-header .widget-account p[data-state="signed-in"] {color:#21623f;}
.widget-header .widget-account p[data-state="signed-in"]::before {background:#32855d;}
.widget-header .widget-account button {min-height:40px;padding:.45rem .65rem;background:#e2f1e8;color:#21623f;border-color:#a9cbb6;font-size:.8125rem;}
.widget-header .widget-account button:hover {background:#cfe7d8;}
.widget-body #widget-account-message:empty {display:none;}
.widget-body .widget-login {margin:1rem 0;padding:1rem;border:1px solid var(--border);border-radius:var(--radius);background:white;}
.widget-body .widget-login h2 {font-size:1.4rem;}
.widget-login-actions,.widget-reader-actions {display:flex;flex-wrap:wrap;justify-content:space-between;gap:.5rem;}
.widget-body button.quiet {padding:.4rem 0;min-height:44px;background:transparent;color:var(--interior-green);font-size:.8125rem;text-decoration:underline;}
.widget-reader-actions {margin:.75rem 0;}
.widget-body #widget-article h2 {font-size:1.35rem;line-height:1.35;margin:1rem 0 .75rem;}
.widget-body #widget-article h3 {font-size:1.2rem;line-height:1.4;}
.widget-body #widget-article h4 {font-size:1.05rem;}
.widget-body #widget-article .prose {font-size:.9375rem;line-height:1.65;overflow-wrap:anywhere;}
.widget-body #widget-article .prose img {height:auto;max-width:100%;}
.widget-body #widget-article .widget-article-description {color:var(--muted);font-size:.9375rem;}

.widget-header .widget-account p[data-state="signed-in"] {color:#d2efdc;}
.widget-header .widget-account p[data-state="signed-in"]::before {background:#83d5a7;}
.widget-header .widget-account p::before {background:#d6dfdb;}

/* The same article gains a sidebar when the help panel has room. */
.widget-reader-layout {display:grid;grid-template-columns:minmax(0,1fr);gap:1.25rem;}
.widget-reader-layout > article {min-width:0;}
.widget-reader-layout .prose [id] {scroll-margin-top:5.5rem;}
.widget-reader-layout > .article-sidebar {position:static;}
.widget-reader-layout > article:only-child,.widget-reader-layout > .article-sidebar[hidden] + article {grid-column:1 / -1;}
@media (min-width:760px) {
 .widget-reader-layout {grid-template-columns:240px minmax(0,1fr);gap:1.5rem;}
 .widget-reader-layout > .article-sidebar {position:sticky;top:5.5rem;align-self:start;}
 .widget-reader-layout .article-toc nav {max-height:calc(100svh - 10rem);}
 .widget-header.is-scrolled-away:not(:focus-within) ~ #widget-reader .article-sidebar {top:1rem;}
 .widget-header.is-scrolled-away:not(:focus-within) ~ #widget-reader .article-toc nav {max-height:calc(100svh - 5.5rem);}
 .widget-results {grid-template-columns:repeat(2,minmax(0,1fr));}
}
.widget-results .card {min-width:0;overflow-wrap:anywhere;}
@media (min-width:1100px) {.widget-results {grid-template-columns:repeat(3,minmax(0,1fr));}}
