/* ============================================================================
   Onești City — Base styles
   Reset + typography + layout primitives. Depends on tokens.css.
   ========================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Headlines use serif for editorial civic-portal feel */
h1, h2, h3, .headline {
  font-family: var(--font-serif);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  margin: 0 0 var(--space-4);
  font-weight: var(--fw-semibold);
}

h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--text-primary);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-3);
  font-weight: var(--fw-semibold);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-base); }

@media (min-width: 768px) {
  h1 { font-size: var(--fs-5xl); }
  h2 { font-size: var(--fs-4xl); }
  h3 { font-size: var(--fs-2xl); }
}

p { margin: 0 0 var(--space-4); line-height: var(--lh-relaxed); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--trans-fast);
}
a:hover { color: var(--text-link-hover); text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  color: inherit;
}
button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

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

hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: var(--space-6) 0;
}

::selection { background: var(--accent-500); color: #fff; }

/* ------- Layout primitives ------- */

.container {
  width: 100%;
  max-width: var(--content-default);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
@media (min-width: 768px) {
  .container { padding: 0 var(--space-5); }
}
.container--wide { max-width: var(--content-wide); }
.container--full { max-width: var(--content-full); }
.container--narrow { max-width: var(--content-narrow); }

.section {
  padding: var(--space-7) 0;
}
@media (min-width: 768px) {
  .section { padding: var(--space-8) 0; }
}
.section--tight { padding: var(--space-5) 0; }

.stack > * + * { margin-top: var(--space-4); }
.stack--sm > * + * { margin-top: var(--space-2); }
.stack--lg > * + * { margin-top: var(--space-6); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--space-5);
}

/* Accessibility utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--accent-600);
  color: #fff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--fw-semibold);
  z-index: var(--z-toast);
  transition: top var(--trans-fast);
}
.skip-link:focus {
  top: var(--space-3);
  text-decoration: none;
  color: #fff;
}

/* SPA navigation progress bar */
html[data-spa-loading]::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-500), var(--accent-700));
  z-index: calc(var(--z-toast) + 1);
  animation: spa-progress 800ms ease-in-out infinite;
  pointer-events: none;
}
@keyframes spa-progress {
  0%   { width: 0; }
  50%  { width: 80%; }
  100% { width: 100%; }
}

/* Typography helpers */
.eyebrow {
  text-transform: uppercase;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--text-accent);
  margin: 0 0 var(--space-2);
  font-family: var(--font-sans);
}
.muted { color: var(--text-muted); }
.subtle { color: var(--text-secondary); }
