/* MyDet help guides — shared by /help, /help/training and /help/welfare */
:root {
  --green: #3b4a2f; --green-2: #55683f; --khaki: #c9b98a; --teal: #1f5f66; --teal-2: #2d7a83;
  --bg: #f4f1e8; --card: #fff; --text: #1d2118; --muted: #61655a; --line: #ddd8c8; --soft: #eae5d6;
  --accent: var(--green); --accent-2: var(--green-2); --tip: #2e7d32; --warn: #b3261e; --note: #8a6200;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.07);
}
body.welfare { --accent: var(--teal); --accent-2: var(--teal-2); }
@media (prefers-color-scheme: dark) {
  :root { --bg: #15180f; --card: #1f2318; --text: #ecebe3; --muted: #a5a796; --line: #343a2a; --soft: #262b1d; --khaki: #d9cba0;
    --green: #9db57f; --green-2: #b6cb9a; --teal: #8fc9cf; --teal-2: #6fb3ba; --tip: #81c784; --warn: #ff8a80; --note: #ffcc66;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; }

/* top bar */
.hbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--green); color: #fff; }
body.welfare .hbar { background: #1f5f66; }
@media (prefers-color-scheme: dark) { .hbar { background: #232c1b; } body.welfare .hbar { background: #123a3e; } }
.hbar .brand { white-space: nowrap; display: flex; align-items: center; gap: 10px; font-weight: 800; color: #fff; text-decoration: none; letter-spacing: .01em; }
.hbar .brand img { width: 30px; height: 30px; }
.hbar nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.hbar nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: .9rem; padding: 6px 12px; border-radius: 99px; opacity: .85; }
.hbar nav a:hover { opacity: 1; background: rgba(255,255,255,.12); }
.hbar nav a.on { background: rgba(255,255,255,.18); opacity: 1; }
.hbar .back { border: 1px solid rgba(255,255,255,.4); }

/* hero */
.hero { background: var(--accent); color: #fff; padding: 48px 20px 54px; }
@media (prefers-color-scheme: dark) { .hero { background: linear-gradient(160deg, #2a3521, #1a2013); } body.welfare .hero { background: linear-gradient(160deg, #164448, #0f2c2f); } }
.hero .in { max-width: 1180px; margin: 0 auto; }
.hero .kick { text-transform: uppercase; letter-spacing: .22em; font-size: .8rem; font-weight: 800; color: #e6dcb8; }
body.welfare .hero .kick { color: #b9e3e7; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.1; margin: 10px 0 14px; letter-spacing: -.01em; }
.hero p { font-size: 1.12rem; max-width: 760px; opacity: .92; margin: 0; }
.search { margin-top: 24px; max-width: 520px; position: relative; }
.search input { width: 100%; font: inherit; padding: 13px 16px 13px 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.96); color: #1d2118; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.search:before { content: '🔍'; position: absolute; left: 15px; top: 14px; font-size: 1rem; pointer-events: none; }
.hero kbd { color: #1d2118; background: #fff; border-color: transparent; }
.search .hint { font-size: .85rem; opacity: .85; margin-top: 8px; }

/* layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 20px 80px; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 44px; }
.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: .92rem; padding-right: 6px; }
.toc h4 { margin: 0 0 10px; font-size: .75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; line-height: 1.3; }
.toc li li a { padding-left: 22px; font-size: .86rem; color: var(--muted); }
.toc a:hover { background: var(--soft); }
.toc a.on { background: var(--soft); color: var(--accent); font-weight: 700; }
.toc .tocbtn { display: none; }
main.doc { min-width: 0; }

/* content */
.doc section { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 34px; margin-bottom: 26px; }
.doc section[hidden] { display: none; }
.doc h2 { font-size: 1.65rem; margin: 0 0 6px; line-height: 1.2; display: flex; align-items: center; gap: 12px; }
.doc h2 .ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--soft); font-size: 1.3rem; flex: none; }
.doc .lead { color: var(--muted); font-size: 1.06rem; margin: 4px 0 18px; }
.doc h3 { font-size: 1.18rem; margin: 30px 0 8px; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 16px; }
.doc li { margin: 4px 0; }
.who { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }
.who span { font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); }
kbd, .ui { font: 600 .9em system-ui, sans-serif; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }

/* numbered steps */
ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 4px 0 18px; }
ol.steps > li { counter-increment: s; position: relative; padding: 2px 0 12px 48px; margin: 0; }
ol.steps > li:before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: .95rem; }
@media (prefers-color-scheme: dark) { ol.steps > li:before { color: #15180f; } }
ol.steps > li:not(:last-child):after { content: ''; position: absolute; left: 15px; top: 36px; bottom: 2px; width: 2px; background: var(--line); }

/* call-outs */
.box { border-radius: 12px; padding: 14px 18px 14px 50px; margin: 16px 0; position: relative; background: var(--soft); }
.box:before { position: absolute; left: 16px; top: 13px; font-size: 1.15rem; }
.box.tip { background: color-mix(in srgb, var(--tip) 11%, var(--card)); } .box.tip:before { content: '💡'; }
.box.warn { background: color-mix(in srgb, var(--warn) 10%, var(--card)); } .box.warn:before { content: '⚠️'; }
.box.note { background: color-mix(in srgb, var(--note) 12%, var(--card)); } .box.note:before { content: 'ℹ️'; }
.box.lock { background: color-mix(in srgb, var(--accent) 10%, var(--card)); } .box.lock:before { content: '🔒'; }
.box p:last-child, .box ul:last-child { margin-bottom: 0; }
.box b:first-child { display: block; margin-bottom: 2px; }

/* screenshots */
figure.shot { margin: 18px 0 24px; }
figure.shot img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.08); cursor: zoom-in; background: #f4f1e8; }
figure.shot.narrow { max-width: 460px; }
figure.shot.mid { max-width: 680px; }
figcaption { font-size: .88rem; color: var(--muted); margin-top: 8px; }
.phones { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px; margin: 18px 0 24px; }
.phones figure { margin: 0; }
.phones img { display: block; width: 100%; aspect-ratio: 390 / 797; object-fit: cover; object-position: top; border-radius: 22px; border: 6px solid #22252a; box-shadow: 0 10px 26px rgba(0,0,0,.18); cursor: zoom-in; background: #22252a; }
.phones figcaption { text-align: center; }
.phones figure.paper img { aspect-ratio: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 10px 26px rgba(0,0,0,.12); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.two figure.shot { margin-top: 0; }

/* tables */
.tbl { overflow-x: auto; margin: 10px 0 18px; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
td.y { color: var(--tip); font-weight: 700; } td.n { color: var(--muted); }

/* FAQ */
details.faq { border-bottom: 1px solid var(--line); padding: 12px 0; }
details.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.faq summary:after { content: '+'; font-size: 1.3rem; line-height: 1; color: var(--accent); }
details.faq[open] summary:after { content: '–'; }
details.faq p { margin: 10px 0 0; }

/* guide picker (/help) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; max-width: 1180px; margin: -30px auto 60px; padding: 0 20px; }
.gcard { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: var(--text); display: flex; flex-direction: column; transition: transform .15s; }
.gcard:hover { transform: translateY(-3px); }
.gcard img { width: 100%; aspect-ratio: 16/9; object-fit: cover; object-position: top; border-bottom: 1px solid var(--line); }
.gcard .t { padding: 20px 24px 24px; }
.gcard h2 { margin: 0 0 6px; font-size: 1.4rem; } .gcard p { margin: 0; color: var(--muted); }
.gcard .go { display: inline-block; margin-top: 14px; font-weight: 700; color: var(--green); }
.gcard.wf .go { color: var(--teal); }

.nores { display: none; text-align: center; color: var(--muted); padding: 40px; }
.foot { text-align: center; color: var(--muted); font-size: .88rem; padding: 0 20px 40px; }

/* zoom */
dialog.zoom { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
dialog.zoom::backdrop { background: rgba(10,12,8,.82); }
dialog.zoom img { max-width: 96vw; max-height: 90vh; border-radius: 10px; display: block; }
dialog.zoom p { color: #fff; text-align: center; margin: 8px 0 0; font-size: .9rem; }

/* phones and small screens */
@media screen and (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; gap: 0; padding-top: 16px; }
  .toc { position: sticky; top: 56px; z-index: 10; max-height: none; background: var(--bg); padding: 8px 0; margin: 0 0 12px; }
  .toc .tocbtn { display: flex; width: 100%; justify-content: space-between; font: 700 1rem system-ui, sans-serif; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
  .toc h4, .toc ol { display: none; }
  .toc.open ol { display: block; background: var(--card); border-radius: 12px; margin-top: 6px; padding: 8px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
  .doc section { padding: 22px 18px; }
  .two { grid-template-columns: 1fr; }
  .hbar nav a:not(.back) { display: none; }
  .hbar { padding: 10px 14px; }
  body { font-size: 16px; }
}

/* ---------- printing / PDF: a cover page, then each part on fresh A4 pages ---------- */
.printtoc, .printonly { display: none; }
@page { size: A4; margin: 15mm 14mm 17mm; }
@page guide { size: A4; margin: 15mm 14mm 17mm;
  @bottom-left { content: "MyDet · mydet.org.uk/help"; font: 8pt system-ui, sans-serif; color: #777; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt system-ui, sans-serif; color: #777; } }
@page cover { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; color: #1d2118; }
  body { font-size: 10.5pt; line-height: 1.5; --card: #fff; --soft: #f1eee4; --line: #d8d3c3; --text: #1d2118; --muted: #555; }
  .hbar, .toc, .search, dialog, .nores, .foot { display: none !important; }
  a { color: inherit; text-decoration: none; }
  /* cover */
  .hero { page: cover; height: 297mm; padding: 40mm 22mm 0; break-after: page; color: #fff; background: var(--green) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; position: relative; }
  body.welfare .hero { background: #1f5f66 !important; }
  .hero .in { max-width: none; }
  .hero h1 { font-size: 30pt; margin: 6mm 0 5mm; }
  .hero p { font-size: 13pt; max-width: 150mm; }
  .hero .kick { font-size: 9pt; }
  .printtoc { display: block; margin-top: 18mm; background: rgba(255,255,255,.1); border-radius: 4mm; padding: 7mm 9mm; max-width: 150mm; }
  .printtoc h4 { margin: 0 0 3mm; font-size: 9pt; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
  .printtoc ol { margin: 0; padding-left: 6mm; columns: 2; column-gap: 10mm; font-size: 11pt; }
  .printtoc li { margin: 1.2mm 0; break-inside: avoid; }
  .printonly { display: block; position: absolute; left: 22mm; right: 22mm; bottom: 18mm; font-size: 9.5pt; opacity: .85; }
  .printonly img { width: 14mm; height: 14mm; vertical-align: middle; margin-right: 3mm; }
  /* body pages */
  .wrap { display: block; padding: 0; max-width: none; }
  main.doc { page: guide; }
  .doc section { break-before: page; box-shadow: none; border: 0; border-radius: 0; padding: 0; margin: 0; background: none; }
  .doc section:first-child { break-before: auto; }
  .doc section[hidden] { display: block !important; }
  .doc h2 { font-size: 18pt; padding-bottom: 3mm; margin-bottom: 4mm; border-bottom: 1.2mm solid var(--accent); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc h2 .ic { width: 10mm; height: 10mm; font-size: 13pt; border-radius: 2.5mm; }
  .doc h3 { font-size: 12.5pt; margin: 6mm 0 2mm; break-after: avoid; }
  .doc .lead { font-size: 11pt; }
  .doc p, .doc li { orphans: 3; widows: 3; }
  .box, table, figure, .phones, ol.steps > li, details.faq { break-inside: avoid; }
  .box, ol.steps > li:before, .who span, .ui, kbd, th, td.y { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* pictures: never taller than about a third of the page */
  figure.shot { margin: 4mm 0 5mm; text-align: center; }
  figure.shot img { width: auto; max-width: 100%; max-height: 84mm; margin: 0 auto; box-shadow: none; border: 0.3mm solid #ccc; border-radius: 2mm; }
  figure.shot.narrow img { max-height: 92mm; }
  figure.shot.pfit { display: none; }
  .doc section > :last-child, .two > :last-child, .two figure.shot, .two .phones { margin-bottom: 0 !important; }
  figcaption { font-size: 8.5pt; text-align: center; }
  .two { display: grid; grid-template-columns: 1fr 1fr; gap: 7mm; align-items: start; }
  .two figure.shot img { max-height: 110mm; }
  .phones { display: grid; grid-template-columns: repeat(4, 38mm); justify-content: center; gap: 6mm; margin: 4mm 0 5mm; }
  .phones img { border-width: 1.2mm; border-radius: 4mm; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .two .phones { grid-template-columns: repeat(2, 1fr) !important; }
  .phones figcaption { font-size: 8pt; }
  table { font-size: 9.5pt; } th, td { padding: 1.6mm 2.4mm; }
  details.faq { padding: 2.5mm 0; }
  details.faq summary:after { content: none !important; }
}

/* "Showing the parts for your login" */
.forme { margin-top: 18px; display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28); border-radius: 10px; padding: 8px 14px; font-size: .95rem; }
.forme a { color: #fff; font-weight: 700; }
.forme.off { display: block; max-width: 640px; font-size: 1.05rem; padding: 14px 18px; }
@media print { .forme { display: none; } }
[data-noaccess] { display: none !important; }
