/* ReNEW application of the supplied foundations. Loaded after page styles. */
:root {
  --green: var(--renew-green);
  --deep: var(--renew-deep);
  --ink: var(--renew-ink);
  --paper: var(--renew-paper);
  --soft: var(--renew-green-soft);
  --line: var(--border-hairline);
  --muted: var(--renew-ink);
  --font: var(--font-sans);
}

body, .public-home { background: var(--surface-page); }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-display);
}
h1, .lesson-main h1 { max-width: var(--measure-heading); }
.main, .lesson-main { max-width: var(--measure-max); padding: 44px var(--gutter) var(--section-y); }
.lesson-layout { grid-template-columns: 230px minmax(0, 1fr); }
.lesson-main {
  /* Match the shared page container; all lesson panels fill its content area. */
  --lesson-content-width: 100%;
}
.lesson-main > :is(.lesson-toolbar, .lesson-tabs, .lesson-footer, .version-label),
#lesson-panel { width: 100%; max-width: var(--lesson-content-width); }
.lesson-body, .module-one .lesson-body, .adapted .lesson-body {
  max-width: 100%;
  font-size: var(--size-body);
  line-height: var(--leading-body);
}
.lesson-body :is(p, li), .module-one .lesson-body li { line-height: var(--leading-body); }
.lesson-body :is(i, em, .source-italic) { font-style: normal; }
.lesson-body font { font-family: inherit; font-size: inherit; color: inherit; }
.lesson-body :is(h1, h2, h3, h4) :is(p, b, strong, sup) {
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  vertical-align: baseline;
  margin: 0;
}
/* Imported callouts also use headings for body copy and lists; keep their full reading width. */
.lesson-body :is(h2, h3), .lesson-body :is(h2, h3, h4).source-bold { max-width: none; font-weight: var(--weight-extrabold); }
.lesson-body div.source-highlight :is(h2, h3) { text-wrap: wrap; }
.hero p, .welcome-copy p, .journey-hero p, .ph-copy > p { font-weight: var(--weight-medium); }
/* Restore the original sign-in/register campaign headline wrapping. */
.registration-art .auth-headline { letter-spacing: -.035em; line-height: 1.2; }
.registration-art .auth-headline .highlight { padding: 0 .12em; }
.highlight, .campaign-line, .public-home h1 span {
  border-radius: var(--radius-highlight);
  padding: 0 .16em;
  line-height: var(--leading-highlight);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.topbar, .ph-header { border-bottom: var(--border-width-thick) solid var(--deep); }
.ph-header { position: sticky; top: 0; z-index: 30; }
.ph-brand strong { font-weight: var(--weight-extrabold); }
.ph-header, .ph-footer { padding-inline: max(var(--gutter), calc((100% - 1132px) / 2)); }
.ph-hero, .ph-next {
  padding: var(--section-y) max(var(--gutter), calc((100% - 1132px) / 2));
}
.ph-hero { gap: var(--grid-gap-wide); }
.ph-next ol, .dashboard-grid { gap: var(--grid-gap); }
.overview-grid, .approval-grid { gap: var(--grid-gap-wide); }
.ph-footer { background: var(--renew-ink); color: var(--text-muted-on-ink); border: 0; }
.ph-footer a { color: var(--renew-white); }
.btn, .ph-button {
  border: var(--border-width) solid var(--deep);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-bold);
  box-shadow: none;
}
.btn.outline { border-color: var(--deep); }
.btn.outline:hover, .btn.light:hover { background: white; }
.btn.text { border-color: transparent; border-radius: 0; background: transparent; }
.btn:active, .ph-button:active { transform: translateY(0); box-shadow: none; }
.nav-list a, .lesson-links a, .account-toggle, .account-submenu :is(a, button), .pill {
  border-radius: var(--radius-pill);
}
.nav-list a:hover, .lesson-links a:hover { background: rgba(0,32,96, .14); }
.nav-list a.active, .lesson-links a.active { background: var(--green); color: var(--ink); font-weight: 700; }
.pill { font-size: var(--size-tag); font-weight: 700; padding: 6px 10px; }
.learning-card, .info-panel, .account-panel, .application-status {
  background: var(--surface-card);
  border: var(--border-card);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: none;
}
.application-section .info-panel { background: var(--paper); border: var(--border-card); border-radius: var(--radius); }
.attachment-box, .worksheet, .adapted-table, .source-callout,
.lesson-body div.source-highlight, .lesson-body .original-instructions,
.module-one .course-graphic, .stage-placeholder, .submission-readiness,
.video-frame, .video-cover, .pdf-frame, .lesson-body iframe, .application-frame,
.account-submenu, .module-one .lesson-body img {
  border-radius: var(--radius);
}
.lesson-body img { border-radius: var(--radius); }
.lesson-body .course-graphic, .lesson-body .course-figure { border: 0; padding: 0; }
.lesson-body .course-figure img { display: block; margin: 0 auto; }
/* Consistent spacing for lesson diagrams, image links and following content. */
.lesson-body .course-figure { margin: var(--space-6) 0; }
.lesson-body .course-figure .diagram-open { display: flex; width: fit-content; min-height: 24px; line-height: var(--leading-body); margin: var(--space-3) 0 0; }
.lesson-body .course-figure > a:not(.diagram-open) { display: block; margin: 0; }
.lesson-body :not(.course-figure):has(+ .course-figure) { margin-bottom: 0; }
.lesson-body :has(+ :is(span,u,b,strong,i,em) > .course-figure:first-child) { margin-bottom: 0; }
.lesson-body .course-figure + :is(p,h2,h3,h4,ul,ol,div) { margin-top: 0; }
.lesson-body .course-figure + .source-section-title { margin-top: 0; padding-top: 0; }
.lesson-body .course-figure + :is(span,u,b,strong,i,em), .lesson-body :is(span,u,b,strong,i,em):has(+ .course-figure) { display: block; margin-block: 0; }
.lesson-body :is(span,u,b,strong,i,em):has(> .course-figure) { display: contents; }
.lesson-body:has(> .course-figure:last-child) + .attachment-box { margin-top: 0; }
.worksheet, .module-one .attachment-box, .module-one .lesson-body div.source-highlight,
.module-one .lesson-body .original-instructions { padding: var(--space-8); }
.form-field input:not([type=radio]):not([type=checkbox]), textarea, select,
.worksheet textarea, .quiz-option, .adapted-quiz .quiz-option, .rating-options span {
  border: var(--border-field-style);
  border-radius: var(--radius-sm);
}
.form-field input:not([type=radio]):not([type=checkbox]):focus-visible,
textarea:focus-visible, select:focus-visible, .worksheet textarea:focus-visible { border-color: var(--deep); }
.help-topics details, .form-section { border-color: var(--border-soft); border-width: var(--border-width); }
.adapted .lesson-body thead th { background: var(--deep); color: white; }
.adapted .lesson-body tbody th { background: var(--paper); }
.adapted .change-pathway { background: var(--deep); color: white; }
.adapted .change-pathway figcaption { color: white; font-weight: 800; }
.adapted .change-pathway > p { color: var(--text-muted-on-deep); }
.adapted .change-pathway h3 { color: var(--green); }
.public-home svg, svg[stroke] { stroke-width: 2; }
.video-cover button { box-shadow: none; }
.account-submenu { box-shadow: var(--shadow-dropdown); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .ph-button { transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
  .btn:hover:not(:disabled), .ph-button:hover { transform: var(--lift-btn); box-shadow: var(--shadow-btn-hover); }
  .btn.text:hover { box-shadow: none; }
  .btn:active:not(:disabled), .ph-button:active { transform: translateY(0); box-shadow: none; }
  .learning-card, .mini-lessons.rounded-activities a, .programme-module-list .public-module { transition: transform var(--dur-card) var(--ease), box-shadow var(--dur-card) var(--ease); }
  .learning-card:hover, .mini-lessons.rounded-activities a:hover, .programme-module-list .public-module:hover { transform: var(--lift-card); box-shadow: var(--shadow-card-hover); }
  .journey-campaign, .ph-campaign { animation: renew-reveal var(--dur-reveal) var(--ease); }
  @keyframes renew-reveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
}
@media (max-width: 1150px) {
  .lesson-layout { grid-template-columns: 200px minmax(0, 1fr); }
}
@media (max-width: 940px) {
  .main, .lesson-main { padding-bottom: var(--section-y-tight); }
  .ph-hero, .ph-next { padding-block: var(--section-y-tight); }
}
@media (max-width: 760px) {
  .main, .lesson-main { padding-inline: var(--gutter); }
  .overview-grid, .approval-grid, .dashboard-grid { gap: var(--grid-gap); }
  .learning-card, .info-panel, .account-panel, .application-status,
  .worksheet, .module-one .attachment-box, .module-one .lesson-body div.source-highlight,
  .module-one .lesson-body .original-instructions { padding: 22px; }
}

/* Resource library module groups and sidebar disclosure. */
.rail { overflow-y: auto; }
.resource-navigation summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; font-weight: 550; cursor: pointer; list-style: none; }
.resource-navigation summary::-webkit-details-marker { display: none; }
.resource-navigation summary:hover { background: rgba(0,32,96, .14); }
.resource-navigation summary.active { background: var(--green); color: var(--ink); font-weight: 700; }
.resource-navigation summary > svg:last-child { margin-left: auto; width: 16px; flex-shrink: 0; }
.resource-navigation[open] summary > svg:last-child { transform: rotate(90deg); }
.resource-submenu { margin: 8px 0 4px 23px; padding-left: 10px; border-left: 2px solid var(--deep); }
.nav-list .resource-submenu a { padding: 9px 10px; font-size: 12px; line-height: 1.45; }
.resource-module-section { margin: 28px 0 36px; scroll-margin-top: 102px; }
.resource-module-section > h2 { padding: 16px 20px; margin: 0 0 16px; background: var(--paper); color: var(--ink); border-radius: var(--radius); font-size: 20px; line-height: 1.4; }

