:root {
  --ink: #202124;
  --muted: #60646b;
  --paper: #f5f2ea;
  --white: #ffffff;
  --purple: #7a2f7a;
  --purple-dark: #552054;
  --blue: #3867d6;
  --lime: #a7e33f;
  --amber: #f2b134;
  --red: #b42318;
  --green: #176b42;
  --border: #d4d0c7;
  --soft: #ece8df;
  --shadow: 0 18px 48px rgb(32 33 36 / 10%);
  --radius: 22px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; background: var(--paper); color: var(--ink); }
:is(img, .decorative-image), canvas, svg { max-width: 100%; height: auto; }
a { color: var(--purple-dark); text-underline-offset: .18em; }
a:hover { color: var(--blue); }
button, input, select { font: inherit; }
button, select, input { min-width: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
:focus-visible { outline: 4px solid var(--lime); outline-offset: 3px; }

.shell { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.skip-link { position: fixed; inset-block-start: .5rem; inset-inline-start: .5rem; transform: translateY(-160%); background: var(--ink); color: #fff; padding: .7rem 1rem; z-index: 100; border-radius: 10px; }
.skip-link:focus { transform: translateY(0); }

.site-header { background: rgb(245 242 234 / 96%); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(14px); }
.header-inner { min-height: 78px; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; min-width: max-content; }
.brand :is(img, .decorative-image) { flex: 0 0 auto; }
.brand span { display: grid; line-height: 1.15; }
.brand strong { font-size: 1.15rem; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: .72rem; margin-top: .2rem; }
.desktop-nav { display: flex; justify-content: center; align-items: center; gap: .25rem; }
.desktop-nav a { color: inherit; text-decoration: none; padding: .55rem .7rem; border-radius: 999px; font-weight: 650; font-size: .92rem; }
.desktop-nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.language-control { display: grid; gap: .15rem; font-size: .72rem; color: var(--muted); }
.language-control select { border: 1px solid var(--border); background: var(--white); border-radius: 10px; padding: .45rem 1.8rem .45rem .55rem; color: var(--ink); max-width: 9rem; }
.chapa-link { display: inline-flex; align-items: center; gap: .45rem; color: inherit; text-decoration: none; font-size: .82rem; font-weight: 700; }
.mobile-menu { display: none; }

.editorial-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: clamp(2rem, 7vw, 6rem); align-items: center; padding-block: clamp(3.2rem, 8vw, 7rem); }
.hero-copy h1, .page-hero h1 { font-size: clamp(2.8rem, 7vw, 6.6rem); line-height: .94; letter-spacing: -.065em; margin: .35rem 0 1.2rem; max-width: 13ch; }
.page-hero h1 { font-size: clamp(2.7rem, 6vw, 5.8rem); }
.eyebrow { margin: 0 0 .7rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 850; font-size: .75rem; color: var(--purple); }
.lead { font-size: clamp(1.12rem, 2vw, 1.45rem); color: var(--muted); max-width: 66ch; margin: 0; }
.fact-strip { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.5rem; }
.fact-strip span { border: 1px solid var(--border); border-radius: 999px; padding: .45rem .75rem; background: rgb(255 255 255 / 65%); font-size: .86rem; font-weight: 750; }
.hero-art { position: relative; min-height: 380px; display: grid; place-items: center; }
.hero-art::before { content: ""; position: absolute; width: 88%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 14%, #d7c3e4 15% 42%, #a7e33f 43% 61%, #3867d6 62% 100%); opacity: .22; filter: blur(1px); }
.hero-art > :is(img, .decorative-image) { position: relative; width: min(300px, 68vw); filter: drop-shadow(0 28px 32px rgb(32 33 36 / 18%)); }
.resolution-card { position: absolute; inset-inline-end: 0; inset-block-end: 2rem; display: grid; background: var(--white); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: .85rem 1rem; transform: rotate(-2deg); }
.resolution-card strong { font-size: 1.05rem; }
.resolution-card span { color: var(--muted); font-size: .82rem; }

.explainer, .prose-section, .privacy-grid { padding-block: 1rem 5rem; }
.section-heading { max-width: 800px; margin-bottom: 2rem; }
.section-heading h2, .prose-section > h2 { font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.045em; margin: 0 0 1rem; }
.section-heading p { color: var(--muted); font-size: 1.08rem; }
.fact-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; margin-bottom: 3rem; }
.fact-grid article, .card-grid article, .steps-grid article, .standards-grid article, .case-list article, .privacy-grid article { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: 0 7px 22px rgb(32 33 36 / 4%); }
.fact-grid article:nth-child(1) { border-top: 6px solid var(--blue); }
.fact-grid article:nth-child(2) { border-top: 6px solid var(--lime); }
.fact-grid article:nth-child(3) { border-top: 6px solid var(--purple); }
.fact-grid article.limits { border-top: 6px solid var(--amber); }
.fact-grid h3, .card-grid h3, .steps-grid h2, .steps-grid h3, .standards-grid h3, .case-list h2, .case-list h3 { margin-top: 0; font-size: 1.2rem; }
.fact-grid ul { padding-inline-start: 1.2rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.card-grid article { min-height: 190px; }
.card-grid article:nth-child(1) { background: #eaf0ff; }
.card-grid article:nth-child(2) { background: #f1f9df; }
.card-grid article:nth-child(3) { background: #f4e8f4; }

.tool-section { background: var(--ink); color: #fff; padding-block: clamp(4rem, 9vw, 7rem); }
.tool-section .section-heading p { color: #c8c9cc; }
.tool-section .eyebrow { color: var(--lime); }
.work-card { background: var(--white); color: var(--ink); border-radius: var(--radius); padding: clamp(1rem, 3vw, 2rem); margin-top: 1.1rem; box-shadow: var(--shadow); min-width: 0; }
.work-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.work-head h3, .work-card > h3 { margin: 0 0 .3rem; font-size: 1.45rem; line-height: 1.15; }
.work-head p, .work-card > p { margin: 0; color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.button { border: 2px solid var(--ink); border-radius: 999px; background: var(--lime); color: var(--ink); padding: .7rem 1rem; font-weight: 850; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; box-shadow: 3px 3px 0 var(--ink); }
.button:hover { color: var(--ink); transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--ink); }
.button.secondary { background: #e8eefe; }
.button.ghost { background: var(--white); }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; padding-block: 1rem; }
.field { display: grid; gap: .42rem; font-weight: 760; min-width: 0; }
.field small, .microcopy { color: var(--muted); font-weight: 450; font-size: .82rem; }
.field input:not([type="color"]), .field select { width: 100%; border: 1px solid #aeb0b4; border-radius: 11px; background: var(--white); padding: .7rem .75rem; color: var(--ink); }
.field.compact { min-width: min(260px, 100%); }
.field input[type="color"] { width: 100%; height: 52px; border: 1px solid #aeb0b4; border-radius: 11px; padding: .2rem; background: var(--white); }
.final-actions { border-top: 1px solid var(--border); padding-top: 1rem; }
.status-region { min-height: 1.6em; margin: 1rem 0 0; font-weight: 800; }
.status-region[data-level="success"] { color: var(--green); }
.status-region[data-level="warning"] { color: #865d00; }
.status-region[data-level="error"] { color: var(--red); }
.empty-state { border: 1px dashed #aaa; background: var(--paper); border-radius: 12px; padding: 1rem; color: var(--muted); }
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: .86rem; }
th, td { border-bottom: 1px solid var(--border); padding: .75rem .65rem; text-align: start; vertical-align: top; }
th { background: var(--paper); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; }
td code { overflow-wrap: anywhere; font-size: .78rem; }
.inventory-table td:first-child { min-width: 180px; }
.mini-badge { display: inline-block; margin-inline-start: .45rem; padding: .2rem .4rem; border-radius: 999px; background: #f1f9df; font-size: .68rem; font-weight: 850; }
.error-text { display: block; color: var(--red); margin-top: .3rem; }
.icon-button { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; font-size: 1.35rem; }
.icon-button:hover { background: #fce8e6; }
.status-pill, .summary-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: .28rem .55rem; font-weight: 850; font-size: .72rem; white-space: nowrap; }
.status-pill[data-status="pass"], .summary-pill[data-status="pass"], .status-pill[data-status="ready"] { background: #dff4e8; color: var(--green); }
.status-pill[data-status="warning"], .summary-pill[data-status="warning"], .status-pill[data-status="processing"] { background: #fff0c2; color: #755400; }
.status-pill[data-status="fail"], .summary-pill[data-status="fail"], .status-pill[data-status="failed"] { background: #fce8e6; color: var(--red); }
.status-pill[data-status="not-evaluable"] { background: #e8e9eb; color: #555; }
.rule-list { display: grid; gap: 1rem; }
.rule-card { border: 1px solid var(--border); border-radius: 15px; overflow: hidden; }
.rule-card > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; background: #f8f7f3; }
.rule-card h4 { margin: 0; font-size: 1.05rem; }
.rule-card header p { margin: .2rem 0 0; color: var(--muted); font-size: .82rem; }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.duplicate-list { padding-inline-start: 1.2rem; }
.duplicate-list li { margin-bottom: .9rem; }
.duplicate-list code { overflow-wrap: anywhere; }
.colour-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-block: 1rem; }
.contrast-card { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .8rem; border: 1px solid var(--border); border-radius: 14px; padding: .9rem; }
.contrast-number { font-size: 1.55rem; }
.contrast-sample { justify-self: stretch; border-radius: 9px; padding: .7rem; text-align: center; font-weight: 850; border: 1px solid currentColor; }
.preview-card canvas { width: 100%; background: var(--paper); border: 1px solid var(--border); border-radius: 15px; display: block; }
.vision-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.vision-buttons button { border: 1px solid var(--ink); border-radius: 999px; padding: .5rem .75rem; background: var(--white); font-weight: 750; }
.vision-buttons button[aria-pressed="true"] { background: var(--purple); color: #fff; }
.normalize-panel { display: grid; grid-template-columns: 1fr minmax(260px, .8fr) auto; gap: 1rem; align-items: center; border-top: 1px solid var(--border); padding-top: 1rem; }
.normalize-panel h4 { margin: 0; }
.normalize-panel p { color: var(--muted); margin: .25rem 0 0; }
.check-row { display: flex; align-items: flex-start; gap: .6rem; }
.check-row input { margin-top: .3rem; }

.page-hero { padding-block: clamp(3rem, 8vw, 6rem) 3rem; }
.prose-section { max-width: 1080px; }
.steps-grid, .standards-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; margin-bottom: 3rem; }
.steps-grid article { border-inline-start: 7px solid var(--blue); }
.standards-grid article { border-inline-start: 7px solid var(--purple); }
.note { border-radius: var(--radius); background: #eaf0ff; border: 1px solid #b7c8f4; padding: 1.4rem; margin-top: 2rem; }
.note h2 { margin-top: 0; }
.warning-note { background: #fff0c2; border-color: #e4c66a; }
.case-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.case-list article span { text-transform: uppercase; letter-spacing: .09em; font-size: .7rem; font-weight: 850; color: var(--purple); }
.privacy-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.privacy-grid h2 { margin-top: 0; }
.privacy-grid .wide { grid-column: 1 / -1; }
.not-found { min-height: 70vh; display: grid; place-items: center; align-content: center; text-align: center; padding-block: 5rem; }
.not-found h1 { font-size: clamp(2.4rem, 6vw, 5rem); margin: .5rem 0; }
.not-found p { color: var(--muted); max-width: 52ch; }

.chapa-principles { background: #111; color: #fff; border-top: 1px solid #333; }
.banner-inner { min-height: 72px; padding-block: .85rem; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .8rem 1.5rem; }
.chapa-principles p { margin: 0; font-weight: 850; }
.chapa-principles nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .8rem; }
.chapa-principles a { color: #fff; }

[dir="rtl"] .hero-copy h1, [dir="rtl"] .page-hero h1 { letter-spacing: 0; }
[dir="rtl"] .rule-card > header, [dir="rtl"] .work-head { text-align: start; }

@media (max-width: 980px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .desktop-nav { display: none; }
  .mobile-menu { display: block; justify-self: end; position: relative; }
  .mobile-menu summary { list-style: none; font-weight: 800; cursor: pointer; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--white); }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu nav { position: absolute; inset-inline-end: 0; top: calc(100% + .45rem); min-width: 210px; display: grid; padding: .5rem; background: var(--white); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow); }
  .mobile-menu nav a { padding: .6rem; border-radius: 8px; text-decoration: none; color: var(--ink); }
  .mobile-menu nav a[aria-current="page"] { background: var(--ink); color: #fff; }
  .chapa-link span { display: none; }
  .editorial-hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 300px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .normalize-panel { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 1rem, 1180px); }
  .site-header { position: static; }
  .header-inner { min-height: 68px; gap: .55rem; }
  .brand small { display: none; }
  .brand :is(img, .decorative-image) { width: 40px; height: 40px; }
  .language-control span { display: none; }
  .language-control select { max-width: 7rem; }
  .editorial-hero { padding-block: 2.7rem 3.5rem; }
  .hero-copy h1 { font-size: clamp(2.55rem, 15vw, 4.2rem); }
  .hero-art { min-height: 250px; }
  .hero-art > :is(img, .decorative-image) { width: 210px; }
  .resolution-card { inset-inline-end: .5rem; inset-block-end: .5rem; }
  .fact-grid, .card-grid, .results-grid, .steps-grid, .standards-grid, .case-list, .privacy-grid { grid-template-columns: 1fr; }
  .privacy-grid .wide { grid-column: auto; }
  .settings-grid { grid-template-columns: 1fr; }
  .work-head { flex-direction: column; }
  .work-head .button-row, .work-head .field { width: 100%; }
  .button-row .button { flex: 1 1 auto; }
  .colour-grid { grid-template-columns: 1fr 1fr; }
  .contrast-card { grid-template-columns: 1fr; }
  .contrast-sample { justify-self: stretch; }
  .banner-inner { grid-template-columns: 1fr; text-align: center; }
  .chapa-principles nav { justify-content: center; }
}

@media (max-width: 390px) {
  .header-inner { grid-template-columns: auto auto 1fr; }
  .brand strong { font-size: 1rem; }
  .mobile-menu { justify-self: start; }
  .language-control { justify-self: end; }
  .chapa-link { display: none; }
  .colour-grid { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .button-row { width: 100%; }
  .vision-buttons button { flex: 1 1 45%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .button:hover { transform: none; }
}

.resolution-guide table { min-width: 0; width: 100%; }
.resolution-guide th, .resolution-guide td { white-space: normal; padding: .75rem .5rem; }
