/* CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Root scales and variables */
:root {
  --max-content-width: 1100px;
  --radius-1: 6px;
  --radius-2: 10px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
  --border-subtle: 1px solid #e9ecef;

  /* Spacing scale (4px baseline) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
}

html,
body,
#root {
  height: 100%;
}

html {
  /* Scales from ~15px to ~18px */
  font-size: clamp(15px, 1.2vw + 12px, 18px);
}

body {
  line-height: 1.6;
  color: #1f2937; /* gray-800 */
  background: #fafafa;
}

/* Typography */
h1 {
  font-size: clamp(1.6rem, 2.4vw + 1rem, 2.25rem);
  line-height: 1.2;
  font-weight: 700;
}
h2 {
  font-size: clamp(1.35rem, 1.8vw + 0.8rem, 1.75rem);
  line-height: 1.3;
  font-weight: 650;
}
h3 {
  font-size: clamp(1.15rem, 1.2vw + 0.7rem, 1.35rem);
  line-height: 1.35;
  font-weight: 600;
}
p {
  margin: var(--space-3) 0;
}
a {
  color: #2563eb;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Media defaults */
img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

/* Focus ring */
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 1px;
}

/* Layout helpers */
.app-container {
  width: min(100% - 32px, var(--max-content-width));
  margin-inline: auto;
}
.app-main {
  padding-block: var(--space-6);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: var(--border-subtle);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.site-header__left,
.site-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top;
  display: block;
}
.site-header__nav {
  display: flex;
  gap: var(--space-2);
}
.nav-button {
  padding: 10px 16px;
  background: transparent;
  color: #334155; /* gray-700 */
  border: none;
  border-radius: var(--radius-1);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.15s ease, color 0.2s ease;
}
.nav-button:hover {
  background: #e3f2ff;
  color: #1e40af;
  transform: translateY(-1px);
}
.icon-button {
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.icon-button:hover {
  transform: scale(1.05);
  background: rgba(0, 0, 0, 0.05);
}
.icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* Mobile header behavior */
.site-header__toggle {
  display: none;
  padding: 8px 10px;
  border-radius: var(--radius-1);
  border: var(--border-subtle);
  background: #fff;
  cursor: pointer;
}

@media (max-width: 768px) {
  .site-header__bar {
    padding: var(--space-3) var(--space-3);
  }
  .site-header__nav {
    display: none;
  }
  .site-header__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .site-header--open .site-header__nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0 10px 0;
  }
  .brand-avatar {
    width: 40px;
    height: 40px;
  }
}

/* PDF viewer tweaks */
.pdf-container {
  margin: var(--space-6) auto;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-2);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-1);
  width: 100%;
  max-width: 900px;
}
@media (max-width: 768px) {
  .pdf-container {
    margin: var(--space-4) auto;
    max-width: 100%;
  }
}