/* Separate programme modules into rounded cards. */
.programme-module-list .course-outline { border-top: 0; display: grid; gap: 16px; }
.programme-module-list .public-module { border: var(--border-card); border-radius: var(--radius); padding: 24px; }
@media (max-width: 600px) {
  .programme-module-list .public-module { padding: 20px 16px; }
}

.admin-module-list { margin-top: 32px; }

/* Learning activity cards across all modules. */
.mini-lessons.rounded-activities { border-top: 0; display: grid; gap: 5px; }
.mini-lessons.rounded-activities a { border: var(--border-card); border-radius: var(--radius); padding: 12px 16px; }

/* Keep password visibility controls inside the field without covering input text. */
.password-field { position: relative; }
.password-field > input { width: 100%; padding-right: 56px; }
.password-visibility { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 8px; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--deep); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.password-visibility:hover { background: var(--paper); }

.password-visibility svg { display: block; width: 22px; height: 22px; margin: auto; }

.auth-loading { width: min(420px, calc(100vw - 40px)); margin: auto; padding: 32px; border: var(--border-card); border-radius: var(--radius); background: var(--surface-card); color: var(--ink); text-align: center; box-shadow: var(--shadow-card-hover); }
.auth-loading::backdrop { background: rgba(0,32,96, .4); }
.auth-loading-message { margin: 20px 0 0; font-size: 18px; line-height: 1.5; font-weight: 600; }
.auth-loading-logo { display: block; width: 88px; height: 88px; margin: auto; object-fit: contain; }
/* Initial landing screen: centred branding with a diagonal gradient fade. */
.initial-loading { min-height: 100vh; min-height: 100svh; justify-items: center; gap: 28px; padding: 24px; text-align: center; }
.initial-loading .initial-loading-logo { width: 128px; height: 128px; object-fit: contain; }
.initial-loading p { margin: 0; color: var(--ink); font-size: clamp(20px, 2vw, 24px); font-weight: 600; }


