/* ============================================================================
   Legacy page bridge

   These pages arrived from privacyguide.in with their own look: Tailwind's
   stock palette on most, hand-written Segoe UI stylesheets on the law readers.
   They now share javedmai's header, footer and design tokens, and this file
   closes the gap between what those pages style for themselves and what the
   site expects. Load order matters: site.css first for the tokens, then this.

   The colour mapping is done here rather than through tailwind.config, because
   the CDN build generates its utilities before an external config script can
   reliably take effect. Overriding the handful of utilities these pages
   actually use is both deterministic and smaller than it looks.

   Everything is scoped to .legacy-page or .pg-reader on <body>, so none
   of it can reach the rest of the site.
   ========================================================================= */

:root {
  /* Height of the sticky site header, used to offset fixed children below it. */
  --pg-header-h: 56px;
  /* Status colours, drawn from the site palette so these pages carry no hues
     the About page does not. Three steps are still distinguishable - accent,
     heading blue, muted - so "adopted / growing / research" still reads as
     three states rather than one. */
  --pg-green: var(--color-accent);
  --pg-amber: var(--color-heading);
  --pg-purple: var(--color-neutral-300);
  --pg-red: var(--color-neutral-500);
  --pg-tint-green: color-mix(in srgb, var(--color-accent) 15%, var(--color-surface));
  --pg-tint-amber: color-mix(in srgb, var(--color-heading) 15%, var(--color-surface));
  --pg-tint-purple: color-mix(in srgb, var(--color-neutral-300) 12%, var(--color-surface));
  --pg-tint-red: color-mix(in srgb, var(--color-neutral-500) 12%, var(--color-surface));
  --pg-tint-blue: color-mix(in srgb, var(--color-accent) 14%, var(--color-surface));
}

/* ------------------------------------------------------- page foundations */

