/*
 * Reset, typography, app shell layout, and utilities. Logical properties
 * only (margin-inline-start, padding-inline-end, text-align: start, ...) so
 * an Arabic RTL stylesheet (rtl.css) can mirror this later without changes
 * here. No @media rules in this file — see responsive.css.
 */

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

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  padding-block-end: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

/* Mixed Arabic/English data (design.md 3.3). */
[lang="ar"] {
  line-height: 1.8;
}

[dir="auto"] {
  unicode-bidi: plaintext;
}

h1, h2, h3, h4, p, ul, ol, dl, dd {
  margin: 0 0 var(--space-4) 0;
}

h1 {
  font-size: var(--text-h1);
  font-weight: 600;
  line-height: 1.3;
}

h2 {
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.3;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.4;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* Visible focus everywhere; never removed without an equally visible
   replacement (section 7, Accessibility). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-focus-ring);
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------- */
/* Utilities                                                              */
/* --------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: -100px;
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 1000;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Progress bar width steps (design.md 6.15) — inline style is CSP-blocked. */
.w-0   { width: 0%; }
.w-5   { width: 5%; }
.w-10  { width: 10%; }
.w-15  { width: 15%; }
.w-20  { width: 20%; }
.w-25  { width: 25%; }
.w-30  { width: 30%; }
.w-35  { width: 35%; }
.w-40  { width: 40%; }
.w-45  { width: 45%; }
.w-50  { width: 50%; }
.w-55  { width: 55%; }
.w-60  { width: 60%; }
.w-65  { width: 65%; }
.w-70  { width: 70%; }
.w-75  { width: 75%; }
.w-80  { width: 80%; }
.w-85  { width: 85%; }
.w-90  { width: 90%; }
.w-95  { width: 95%; }
.w-100 { width: 100%; }

/* --------------------------------------------------------------------- */
/* App shell (desktop baseline; mobile shell overrides in responsive.css) */
/* --------------------------------------------------------------------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
}

.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-block-end: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-inline: var(--space-6);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-spacer {
  flex: 1;
}

.content {
  padding: var(--space-6);
  max-width: 1440px;
  width: 100%;
  margin-inline: auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.closed-cycle-banner {
  background: var(--color-neutral-bg);
  color: var(--color-text);
  border-inline-start: 3px solid var(--cu-navy);
  padding: var(--space-3) var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  color: var(--color-on-accent);
  font-weight: 700;
}

.brand-crest {
  width: 32px;
  height: 32px;
  background: var(--color-on-accent);
  border-radius: var(--radius-lg);
  padding: 2px;
  object-fit: contain;
}

.sidebar-section-label {
  font-size: var(--text-eyebrow);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-sidebar-label);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.sidebar-rule {
  border: none;
  border-block-end: 1px solid var(--color-sidebar-rule);
  margin: var(--space-2) var(--space-4);
}
