/* ═══════════════════════════════════════════════════
   OrthoClarity — Global Stylesheet (Blog Edition)
   WCAG 2.1 AA compliant · Patient-friendly · Accessible
   ═══════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:        #1154A0;
  --brand-dark:   #0C3F78;
  --brand-mid:    #1A6FC4;
  --brand-light:  #EBF4FF;
  --brand-xlight: #F5F9FF;
  --green:        #16763A;
  --green-bg:     #EDFBF2;
  --amber:        #B45309;
  --amber-bg:     #FFFBEB;
  --red:          #B91C1C;
  --red-bg:       #FEF2F2;
  --bg:           #F4F8FE;
  --surface:      #FFFFFF;
  --surface2:     #F8FAFD;
  --border:       #D0DFF0;
  --border2:      #E4EEF8;
  --text:         #0D1F35;
  --text2:        #2B4360;
  --text3:        #4A6580;
  --text4:        #7896B0;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --shadow-sm:    0 1px 4px rgba(17,84,160,0.08);
  --shadow-md:    0 4px 16px rgba(17,84,160,0.10);
  --shadow-lg:    0 8px 32px rgba(17,84,160,0.13);
  --base-font-size: 16px;
}

/* ── TEXT SIZE SCALING (controlled by accessibility.js) ── */
html.size-normal { font-size: var(--base-font-size); }
html.size-large   { font-size: 19px; }
html.size-xl      { font-size: 22px; }

/* ── HIGH CONTRAST THEME ── */
html.high-contrast {
  --brand:        #003C8F;
  --brand-dark:   #00276B;
  --brand-mid:    #0050B3;
  --brand-light:  #DCE9FF;
  --green:        #0B5D26;
  --green-bg:     #E3F9EA;
  --amber:        #7A3D00;
  --amber-bg:     #FFF1DB;
  --red:          #8B0000;
  --red-bg:       #FFE3E3;
  --bg:           #FFFFFF;
  --surface:      #FFFFFF;
  --surface2:     #F0F0F0;
  --border:       #000000;
  --border2:      #333333;
  --text:         #000000;
  --text2:        #000000;
  --text3:        #1A1A1A;
  --text4:        #333333;
}
html.high-contrast body { background: #FFFFFF; }
html.high-contrast .site-header,
html.high-contrast .blog-card,
html.high-contrast footer { border-width: 2px; }
html.high-contrast a { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #A8C4DC; border-radius: 4px; }

:focus-visible {
  outline: 3px solid var(--brand-mid);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── SKIP LINK ── */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand); color: #fff;
  padding: 12px 20px; border-radius: 0 0 8px 0;
  font-weight: 700; font-size: 14px; z-index: 200;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* ── ACCESSIBILITY TOOLBAR ── */
.a11y-bar {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
  padding: 8px 20px; font-size: 13px; flex-wrap: wrap;
}
.a11y-label { color: var(--text3); font-weight: 600; margin-right: 4px; font-size: 12px; }
.a11y-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text2); font-weight: 700; font-size: 13px;
  padding: 5px 10px; border-radius: 7px; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.a11y-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.a11y-btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand-dark); }
.a11y-contrast-btn { margin-left: 4px; }

/* ── SITE HEADER ── */
.site-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 100;
}
.site-header img { height: 44px; }
.site-header-brand strong { display: block; font-size: 16px; font-weight: 700; color: var(--text); }
.site-header-brand span { font-size: 11px; color: var(--text3); }
.site-header nav { margin-left: auto; display: flex; gap: 4px; }
.site-header nav a {
  text-decoration: none; color: var(--text2); font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: var(--radius-sm); transition: all .18s;
}
.site-header nav a:hover { background: var(--brand-light); color: var(--brand); }
.site-header nav a.active { background: var(--brand); color: #fff; }

/* ── FOOTER ── */
footer {
  text-align: center; padding: 28px 20px;
  font-size: 12px; color: var(--text3);
  background: var(--surface); border-top: 1px solid var(--border);
  line-height: 1.8;
}
footer a { color: var(--brand); text-decoration: none; font-weight: 500; }
footer a:hover { text-decoration: underline; }

/* ── TAGS ── */
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag-brand { background: var(--brand-light); color: var(--brand); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-red   { background: var(--red-bg);   color: var(--red); }
.tag-amber { background: var(--amber-bg); color: var(--amber); }

@media (max-width: 640px) {
  .site-header nav { display: none; }
  .site-header { padding: 12px 16px; }
}

/* ── BLOG STYLES ── */
.blog-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 24px;
}

/* Category filter */
.category-filter {
  display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: center; margin-bottom: 36px;
}
.filter-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text2); font-size: 13px; font-weight: 600;
  padding: 8px 18px; border-radius: 20px; cursor: pointer;
  transition: all .18s; font-family: inherit;
}
.filter-btn:hover { border-color: var(--brand); color: var(--brand); }
.filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand-dark); }

