/**
 * Base Styles
 * =============================================================================
 * Reset, typography, and foundational styles
 * Mirrors the base styles from Next.js globals.css
 */

/* ============================================================================
 * CSS RESET (Modern Normalize)
 * ============================================================================ */

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

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-black);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Remove default margin from common elements */
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
dl, dd, ol, ul,
figure, hr, fieldset, legend {
  margin: 0;
  padding: 0;
}

/* Remove list styles */
ol, ul {
  list-style: none;
}

/* Improve media defaults */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove built-in form typography styles */
input, button, textarea, select {
  font: inherit;
}

/* Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Remove default button styles */
button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* Anchor reset */
a {
  color: inherit;
  text-decoration: none;
}

/* Iframe reset (from globals.css) */
iframe {
  border: 0;
  outline: 0;
}


/* ============================================================================
 * TYPOGRAPHY
 * ============================================================================ */

/* Headings - scoped to avoid overriding web component styles */
/* Only apply to headings NOT inside op-* web components */
:where(body > h1, body > h2, body > h3, body > h4, body > h5, body > h6,
       .page-content h1, .page-content h2, .page-content h3,
       .page-content h4, .page-content h5, .page-content h6,
       section > h1, section > h2, section > h3,
       article h1, article h2, article h3, article h4, article h5, article h6) {
  /* These styles only apply in traditional HTML contexts */
}

/* Default heading styles
 * Note: We let core.css (web component library) handle h1-h6 styling.
 * Only utility classes (.h1, .h2, etc.) are defined here for use
 * outside of web component contexts.
 */

/* Utility classes for heading-like styling (use when semantic heading isn't appropriate) */
.h1 {
  font-size: var(--font-size-7xl);
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tight);
}

.h2 {
  font-size: var(--font-size-6xl);
  font-weight: var(--font-weight-black);
  line-height: var(--line-height-tight);
}

.h3 {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
}

.h4 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
}

.h5 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

.h6 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
}

/* Paragraph */
p {
  margin-bottom: var(--spacing-4);
}

p:last-child {
  margin-bottom: 0;
}

/* Lead paragraph */
.lead {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-relaxed);
  color: var(--color-neutral-600);
}

/* Small text */
small, .small {
  font-size: var(--font-size-sm);
}

/* Strong */
strong, b {
  font-weight: var(--font-weight-semibold);
}

/* Links */
a:hover {
  color: var(--color-primary);
}

/* Code */
code, kbd, pre, samp {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--color-neutral-100);
  padding: 0.125em 0.25em;
  border-radius: var(--border-radius-sm);
}

pre {
  background-color: var(--color-neutral-100);
  padding: var(--spacing-4);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* Blockquote */
blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: var(--spacing-4);
  margin-left: 0;
  color: var(--color-neutral-600);
  font-style: italic;
}


/* ============================================================================
 * RESPONSIVE TYPOGRAPHY
 * ============================================================================ */

@media (max-width: 768px) {
  :where(h1), .h1 {
    font-size: var(--font-size-5xl);
    line-height: 56px;
  }

  :where(h2), .h2 {
    font-size: var(--font-size-5xl);
    line-height: 56px;
  }

  :where(h3), .h3 {
    font-size: var(--font-size-4xl);
  }

  :where(h4), .h4 {
    font-size: var(--font-size-3xl);
  }
}


/* ============================================================================
 * SELECTION
 * ============================================================================ */

::selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-900);
}


/* ============================================================================
 * FOCUS STATES (Accessibility)
 * ============================================================================ */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}


/* ============================================================================
 * SCROLLBAR STYLING (WebKit)
 * ============================================================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-neutral-100);
}

::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-neutral-400);
}


/* ============================================================================
 * NAVIGATION LINK COLORS
 * Light theme: light green (primary-200)
 * Dark theme: light green (primary-200)
 * ============================================================================ */

/* Light theme navigation - light green links */
op-website-navigation[theme="Light"] {
  --op-website-navigation-link-color: var(--color-primary-200);
}

op-website-navigation[theme="Light"]::part(nav-link),
op-website-navigation[theme="Light"] a:not([slot]) {
  color: var(--color-primary-200) !important;
}

/* Dark theme navigation - light green links */
op-website-navigation[theme="Dark"] {
  --op-website-navigation-link-color: var(--color-primary-200);
}

op-website-navigation[theme="Dark"]::part(nav-link),
op-website-navigation[theme="Dark"] a:not([slot]) {
  color: var(--color-primary-200) !important;
}
