/**
 * IronDesign Base Styles
 * 
 * Modern CSS reset + default element styles.
 * Applies design tokens to core HTML elements.
 * No component styles here — only baseline typography, spacing, and structure.
 */

/* ======================================
   CSS RESET — Box Model & Defaults
   ====================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Smooth scrolling */
  scroll-behavior: smooth;
  
  /* Use font size for rem calculations */
  font-size: var(--fs-base);
  
  /* Prevent font size adjustment on landscape in iOS */
  -webkit-text-size-adjust: 100%;
}

body {
  /* Reset margins */
  margin: 0;
  padding: 0;
  
  /* Apply theme colors and typography */
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  
  /* Improve font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ======================================
   TYPOGRAPHY — Headings
   ====================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  padding: 0;
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}

h1 {
  font-size: var(--fs-5xl);
  margin-block-end: var(--space-6);
}

h2 {
  font-size: var(--fs-4xl);
  margin-block-end: var(--space-5);
}

h3 {
  font-size: var(--fs-3xl);
  margin-block-end: var(--space-4);
}

h4 {
  font-size: var(--fs-2xl);
  margin-block-end: var(--space-4);
}

h5 {
  font-size: var(--fs-xl);
  margin-block-end: var(--space-3);
}

h6 {
  font-size: var(--fs-lg);
  margin-block-end: var(--space-3);
}

/* ======================================
   TYPOGRAPHY — Paragraphs & Text
   ====================================== */

p {
  margin: 0;
  padding: 0;
  margin-block-end: var(--space-4);
}

p:last-child {
  margin-block-end: 0;
}

/* ======================================
   TYPOGRAPHY — Links
   ====================================== */

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover,
a:focus {
  color: var(--color-accent-light);
  outline: none;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ======================================
   TYPOGRAPHY — Lists
   ====================================== */

ul,
ol {
  margin: 0;
  padding-inline-start: var(--space-6);
  margin-block-end: var(--space-4);
}

li {
  margin-block-end: var(--space-2);
}

li:last-child {
  margin-block-end: 0;
}

/* ======================================
   TYPOGRAPHY — Definition Lists & Description
   ====================================== */

dl {
  margin: 0;
  margin-block-end: var(--space-4);
}

dt {
  font-weight: var(--fw-semibold);
  margin-block-end: var(--space-1);
}

dd {
  margin-inline-start: var(--space-6);
  margin-block-end: var(--space-3);
}

dd:last-child {
  margin-block-end: 0;
}

/* ======================================
   TYPOGRAPHY — Blockquotes & Code
   ====================================== */

blockquote {
  margin: 0;
  margin-block-end: var(--space-4);
  padding-inline-start: var(--space-6);
  border-inline-start: 3px solid var(--color-accent);
  font-style: italic;
  color: var(--color-text-secondary);
}

code,
kbd,
samp {
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  background-color: var(--color-card-bg);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  color: var(--color-accent-light);
}

pre {
  margin: 0;
  margin-block-end: var(--space-4);
  padding: var(--space-4);
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

pre code {
  background: none;
  padding: 0;
  color: var(--color-accent-light);
}

/* ======================================
   FORM ELEMENTS — Base Styles
   ====================================== */

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ======================================
   MEDIA ELEMENTS
   ====================================== */

img,
picture,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  overflow: visible;
}

/* ======================================
   TABLE STYLES
   ====================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-block-end: var(--space-4);
}

thead {
  background-color: var(--color-card-bg);
  border-bottom: 1px solid var(--color-card-border);
}

th,
td {
  padding: var(--space-3);
  text-align: start;
  border-bottom: 1px solid var(--color-card-border);
}

th {
  font-weight: var(--fw-semibold);
}

tbody tr:hover {
  background-color: rgba(201, 169, 97, 0.05);
}

/* ======================================
   UTILITY CLASSES
   ====================================== */

/* Container — max-width wrapper with centered margin */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Screen reader text — visually hidden but available to assistive tech */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.screen-reader-text:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
  padding: var(--space-2);
  background-color: var(--color-accent);
  color: var(--color-bg);
  z-index: 999;
}