/* Simplified Orthodontics Studio: shared styles for the articles and their index pages (/articles/, /ar/articles/),
   also used by the tutorials pages (/tutorials/, /ar/tutorials/).
   Same tokens, header and buttons as the tool landing pages (which keep their own <style>); the footer is in /footer.css.
   Index pages use the defaults; article pages add class="page-art" to <body>.
   Right-to-left pages (<html dir="rtl">) get the Arabic type settings of /ar/; layout uses logical properties. */
:root{
  --bg:#e9eef2;--panel:#fff;--panel2:#f3f6f9;--ink:#13222e;--muted:#566877;--line:#d3dce3;
  --accent:#0a67ad;--accent-strong:#084a80;--accent-soft:#dcedf9;--on-accent:#fff;
  --ok:#1a7f55;--ok-soft:#cfe9dc;--warn:#b86a00;--warn-bg:#fdf0da;--bad:#b3261e;--bad-bg:#fbe3e1;
  --ax:#a86c00;--co:#0e7f92;--sa:#b0387a;
  --f:"Barlow",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --fc:"Barlow Semi Condensed","Barlow","Arial Narrow",system-ui,sans-serif;
  --r:18px;
  color-scheme:light;
  box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);
}
html[dir="rtl"]{
  --f:"Barlow",system-ui,-apple-system,"Segoe UI",Tahoma,Roboto,"Noto Sans Arabic",sans-serif;
  --fc:"Barlow Semi Condensed","Barlow",system-ui,-apple-system,"Segoe UI",Tahoma,"Noto Sans Arabic",sans-serif;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#0c141b;--panel:#141e27;--panel2:#1a2632;--ink:#e4ecf2;--muted:#95a6b4;--line:#283746;
  --accent:#56b3f5;--accent-strong:#8ccbf8;--accent-soft:#16344b;--on-accent:#04121d;
  --ok:#4cc58f;--ok-soft:#1d4a37;--warn:#f0b04d;--warn-bg:#3d2e12;--bad:#ff8a80;--bad-bg:#4a1d1a;
  --ax:#f2b54a;--co:#3fc9dd;--sa:#e56aa9;color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#0c141b;--panel:#141e27;--panel2:#1a2632;--ink:#e4ecf2;--muted:#95a6b4;--line:#283746;
  --accent:#56b3f5;--accent-strong:#8ccbf8;--accent-soft:#16344b;--on-accent:#04121d;
  --ok:#4cc58f;--ok-soft:#1d4a37;--warn:#f0b04d;--warn-bg:#3d2e12;--bad:#ff8a80;--bad-bg:#4a1d1a;
  --ax:#f2b54a;--co:#3fc9dd;--sa:#e56aa9;color-scheme:dark}
*,*::before,*::after{box-sizing:inherit}
[hidden]{display:none!important}
html{scroll-behavior:smooth;scroll-padding-top:calc(76px + env(safe-area-inset-top,0px))}
body{margin:0;background:var(--bg);color:var(--ink);font:400 16px/1.55 var(--f);-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%}
body.page-art{font:400 17px/1.65 var(--f)}
html[dir="rtl"] body{font:400 16.5px/1.7 var(--f)}
a{color:var(--accent)}
img{max-width:100%;height:auto}
:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:8px}
.wrap{width:100%;max-width:1160px;margin:0 auto;padding:0 22px}
h1,h2,h3,h4{font-family:var(--fc);font-weight:600;letter-spacing:-.01em;margin:0}
html[dir="rtl"] :is(h1,h2,h3,h4){font-weight:700;letter-spacing:0}
.vh{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* header */
.bar{position:sticky;top:0;z-index:20;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(1.4) blur(10px);-webkit-backdrop-filter:saturate(1.4) blur(10px);border-bottom:1px solid transparent}
.bar.stuck{border-bottom-color:var(--line)}
.bar .wrap{display:flex;align-items:center;gap:14px;min-height:68px}
.brand{display:flex;align-items:center;gap:11px;color:var(--ink);text-decoration:none;font:600 19px/1.1 var(--fc);letter-spacing:-.005em}
.brand img{border-radius:10px;flex:none}
.bar nav{margin-inline-start:auto;display:flex;gap:4px}
.bar nav a{color:var(--ink);text-decoration:none;font-weight:500;font-size:15px;padding:8px 11px;border-radius:9px}
.bar nav a:hover{background:var(--panel)}
.lang{color:var(--ink);text-decoration:none;font:500 15px/1 system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;padding:8px 12px;border:1px solid var(--line);border-radius:999px;background:var(--panel)}
html[dir="rtl"] .lang{font-family:var(--f)}
.lang:hover{border-color:var(--accent)}
.tslot .so-theme{width:40px;height:40px;border-radius:10px;border:1px solid var(--line);background:var(--panel);color:var(--ink);cursor:pointer}
.tslot .so-theme:hover{border-color:var(--accent)}

/* breadcrumb */
.crumbs{margin:18px 0 0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:4px 8px;font-size:14px;color:var(--muted)}
.crumbs li+li::before{content:"›";margin-inline-end:8px}
html[dir="rtl"] .crumbs li+li::before{content:"‹"}
.crumbs a{color:var(--muted)}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 16px;border-radius:11px;border:1px solid var(--line);background:var(--panel);color:var(--ink);font:600 15px/1.2 var(--f);text-decoration:none;cursor:pointer}
.btn:hover{border-color:var(--accent)}
.btn.pri{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.btn.pri:hover{background:var(--accent-strong);border-color:var(--accent-strong)}
.cta{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}

/* index pages */
.hero{padding-top:22px}
.hero h1{font-size:clamp(36px,4.8vw,56px);line-height:1.02;letter-spacing:-.02em;max-width:14em}
html[dir="rtl"] .hero h1{font-size:clamp(34px,4.6vw,54px);line-height:1.25;letter-spacing:0}
.sub{font-size:clamp(17px,1.5vw,19px);line-height:1.5;color:var(--muted);margin:16px 0 0;max-width:40em}
html[dir="rtl"] .sub{line-height:1.6}
section.blk{padding-top:48px}
section.blk h2{font-size:clamp(24px,2.8vw,30px);line-height:1.1}
html[dir="rtl"] section.blk h2{font-size:clamp(23px,2.7vw,29px);line-height:1.35}
section.blk h2 a{color:inherit;text-decoration:none}
.intro{margin:12px 0 0;color:var(--muted);max-width:60ch}
.list{list-style:none;margin:16px 0 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.list a{display:block;height:100%;padding:16px 18px;background:var(--panel);border:1px solid var(--line);border-radius:14px;text-decoration:none;color:var(--ink)}
.list a:hover{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
.list h3{font-size:21px;line-height:1.2}
html[dir="rtl"] .list h3{line-height:1.3}
html[dir="rtl"] .list h3[lang="en"]{font-weight:600;letter-spacing:-.01em;line-height:1.2}
.list p{margin:6px 0 0;color:var(--muted);font-size:15px}
.list .meta{margin-top:10px;font-size:13.5px;color:var(--muted)}
.note{margin:40px 0 0;color:var(--muted);font-size:14.5px;max-width:80ch}

/* article */
.art{max-width:760px;padding-top:22px}
.art h1{font-size:clamp(34px,4.6vw,52px);line-height:1.04;letter-spacing:-.02em}
.byline{margin:14px 0 0;color:var(--muted);font-size:15px}
.art h2{font-size:clamp(25px,3vw,32px);line-height:1.12;margin:48px 0 0}
.art h3{font-size:21px;line-height:1.2;margin:28px 0 0}
.art p,.art ul,.art ol{margin:14px 0 0}
.art li+li{margin-top:6px}
.keys{margin:26px 0 0;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:16px 20px}
.keys h2{font-size:20px;margin:0}
.art .keys h2{margin:0}
.keys ul{margin:10px 0 0;padding-inline-start:20px}
.formula{margin:16px 0 0;background:var(--panel);border:1px solid var(--line);border-inline-start:4px solid var(--accent);border-radius:12px;padding:14px 18px;font-size:16.5px}
.formula p{margin:0}
.art .formula p{margin:0}
.formula p+p,.art .formula p+p{margin-top:8px}
.fig{margin:22px 0 0;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.fig svg{display:block;width:100%;height:auto;background:var(--panel2);border-bottom:1px solid var(--line);direction:ltr}
.fig figcaption{padding:12px 16px 14px;color:var(--muted);font-size:15px}
.fig figcaption b{color:var(--ink);font-weight:600}
.fig text{font:500 15px var(--f);fill:var(--ink);text-anchor:middle}
.fig text.lb{font-size:15px;fill:var(--muted)}
.fig .t{fill:var(--panel);stroke:var(--line);stroke-width:1.5}
.fig .t.a{fill:var(--accent-soft);stroke:var(--accent)}
/* teeth whose widths are estimated, not measured (mixed dentition) */
.fig .t.est{stroke-dasharray:6 4}
.fig .br,.fig .dim{fill:none;stroke:var(--muted);stroke-width:1.5}
.fig .dim{stroke:var(--accent);stroke-width:2}
.fig .pt{fill:var(--accent)}
/* cephalometric line drawings */
.fig .ln{fill:none;stroke:var(--ink);stroke-width:1.6}
.fig .ln2{fill:none;stroke:var(--muted);stroke-width:1.5;stroke-dasharray:7 5}
.fig .tooth{fill:none;stroke:var(--accent);stroke-width:4;stroke-linecap:round}
.fig .arc,.fig .arc2{fill:none;stroke:var(--accent);stroke-width:2}
.fig .arc2{stroke:var(--ok)}
.fig text.pl{font-weight:600}
.fig text.al{fill:var(--accent);font-size:14px;font-weight:600}
.fig text.al2{fill:var(--ok);font-size:14px;font-weight:600}
.fig text.tl{fill:var(--accent);font-weight:600}
/* schematic profile and smile drawings (Face articles): never photos, only these flat shapes */
.fig .ring{fill:var(--panel2);stroke:var(--ok);stroke-width:2}
.fig .mouth{fill:#3a4650;stroke:none}
/* teeth stay light and the mouth dark in both themes, as in a real smile, so these two do not use the theme tokens */
.fig .tw{fill:#f4f6f8;stroke:#9aa7b2;stroke-width:1.2}
.fig .gum{fill:var(--accent-soft);stroke:var(--line);stroke-width:1}
.fig .lip{fill:var(--panel);stroke:var(--muted);stroke-width:2}
/* CBCT drawings: each plane in the colour Simplified CBCT gives it (axial amber, coronal cyan, sagittal magenta) */
.fig .pax,.fig .pco,.fig .psa{fill-opacity:.28;stroke-width:1.5}
.fig .pax{fill:var(--ax);stroke:var(--ax)}
.fig .pco{fill:var(--co);stroke:var(--co)}
.fig .psa{fill:var(--sa);stroke:var(--sa)}
.fig .lax,.fig .lco,.fig .lsa{fill:none;stroke-width:2}
.fig .lax{stroke:var(--ax)}
.fig .lco{stroke:var(--co)}
.fig .lsa{stroke:var(--sa)}
.fig text.tax,.fig text.tco,.fig text.tsa{font-weight:600}
.fig text.tax{fill:var(--ax)}
.fig text.tco{fill:var(--co)}
.fig text.tsa{fill:var(--sa)}
.fig .archb{fill:none;stroke:var(--line);stroke-width:36;stroke-linecap:round}
.fig .band{fill:none;stroke:var(--accent-soft);stroke-width:22;stroke-linecap:round}
/* drawings of artefacts look like grey slices in both themes, so these shades do not use the theme tokens */
.fig .sc{fill:#59636c}
.fig .scm{fill:#7c868e}
.fig .scl{fill:#eef1f3}
.fig .scd{fill:#22282d}
.fig .scls,.fig .scds{fill:none;stroke-width:2}
.fig .scls{stroke:#eef1f3;stroke-opacity:.7}
.fig .scds{stroke:#22282d;stroke-opacity:.7}
.fig .sco{fill:none;stroke:#eef1f3;stroke-width:3}
.fig .sco.faint{stroke-opacity:.5}
.tbl{width:100%;overflow-x:auto;margin:16px 0 0}
table{border-collapse:collapse;width:100%;font-size:15.5px;background:var(--panel);border:1px solid var(--line);border-radius:12px;overflow:hidden}
th,td{padding:9px 12px;text-align:start;border-bottom:1px solid var(--line);vertical-align:top}
th{font-weight:600;background:var(--panel2)}
tr:last-child td{border-bottom:0}
td.n{font-variant-numeric:tabular-nums;white-space:nowrap}
.art .note{margin:14px 0 0;max-width:none;color:var(--muted);font-size:15px;border-top:1px solid var(--line);padding-top:14px}

/* calculator */
.calc{margin:18px 0 0;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);padding:16px 18px 18px}
.calc .learn{margin:0;color:var(--muted);font-size:15px}
.calc fieldset{border:0;margin:14px 0 0;padding:0;min-width:0}
.calc legend{font:600 17px/1.2 var(--fc);padding:0;margin-bottom:8px}
.teeth{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:6px}
.teeth label{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.teeth label:nth-child(6){margin-inline-end:6px}
.teeth input{width:100%;min-width:0;height:40px;text-align:center;font:500 15px var(--f);color:var(--ink);background:var(--panel2);border:1px solid var(--line);border-radius:8px;padding:0 2px}
.teeth input:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 2px var(--accent-soft)}
.teeth input[aria-invalid="true"]{border-color:var(--bad);background:var(--bad-bg)}
.calc .cta{margin-top:14px}
.calc-out{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}
.calc-res{background:var(--panel2);border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.calc-res h4{font-size:18px}
.calc-res dl{display:grid;grid-template-columns:1fr auto;gap:4px 12px;margin:8px 0 0;font-size:15px}
.calc-res dt{color:var(--muted)}
.calc-res dd{margin:0;max-width:11em;text-align:end;font-variant-numeric:tabular-nums;font-weight:500}
.calc-res dd.calc-big{font-size:18px;font-weight:600}
.calc-res dd.calc-ok{color:var(--ok)}.calc-res dd.calc-warn{color:var(--warn)}.calc-res dd.calc-bad{color:var(--bad)}
.calc-need,.calc-how{margin:8px 0 0;color:var(--muted);font-size:14.5px}
.calc-out .calc-wide{grid-column:1/-1;margin:0}
.calc .pick{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:14px 0 0;font-weight:500}
.calc select{min-height:40px;padding:0 10px;font:500 15px var(--f);color:var(--ink);background:var(--panel2);border:1px solid var(--line);border-radius:8px}
/* Tooth rows keep the dental chart order (patient's right on the left) on right-to-left pages too, as in the figures. */
html[dir="rtl"] .teeth{direction:ltr}
.teeth.four{grid-template-columns:repeat(4,minmax(0,4.5em))}
.teeth.four label:nth-child(6){margin-inline-end:0}
/* Carey: ten teeth from 45 to 35, the gap at the midline after the fifth. Little: five contacts. */
.teeth.ten{grid-template-columns:repeat(10,minmax(0,1fr))}
.teeth.ten label:nth-child(6){margin-inline-end:0}
.teeth.ten label:nth-child(5){margin-inline-end:6px}
.teeth.five{grid-template-columns:repeat(5,minmax(0,5em))}
.teeth.five label:nth-child(6){margin-inline-end:0}
/* Perimeter segments: a label above each input. */
.segs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px}
.segs label{display:flex;flex-direction:column;gap:4px;font-size:14.5px;color:var(--muted)}
.segs input{width:100%;max-width:8em;height:40px;text-align:center;font:500 15px var(--f);color:var(--ink);background:var(--panel2);border:1px solid var(--line);border-radius:8px;padding:0 2px}
.segs input:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 2px var(--accent-soft)}
.segs input[aria-invalid="true"]{border-color:var(--bad);background:var(--bad-bg)}

/* tool box, references, related */
.tool{margin:40px 0 0;background:var(--accent-soft);border:1px solid color-mix(in srgb,var(--accent) 35%,transparent);border-radius:var(--r);padding:18px 20px}
.tool h2,.art .tool h2{margin:0;font-size:24px}
.tool p,.art .tool p{margin:8px 0 0}
.refs{padding-inline-start:22px;font-size:15px;color:var(--muted)}
.refs li{overflow-wrap:anywhere}
.refs li+li{margin-top:8px}
.rel{list-style:none;padding:0;display:grid;gap:8px}
.rel a{display:block;padding:12px 14px;background:var(--panel);border:1px solid var(--line);border-radius:12px;text-decoration:none;color:var(--ink);font:600 17px/1.25 var(--fc)}
.rel a small{display:block;font:400 14px/1.35 var(--f);color:var(--muted);margin-top:2px}
.rel a:hover{border-color:var(--accent)}

footer{padding-top:56px;padding-bottom:36px}

@media (max-width:760px){
  .wrap{padding:0 16px}
  .bar .wrap{flex-wrap:wrap;gap:4px 10px;min-height:60px;padding-top:8px;padding-bottom:6px}
  .bar nav{order:3;flex:1 1 calc(100% - 100px);width:auto;min-width:0;margin:0;margin-inline-start:-8px;overflow-x:auto;scrollbar-width:none}
  .page-art .bar nav{flex:1 1 100%}
  .bar nav::-webkit-scrollbar{display:none}
  .bar nav a{white-space:nowrap;padding:7px 9px}
  .tslot{margin-inline-start:auto}
  .lang{order:4;padding:6px 10px;font-size:14px}
  .brand{font-size:17px}
  .brand img{width:34px;height:34px}
  .list{grid-template-columns:1fr}
  body.page-art{font-size:16.5px}
  .teeth{grid-template-columns:repeat(6,minmax(0,1fr));row-gap:10px}
  .teeth label:nth-child(6){margin-inline-end:0}
  .teeth.ten{grid-template-columns:repeat(5,minmax(0,1fr))}
  .teeth.ten label:nth-child(5){margin-inline-end:0}
  .segs{grid-template-columns:1fr}
  .calc{padding:14px}
  .calc-out{grid-template-columns:1fr}
  .cta .btn{flex:1 1 auto}
}

/* YouTube responsive 16:9 embed & clinical callouts */
.vid{margin:24px 0 0;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);overflow:hidden}
.vid-frame{position:relative;width:100%;aspect-ratio:16/9;background:#000}
.vid-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.vid figcaption{padding:12px 16px 14px;color:var(--muted);font-size:15px}
.vid figcaption b{color:var(--ink);font-weight:600}
.rev-badge{margin:10px 0 0;display:inline-flex;flex-wrap:wrap;align-items:center;gap:8px;padding:6px 12px;background:var(--panel);border:1px solid var(--line);border-radius:999px;font-size:14px;color:var(--muted)}
.rev-badge strong{color:var(--ink);font-weight:600}
.faq-list{margin:18px 0 0;display:grid;gap:12px}
.faq-item{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:16px 18px}
.faq-item h3{margin:0;font-size:19px}
.faq-item p{margin:8px 0 0;color:var(--ink)}

/* SVG figure classes used by some articles but missing before (anb-wits, bjork, norms, mcnamara, tweed, pont, soft-tissue, jarabak, aligner-open-bite, measurement-error, photo-comparability).
   Without these rules the shapes use the browser default fill (solid black). */
.fig .arr,.fig .ax,.fig .measure{fill:none;stroke:var(--accent);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.fig .ax{stroke:var(--muted);stroke-width:1.5}
.fig .box,.fig .p,.fig .panel{fill:var(--panel);stroke:var(--line);stroke-width:1.5}
.fig .bone{fill:var(--accent-soft);stroke:var(--line);stroke-width:1.5}
.fig .hi{fill:none;stroke:var(--ok);stroke-width:3;stroke-linecap:round}
.fig marker path:not([fill]){fill:var(--ink)}
.fig #arr path{fill:var(--accent)}
.fig text.diagram-heading{font-size:15px;font-weight:600}
.fig text.diagram-label{font-size:14px}
.fig text.diagram-small{font-size:13px}
.fig text.diagram-heading:not([text-anchor="middle"]),.fig text.diagram-label:not([text-anchor="middle"]),.fig text.diagram-small:not([text-anchor="middle"]){text-anchor:start}
.fig circle.a{fill:var(--accent-soft);stroke:var(--accent);stroke-width:1.5}
