/* ============================================================================
   RESET.CSS — Modern CSS Reset & Base Styles
   ============================================================================
   A carefully opinionated reset that eliminates browser inconsistencies
   while establishing sensible defaults using our design tokens.
   
   Based on Josh Comeau's Modern CSS Reset with Careeraa-specific additions:
   - Custom scrollbar styling
   - ::selection brand colors
   - :focus-visible accessibility ring
   - Skip-to-content link
   ============================================================================ */


/* ---------------------------------------------------------------------------
   BOX MODEL — Universal border-box
   --------------------------------------------------------------------------- */

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


/* ---------------------------------------------------------------------------
   ROOT & DOCUMENT
   --------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--color-text-body);
  background-color: var(--color-bg-white);
  line-height: var(--leading-normal);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
}


/* ---------------------------------------------------------------------------
   TYPOGRAPHY — Headings
   --------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-dark);
  overflow-wrap: break-word;       /* Prevent long words from overflowing */
  text-wrap: balance;              /* Even line lengths for headings */
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); }


/* ---------------------------------------------------------------------------
   TYPOGRAPHY — Body
   --------------------------------------------------------------------------- */

p {
  overflow-wrap: break-word;
  text-wrap: pretty;               /* Avoid orphans in body text */
}


/* ---------------------------------------------------------------------------
   MEDIA — Images, Video, SVG
   --------------------------------------------------------------------------- */

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;                    /* Maintain aspect ratio */
  font-style: italic;             /* Style alt text for broken images */
}


/* ---------------------------------------------------------------------------
   FORMS — Inherit typography
   --------------------------------------------------------------------------- */

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

textarea {
  resize: vertical;               /* Only vertical resize */
}


/* ---------------------------------------------------------------------------
   LINKS
   --------------------------------------------------------------------------- */

a {
  text-decoration: none;
  color: inherit;
}


/* ---------------------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------------------- */

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
}


/* ---------------------------------------------------------------------------
   LISTS
   --------------------------------------------------------------------------- */

ul,
ol {
  list-style: none;
}


/* ---------------------------------------------------------------------------
   SELECTION
   --------------------------------------------------------------------------- */

::selection {
  background-color: var(--color-primary);
  color: var(--color-text-white);
}

::-moz-selection {
  background-color: var(--color-primary);
  color: var(--color-text-white);
}


/* ---------------------------------------------------------------------------
   FOCUS — Accessible focus ring
   --------------------------------------------------------------------------- */

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

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


/* ---------------------------------------------------------------------------
   SCROLLBAR — Custom thin scrollbar
   --------------------------------------------------------------------------- */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-light) transparent;
}

/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--color-primary-light);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

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


/* ---------------------------------------------------------------------------
   ACCESSIBILITY — Skip to content
   --------------------------------------------------------------------------- */

.skip-to-content {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: var(--color-text-white);
  font-weight: 600;
  font-size: var(--text-small);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: var(--z-toast);
  transition: top var(--transition-fast);
  text-decoration: none;
}

.skip-to-content:focus {
  top: 0;
}


/* ---------------------------------------------------------------------------
   MISC
   --------------------------------------------------------------------------- */

/* Remove built-in form styling on iOS */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"] {
  -webkit-appearance: none;
  appearance: none;
}

/* Hide spinners on number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove default summary marker */
summary {
  cursor: pointer;
}

/* Disable animations for users who request it (additional layer — main rules in animations.css) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
