/* Base Typography, Atmosphere & Resets - AnalystAI */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  background-color: var(--paper);
  background-image: 
    radial-gradient(circle at 50% -80px, var(--glow-accent) 0%, transparent 60%),
    radial-gradient(circle at 90% 200px, var(--glow-highlight) 0%, transparent 45%),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
  background-position: top center, top center, 0 0, 0 0;
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.125rem; /* 18px */
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.25;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 2.75rem; /* 44px */
  letter-spacing: -0.025em;
  margin-top: 0;
  line-height: 1.18;
}

h2 {
  font-size: 1.875rem; /* 30px */
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35em;
  margin-top: 1.5em;
}

h3 {
  font-size: 1.375rem; /* 22px */
}

h4 {
  font-size: 1.125rem;
}

p {
  margin-bottom: 1.25em;
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: all 0.15s ease;
}

a:hover {
  opacity: 0.85;
  color: var(--accent-hover);
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

@media (min-width: 768px) {
  .container {
    padding-left: 32px;
    padding-right: 32px;
  }
}

/* Ledger Signature Atmospheric Background */
.ledger-bg {
  position: relative;
  background-color: transparent;
  background-image: 
    radial-gradient(ellipse at 50% 0%, var(--glow-accent) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 40%, var(--glow-highlight) 0%, transparent 50%);
  background-repeat: no-repeat;
}

@media (min-width: 1024px) {
  .ledger-margin {
    position: relative;
  }
  .ledger-margin::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 48px;
    width: 1px;
    background-color: var(--accent);
    opacity: 0.2;
    pointer-events: none;
    z-index: 1;
  }
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Mobile Typography adjustment */
@media (max-width: 640px) {
  body {
    font-size: 1.0625rem; /* 17px */
  }
  h1 {
    font-size: 2.125rem; /* 34px */
  }
  h2 {
    font-size: 1.5rem; /* 24px */
  }
  h3 {
    font-size: 1.25rem; /* 20px */
  }
}