.blog-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}

.blog-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.blog-card-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.blog-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand);
  background: var(--brand-light);
  padding: 4px 10px;
  border-radius: 4px;
}
.blog-category.cat-video { color: var(--red); background: var(--red-bg); }
.blog-category.cat-guideline { color: var(--green); background: var(--green-bg); }

.video-badge { font-size: 13px; }

.blog-date {
  font-size: 13px;
  color: var(--text4);
}

.blog-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.2;
}

.blog-card-excerpt {
  font-size: 16px;
  color: var(--text2);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border2);
  padding-top: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
}

.blog-read-more {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
}

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text4);
  font-size: 15px;
}

/* ── POST DETAIL STYLES ── */
.post-header {
  margin-bottom: 40px;
  text-align: center;
}

.post-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  color: var(--text);
  margin: 16px 0;
  line-height: 1.15;
}

.post-body {
  font-size: 18px;
  line-height: 1.8;
  color: var(--text2);
}

.post-body p {
  margin-bottom: 24px;
}

.post-body h3 {
  font-family: 'Syne', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 40px 0 16px;
}

.post-body ul {
  margin-bottom: 24px;
  padding-left: 24px;
}

.post-body li {
  margin-bottom: 8px;
}

/* Responsive video embed wrapper (16:9) */
.video-embed {
  position: relative; width: 100%; padding-top: 56.25%;
  margin: 8px 0 32px; background: #000; border-radius: var(--radius-md);
  overflow: hidden;
}
.video-embed iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}
.video-embed-caption {
  font-size: 13px; color: var(--text4); margin-top: -20px; margin-bottom: 24px;
}

.btn-back {
  display: inline-block;
  margin-top: 40px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.btn-back:hover {
  text-decoration: underline;
}

/* ── ABOUT PAGE ── */
.page-hero {
  background: linear-gradient(160deg, #dceefb 0%, #c6e0f5 100%);
  padding: 60px 32px 50px; text-align: center;
  border-bottom: 1px solid #b0cfe8;
}
html.high-contrast .page-hero { background: var(--surface2); }
.page-hero .eyebrow {
  font-size: 11px; letter-spacing: 2.5px; color: var(--brand);
  text-transform: uppercase; margin-bottom: 14px; font-weight: 700;
}
.page-hero h1 {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 36px;
  color: var(--text); margin-bottom: 12px;
}
.page-hero p {
  font-size: 15px; color: var(--text2); max-width: 560px;
  margin: 0 auto; line-height: 1.7;
}

.container { max-width: 860px; margin: 0 auto; padding: 52px 24px 80px; }
.section { margin-bottom: 48px; }
.section-label {
  font-size: 11px; letter-spacing: 2px; color: var(--brand);
  text-transform: uppercase; margin-bottom: 10px; font-weight: 700;
}
.section h2 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 24px; color: var(--text); margin-bottom: 16px; }

.about-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 16px; padding: 26px 28px;
  box-shadow: 0 2px 10px rgba(17,84,160,0.05);
}
.about-card p { font-size: 15px; color: var(--text2); line-height: 1.8; }
.about-card p + p { margin-top: 14px; }

.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.who-card { border-radius: 16px; padding: 26px; border: 1.5px solid; }
.who-card.patients { background: var(--green-bg); border-color: #a7f3d0; }
.who-card h3 { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px; margin-bottom: 10px; }
.who-card.patients h3 { color: var(--green); }
.who-card p { font-size: 14px; color: var(--text2); line-height: 1.75; }

.disclaimer-box {
  background: var(--amber-bg); border: 1px solid #fde68a;
  border-left: 4px solid var(--amber); border-radius: 12px; padding: 22px 24px;
}
.disclaimer-box p { font-size: 14px; color: #78350f; line-height: 1.8; }
html.high-contrast .disclaimer-box p { color: var(--text); }
.disclaimer-box p + p { margin-top: 12px; }

.vision-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: 18px; padding: 36px; text-align: center;
}
.vision-card p {
  font-size: 17px; color: white; line-height: 1.7;
  font-weight: 500; font-style: italic;
}
.vision-card .vision-icon { font-size: 38px; margin-bottom: 18px; }

@media (max-width: 600px) {
  .who-grid { grid-template-columns: 1fr; }
}
