/* ==========================================================================
   AgentSetup.agency — Base Styles
   CSS Reset + Global Typography + Foundation
   ========================================================================== */

/* --------------------------------------------------------------------------
   IMPORT DEPENDENCIES
   -------------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');
@import './variables.css';

/* --------------------------------------------------------------------------
   MODERN CSS RESET
   -------------------------------------------------------------------------- */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  /* Prevent layout shift from scrollbar appearing */
  scrollbar-gutter: stable;
  /* Prevent horizontal scroll at document level */
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-fg-primary);
  background-color: var(--color-surface-page);
  background-image: var(--gradient-hero-bg);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — HEADINGS
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-fg-primary);
  text-wrap: balance;
}

h1 {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-7xl));
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tighter);
  line-height: var(--leading-none);
}

h2 {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1.15;
}

h3 {
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl));
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

h5 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-fg-secondary);
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — BODY TEXT
   -------------------------------------------------------------------------- */

p {
  line-height: var(--leading-relaxed);
  color: var(--color-fg-secondary);
  max-width: 70ch;
}

p + p {
  margin-top: var(--space-4);
}

.lead {
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-fg-secondary);
  max-width: 60ch;
  margin-left: auto;
  margin-right: auto;
}

.text-balance {
  text-wrap: balance;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — INLINE ELEMENTS
   -------------------------------------------------------------------------- */

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

a:hover {
  color: var(--color-brand-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

strong, b {
  font-weight: var(--weight-semibold);
  color: var(--color-fg-primary);
}

em {
  font-style: italic;
  color: var(--color-fg-accent);
}

small {
  font-size: var(--text-sm);
  color: var(--color-fg-tertiary);
}

mark {
  background: rgba(0, 212, 255, 0.2);
  color: var(--color-fg-primary);
  padding: 0 0.25em;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — CODE
   -------------------------------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: var(--weight-medium);
  color: var(--color-blue-glow);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.15);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

pre {
  font-family: var(--font-mono);
  font-size: var(--code-font-size);
  line-height: var(--code-line-height);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow-x: auto;
  tab-size: 2;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--color-text-primary);
  white-space: pre;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — LISTS
   -------------------------------------------------------------------------- */

ul, ol {
  padding-left: var(--space-6);
  color: var(--color-fg-secondary);
  line-height: var(--leading-relaxed);
}

ul {
  list-style: none;
  padding-left: 0;
}

ul li {
  position: relative;
  padding-left: var(--space-6);
}

ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-blue-glow);
  box-shadow: 0 0 6px var(--color-blue-glow);
}

ol {
  list-style: decimal;
}

li + li {
  margin-top: var(--space-2);
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY — BLOCKQUOTES & HORIZONTAL RULES
   -------------------------------------------------------------------------- */

blockquote {
  border-left: 3px solid var(--color-brand-primary);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  background: rgba(0, 212, 255, 0.04);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--color-fg-secondary);
}

blockquote p {
  max-width: none;
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

hr {
  border: none;
  height: 1px;
  background: var(--color-border-subtle);
  margin: var(--space-12) 0;
}

/* --------------------------------------------------------------------------
   MEDIA ELEMENTS
   -------------------------------------------------------------------------- */

img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   FORMS — BASE RESETS
   (Full form styles belong in components.css, but resets live here)
   -------------------------------------------------------------------------- */

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

/* --------------------------------------------------------------------------
   SCROLLBAR STYLING (Webkit)
   -------------------------------------------------------------------------- */

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

::-webkit-scrollbar-track {
  background: var(--color-bg-base);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg-base);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.2) var(--color-bg-base);
}

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

::selection {
  background: rgba(0, 212, 255, 0.25);
  color: var(--color-fg-primary);
}

::-moz-selection {
  background: rgba(0, 212, 255, 0.25);
  color: var(--color-fg-primary);
}

/* --------------------------------------------------------------------------
   FOCUS — GLOBAL
   -------------------------------------------------------------------------- */

:focus {
  outline: none;
}

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

/* --------------------------------------------------------------------------
   ACCESSIBILITY — SKIP LINK
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-6);
  background: var(--color-brand-primary);
  color: var(--color-fg-on-accent);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}

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

/* --------------------------------------------------------------------------
   ACCESSIBILITY — REDUCED MOTION
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   UTILITY — VISUALLY HIDDEN (for screen readers)
   -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   RESPONSIVE — BASE TYPOGRAPHY ADJUSTMENTS
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --container-padding: var(--space-4);  /* 16px on mobile */
  }

  body {
    font-size: var(--text-base);
  }

  .lead {
    font-size: var(--text-lg);
  }

  /* Constrain paragraph max-width to viewport on mobile */
  p {
    max-width: 100%;
  }

  /* Prevent long words (URLs, code tokens) from overflowing on mobile */
  p, li, td, th, blockquote {
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

@media (max-width: 480px) {
  :root {
    --container-padding: var(--space-4);  /* keep 16px on small phones */
  }

  .lead {
    font-size: var(--text-base);
  }

  /* h4 and h5 slight reduction on very small screens */
  h4 {
    font-size: var(--text-lg);
  }
}