/* First sign-in welcome, using the shared ReNEW colours and spacing. */
.registration-welcome { width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; box-sizing: border-box; padding: var(--space-8); border: var(--border-field-style); border-radius: var(--radius); color: var(--text-body); background: var(--surface-card); }
.registration-welcome::backdrop { background: #002060b3; }
.registration-welcome h2 { margin: var(--space-6) 0 var(--space-4); }
.registration-welcome p { margin: var(--space-4) 0; }
.registration-welcome .welcome-map-links { margin-block: var(--space-6); padding: var(--space-6); border-radius: var(--radius); background: var(--surface-tint); }
.registration-welcome .welcome-map-links a { display: inline-block; font-weight: 600; }
.registration-welcome .welcome-map-links p:not(:first-child) { margin-top: var(--space-6); }
.registration-welcome .welcome-partnership { font-weight: 600; }
.registration-welcome button { margin-top: var(--space-4); }
@media (max-width: 480px) { .registration-welcome { padding: var(--space-6); } }

.registration-welcome .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Scoped corrections for The Four P's and Value Chain Analysis. */
.lesson-body.four-ps-content .lesson-image-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:var(--space-6); align-items:center; margin:var(--space-6) auto; max-width:600px; }
.lesson-body.four-ps-content .lesson-image-row--distribution { grid-template-columns:repeat(4,minmax(0,1fr)); max-width:none; }
.lesson-body.four-ps-content .lesson-image-row > .course-figure { margin:0; min-width:0; }
.lesson-body.four-ps-content .lesson-image-row img { width:auto; max-width:100%; max-height:180px; object-fit:contain; margin:0 auto; }
.lesson-body.value-chain-content :is(h2,.value-chain-heading) { margin:var(--space-8) 0 var(--space-4); padding:0; background:transparent; text-align:left; line-height:1.25; }
.lesson-body.value-chain-content h2 { font-size:28px; }
.lesson-body.value-chain-content .value-chain-heading { font-size:22px; }
.lesson-body.value-chain-content .value-chain-question { background:transparent; font-size:18px; }
@media (max-width:600px) { .lesson-body.four-ps-content .lesson-image-row--distribution { grid-template-columns:repeat(2,minmax(0,1fr)); } }
