/* ═══════════════════════════════════════════════════
   PenScan — Base Styles
   ═══════════════════════════════════════════════════ */

*, *::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;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Typography ─────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--color-text);
}

h1 { font-size: clamp(2.5rem, 5vw, var(--text-7xl)); font-weight: var(--weight-black); }
h2 { font-size: clamp(1.875rem, 3.5vw, var(--text-5xl)); }
h3 { font-size: clamp(1.25rem, 2.5vw, var(--text-3xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--color-text-2);
  line-height: var(--leading-relaxed);
}

a {
  color: var(--color-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-text); }

strong { font-weight: var(--weight-semibold); color: var(--color-text); }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.45em;
  color: var(--color-cyan);
}

pre {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow-x: auto;
}

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

ul, ol { list-style: none; }

button { cursor: pointer; font-family: var(--font-sans); }

input, textarea, select {
  font-family: var(--font-sans);
  font-size: var(--text-base);
}

/* ── Layout helpers ─────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--container-md);
}

.container--wide {
  max-width: var(--container-2xl);
}

.section {
  padding-block: var(--space-24);
}

.section--sm {
  padding-block: var(--space-16);
}

.section--lg {
  padding-block: var(--space-32);
}

/* ── Text utilities ─────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--color-cyan) 0%, var(--color-violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient--green {
  background: linear-gradient(135deg, var(--color-green) 0%, var(--color-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted { color: var(--color-text-2); }
.text-dim   { color: var(--color-text-3); }
.text-cyan  { color: var(--color-cyan); }

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-cyan);
  background: var(--color-cyan-dim);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
  margin-bottom: var(--space-6);
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin-inline: auto;
  margin-bottom: var(--space-16);
}

.section-header h2 {
  margin-bottom: var(--space-4);
}

.section-header p {
  font-size: var(--text-lg);
  color: var(--color-text-2);
}

/* ── Divider ────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
}

/* ── Focus visible ──────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 3px;
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-3); }

/* ── Selection ──────────────────────────────────── */
::selection {
  background: var(--color-cyan-dim);
  color: var(--color-cyan);
}

/* ── Skip link ──────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-cyan);
  color: var(--color-text-inv);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: var(--weight-semibold);
  z-index: 9999;
}
.skip-link:focus { top: 0; }