.legacy-page,
body.pg-reader:not(.original-theme) {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

.legacy-page h1,
.legacy-page h2,
.legacy-page h3,
body.pg-reader:not(.original-theme) h1,
body.pg-reader:not(.original-theme) h2,
body.pg-reader:not(.original-theme) h3 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

/* The old pages compensated for a fixed navbar with top padding, and opened
   with a full-height hero. The site header is sticky and occupies its own
   space, so both of those now just push the content down. */
.legacy-page .pt-24,
.legacy-page .sm\:pt-28 { padding-top: 0 !important; }
.legacy-page .min-h-screen { min-height: 0 !important; padding: 64px 0; }

/* --------------------------------------------------------------- surfaces */

.legacy-page .bg-white,
.legacy-page .hover\:bg-white:hover { background-color: var(--color-surface) !important; }
/* --color-section is the stat band's dark green, in BOTH themes: a panel
   colour, not a surface. These are surfaces, so they take --color-surface;
   using the panel colour made light-theme cards dark green under dark
   text. */
.legacy-page .bg-gray-50,
.legacy-page .bg-gray-100,
.legacy-page .hover\:bg-gray-100:hover { background-color: var(--color-surface) !important; }

/* The site's own cards carry --shadow-sm, which is a 1px ring rather than a
   drop shadow. Using it here instead of a plain border means guide cards and
   About's cards are outlined by exactly the same value. */
.legacy-page .shadow,
.legacy-page .shadow-md,
.legacy-page .shadow-lg,
.legacy-page .shadow-xl {
  box-shadow: var(--shadow-sm) !important;
  border: 0;
  border-radius: var(--radius-md);
}

.legacy-page .border-gray-200,
.legacy-page .border-gray-300 { border-color: var(--color-divider) !important; }

/* The two scope evaluators are Tailwind pages that also carry their own
   stylesheet, where the question panels are a hard-coded white. Nothing in the
   utility mapping reaches those, so they are named directly. */
.legacy-page .panel,
.legacy-page .box,
.legacy-page .result {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border-color: var(--color-divider) !important;
}
.legacy-page .panel h1,
.legacy-page .panel h2,
.legacy-page .panel h3 { color: var(--color-heading) !important; }
.legacy-page .text-teal-700,
.legacy-page .text-teal-600 { color: var(--color-accent) !important; }

/* The two scope evaluators define their own small token set for a light page.
   Re-pointing those tokens at the site's is far better than chasing the two
   dozen classes that read them: set on the body rather than :root so the
   closer declaration wins wherever they are used. */
.legacy-page {
  --paper: var(--color-bg);
  --surface: var(--color-surface);
  --ink: var(--color-text);
  --muted: var(--color-neutral-300);
  --faint: var(--color-neutral-500);
  --rule: var(--color-divider);
  --rule-strong: var(--color-divider);
  --accent: var(--color-accent);
  --accent-ink: var(--color-bg);
  --accent-weak: var(--pg-tint-blue);
  --in: var(--pg-amber);
  --in-weak: var(--pg-tint-amber);
  --out: var(--pg-green);
  --out-weak: var(--pg-tint-green);
  --risk: var(--pg-red);
  --risk-weak: var(--pg-tint-red);
  --mod: var(--pg-amber);
  --mod-weak: var(--pg-tint-amber);
  --sans: var(--font-body);
  --serif: var(--font-heading);
  --mono: var(--font-mono);
}

.legacy-page .eyebrow,
.legacy-page .help,
.legacy-page .ref,
.legacy-page .caption,
.legacy-page .muted { color: var(--color-neutral-300) !important; }

/* ------------------------------------------------------------------- text */

.legacy-page .text-gray-500 { color: var(--color-neutral-500) !important; }
.legacy-page .text-gray-600,
.legacy-page .text-gray-700 { color: var(--color-neutral-300) !important; }
.legacy-page .text-gray-800,
.legacy-page .text-gray-900 { color: var(--color-heading) !important; }

/* text-white is left alone on purpose: it sits on the coloured hero panels,
   where real white is still what you want. */

/* ------------------------------------------------------------ accent/links */

.legacy-page .text-blue-600,
.legacy-page .text-blue-700,
.legacy-page .text-blue-800,
.legacy-page .text-indigo-600,
.legacy-page .hover\:text-blue-600:hover { color: var(--color-accent) !important; }

/* javedmai's own buttons are outlined, not filled, and in dark mode the accent
   is a pale green that white text cannot sit on. These filled blue buttons
   therefore become outlined accent buttons, which matches the site and fixes
   the contrast in the same move. The text-white alongside them has to be
   overridden here, since it would otherwise keep the label white. */
.legacy-page .bg-blue-600,
.legacy-page a.bg-blue-600,
.legacy-page button.bg-blue-600 {
  background-color: transparent !important;
  color: var(--color-accent) !important;
  border: 1px solid var(--color-accent);
  font-weight: 700;
}
.legacy-page .bg-blue-600:hover,
.legacy-page .hover\:bg-blue-700:hover {
  background-color: color-mix(in srgb, var(--color-accent) 12%, transparent) !important;
  color: var(--color-accent) !important;
}
.legacy-page .bg-blue-50,
.legacy-page .bg-blue-100,
.legacy-page .bg-indigo-100 { background-color: var(--pg-tint-blue) !important; }
.legacy-page .bg-blue-700 { background-color: transparent !important; color: var(--color-accent) !important; }
.legacy-page .text-blue-900 { color: var(--color-accent) !important; }
.legacy-page .ring-blue-500 { --tw-ring-color: var(--color-accent) !important; }

/* A filled success button. The page background is the one colour that
   contrasts with the status green under either theme. */
.legacy-page .bg-green-600 {
  background-color: var(--pg-green) !important;
  color: var(--color-bg) !important;
}

/* The About page has no full-bleed colour band except the stat band, so the
   section heroes drop their gradient entirely and sit on the page background.
   That also retires the white text they needed, which was the only pure white
   on the site outside the stat band. */
.legacy-page [class*="bg-gradient-to-"],
.legacy-page .gradient-bg {
  background-image: none !important;
  background-color: transparent !important;
}
.legacy-page [class*="bg-gradient-to-"],
.legacy-page .gradient-bg,
.legacy-page [class*="bg-gradient-to-"] .text-white,
.legacy-page .gradient-bg .text-white,
.legacy-page .gradient-bg p,
.legacy-page .gradient-bg div {
  color: var(--color-text) !important;
}
.legacy-page [class*="bg-gradient-to-"] h1,
.legacy-page [class*="bg-gradient-to-"] h2,
.legacy-page [class*="bg-gradient-to-"] h3,
.legacy-page .gradient-bg h1,
.legacy-page .gradient-bg h2,
.legacy-page .gradient-bg h3,
.legacy-page .gradient-text {
  color: var(--color-heading) !important;
}

/* --------------------------------------------------------- status colours */

.legacy-page .bg-green-100 { background-color: var(--pg-tint-green) !important; }
.legacy-page .bg-purple-100 { background-color: var(--pg-tint-purple) !important; }
.legacy-page .bg-yellow-100 { background-color: var(--pg-tint-amber) !important; }
.legacy-page .bg-red-100 { background-color: var(--pg-tint-red) !important; }

.legacy-page .text-green-50,
.legacy-page .text-green-500,
.legacy-page .text-green-600,
.legacy-page .text-green-800 { color: var(--pg-green) !important; }
.legacy-page .text-purple-600,
.legacy-page .text-purple-800 { color: var(--pg-purple) !important; }
.legacy-page .text-yellow-600,
.legacy-page .text-yellow-800 { color: var(--pg-amber) !important; }
.legacy-page .text-red-600 { color: var(--pg-red) !important; }

/* ------------------------------------------------------- the law readers */

/* Opting out of the bridge is not enough on its own: site.css paints <body>
   for every page on the site, so without this the law texts kept the dark
   background and light body copy and their own black headings became
   unreadable against it. These are the values the pages shipped with. */
body.pg-reader.original-theme {
  background-color: #f4f4f9 !important;
  color: #000000 !important;
  font-family: 'Segoe UI', Arial, sans-serif !important;
}
body.pg-reader.original-theme .content,
body.pg-reader.original-theme p,
body.pg-reader.original-theme li,
body.pg-reader.original-theme td,
body.pg-reader.original-theme th,
body.pg-reader.original-theme strong,
body.pg-reader.original-theme em { color: #000000; }
body.pg-reader.original-theme h1,
body.pg-reader.original-theme h2,
body.pg-reader.original-theme h3,
body.pg-reader.original-theme h4 { font-family: 'Segoe UI', Arial, sans-serif; letter-spacing: normal; }

/* .original-theme opts a reader out of the palette work below and keeps the
   look it arrived with. The four law texts use it: they are long statutory
   documents that were designed light, and they read better that way. The
   layout rules are not scoped, because the site header needs them whatever
   the colours. */

/* Their <body> is a flex row so the fixed sidebar and the content sit side by
   side. The site header is a block that belongs above both, so the body goes
   back to normal flow and the sidebar is offset under the header instead. */
body.pg-reader { display: block !important; margin: 0; }

body.pg-reader .sidebar {
  top: var(--pg-header-h);
  height: calc(100vh - var(--pg-header-h));
}
body.pg-reader:not(.original-theme) .sidebar {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border-right: 1px solid var(--color-divider);
}
body.pg-reader:not(.original-theme) .sidebar h2 { color: var(--color-heading) !important; }
body.pg-reader:not(.original-theme) .sidebar a { color: var(--color-neutral-300) !important; }
body.pg-reader:not(.original-theme) .sidebar a:hover,
body.pg-reader:not(.original-theme) .sidebar a.active { color: var(--color-accent) !important; }

body.pg-reader:not(.original-theme) .content { background-color: var(--color-bg); color: var(--color-text); }
body.pg-reader:not(.original-theme) .section {
  background-color: var(--color-surface) !important;
  border: 1px solid var(--color-divider);
  color: var(--color-text);
}
body.pg-reader:not(.original-theme) .section h1,
body.pg-reader:not(.original-theme) .section h2,
body.pg-reader:not(.original-theme) .section h3,
body.pg-reader:not(.original-theme) .section h4 { color: var(--color-heading) !important; }
/* The readers set explicit black on several inline elements, which disappears
   against a dark page. */
body.pg-reader:not(.original-theme) .section strong,
body.pg-reader:not(.original-theme) .section em,
body.pg-reader:not(.original-theme) .section li,
body.pg-reader:not(.original-theme) .section p,
body.pg-reader:not(.original-theme) .section td,
body.pg-reader:not(.original-theme) .section th { color: var(--color-text); }

/* Its own mobile bar sits below the site header rather than over it. It still
   earns its place: that Menu button opens the table of contents, which is a
   different thing from the site's Menu button. */
body.pg-reader .mobile-header { top: var(--pg-header-h); }
body.pg-reader:not(.original-theme) .mobile-header {
  background: var(--color-surface) !important;
  border-bottom: 1px solid var(--color-divider);
}
body.pg-reader:not(.original-theme) .brand-title { color: var(--color-heading) !important; }
/* The page background is the one colour guaranteed to contrast with the
   accent in both themes: dark text on the pale dark-mode green, light text on
   the deep light-mode green. */
body.pg-reader:not(.original-theme) .toggle-btn { background: var(--color-accent) !important; color: var(--color-bg) !important; }

/* The readers' penalty tables were built for a light page. */
body.pg-reader:not(.original-theme) table { border-color: var(--color-divider) !important; }
body.pg-reader:not(.original-theme) th {
  background: var(--color-surface) !important;
  color: var(--color-heading) !important;
  border-color: var(--color-divider) !important;
}
body.pg-reader:not(.original-theme) td {
  color: var(--color-text) !important;
  border-color: var(--color-divider) !important;
}

/* The assessment tool's "open in new tab" link. */
body.pg-reader:not(.original-theme) .open-new { color: var(--color-accent) !important; }

/* The assessment tool hard-codes a light card surface. */
body.pg-reader:not(.original-theme) .bar,
body.pg-reader:not(.original-theme) .card,
body.pg-reader:not(.original-theme) .panel {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border-color: var(--color-divider) !important;
}

@media (max-width: 960px) {
  body.pg-reader .sidebar { top: 0; height: 100vh; }
}

/* Contact form fields were a hand-picked grey, and the assessment tool's
   "open in new tab" link a Google-blue tint. Both now use site tokens. */
.legacy-page .form-input,
.legacy-page input,
.legacy-page textarea,
.legacy-page select {
  background-color: var(--color-surface) !important;
  color: var(--color-text) !important;
  border-color: var(--color-divider) !important;
}
body.pg-reader:not(.original-theme) .open-new {
  background: var(--pg-tint-blue) !important;
  color: var(--color-accent) !important;
}

/* The evaluators set their own monospace stack for statutory references. */
.legacy-page code,
.legacy-page .mono,
.legacy-page .ref { font-family: var(--font-mono); }

/* The hero panels carried white outline buttons, which only made sense on a
   coloured band. With the band gone they take the site's secondary button. */
.legacy-page .border-white {
  border-color: var(--color-divider) !important;
  color: var(--color-text) !important;
}

/* ---------------------------------------------------- copy rhythm + align */

/* The sub-pages centre their headings but every paragraph came out justified,
   because the site-wide `p, li { text-align: justify }` beats the centring
   inherited from .text-center. Inside a block the page marked as centred, the
   copy follows the heading. */
.legacy-page .text-center p,
.legacy-page .text-center li { text-align: center; text-justify: auto; }

/* The readers and the Tailwind pages carried their own paragraph spacing -
   20px in the law texts, nothing at all between list items - so body copy sat
   at a different rhythm on every page. These follow the site's. */
body.pg-reader .section p,
.legacy-page .panel p { margin: 0 0 var(--space-para); }
body.pg-reader .section li,
body.pg-reader .sidebar li { margin-bottom: var(--space-list); }
