/* base.css — Reset, typography, base element styles */

/* ========================================
   CSS Reset & Normalization
   ======================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--ink);
  color: var(--gold);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-tight);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Headings
   ======================================== */

h1 {
  font-size: var(--fs-h1);
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  margin-bottom: var(--space-lg);
  color: var(--gold);
}

h2 {
  font-size: var(--fs-h2);
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  margin-bottom: var(--space-lg);
  margin-top: var(--space-xl);
  color: var(--gold);
}

h3 {
  font-size: var(--fs-h3);
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  margin-bottom: var(--space-md);
  margin-top: var(--space-lg);
  color: var(--gold);
}

h4, h5, h6 {
  font-size: var(--fs-h4);
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  margin-bottom: var(--space-md);
  margin-top: var(--space-md);
  color: var(--gold);
}

/* ========================================
   Text Elements
   ======================================== */

p {
  margin-bottom: var(--space-md);
}

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

strong {
  font-weight: 600;
  color: var(--cream);
}

em {
  font-style: italic;
}

small {
  font-size: var(--fs-small);
  color: var(--muted);
}

/* ========================================
   Links
   ======================================== */

a {
  color: var(--cream);
  text-decoration: underline;
  transition: color var(--transition-base);
}

a:visited {
  color: var(--cream);
}

a:hover {
  color: var(--cream-bright);
  text-decoration: underline;
}

a:active {
  color: var(--cream);
}

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

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

/* ========================================
   Lists
   ======================================== */

ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

li {
  margin-bottom: var(--space-sm);
}

ul ul, ol ol, ul ol, ol ul {
  margin-bottom: 0;
  margin-top: var(--space-sm);
}

/* ========================================
   Buttons & CTA
   ======================================== */

button, [role="button"] {
  font-family: var(--font-system);
  font-size: var(--fs-body);
  cursor: pointer;
  transition: all var(--transition-base);
  border-radius: var(--radius-md);
  border: none;
  padding: var(--space-md) var(--space-lg);
}

button:disabled, [role="button"][aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

button:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}

/* ========================================
   Forms
   ======================================== */

input, textarea, select {
  font-family: var(--font-system);
  font-size: var(--fs-body);
  background-color: var(--ink-soft);
  border: 1px solid var(--muted);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  color: var(--cream);
  transition: border-color var(--transition-base);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cream);
  box-shadow: 0 0 0 2px rgba(198, 167, 93, 0.2);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--cream);
}

/* ========================================
   Images
   ======================================== */

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

/* ========================================
   Code
   ======================================== */

code, pre {
  background-color: var(--ink-soft);
  border-radius: var(--radius-md);
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.9em;
}

code {
  padding: 0.2em 0.4em;
  color: var(--gold-soft);
}

pre {
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

pre code {
  padding: 0;
  background: transparent;
  color: var(--cream);
}

/* ========================================
   Accessibility
   ======================================== */

/* Skip link: visible on focus */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--cream);
  color: var(--ink);
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Focus visible outlines for all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}

/* ========================================
   Utility Classes
   ======================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

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

/* Print styles */
@media print {
  body {
    background-color: white;
    color: black;
  }

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

  a[href]:after {
    content: " (" attr(href) ")";
  }

  a[href="#"]:after {
    content: "";
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  p {
    page-break-inside: avoid;
  }
}

/* Horizontal overflow safety: no element may widen the page past the viewport */
html, body {
  overflow-x: clip;
}
