/* =================================================================
   REFINEMENTS LAYER — loads after styles.css
   Polish pass: typography signature, card system, atmosphere, details
   ================================================================= */

/* --- Global tokens (define for future-proofing) --- */
:root {
  --ink: #F4F4F8;
  --ink-soft: #B8B8C0;
  --ink-mute: #9090A0;
  --ink-dim: #6F7280;
  --bg: #0B0C10;
  --surface: #13141B;
  --surface-2: #1A1C24;
  --surface-3: #1F2230;
  --border: #262830;
  --border-bright: #3A3D48;
  --accent: #3B82F6;
  --accent-2: #60A5FA;
  --accent-soft: #93C5FD;
  --accent-tint: rgba(59, 130, 246, 0.10);
  --accent-glow: rgba(59, 130, 246, 0.28);
}

/* --- Selection + scrollbar --- */
::selection {
  background: var(--accent);
  color: #FFFFFF;
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

/* --- Focus rings for accessibility + polish --- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- Body atmosphere: subtle vignette --- */
body {
  font-feature-settings: "ss01", "cv02", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Hero atmosphere: subtle radial glow + grain --- */
.hero {
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(59, 130, 246, 0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 60%),
    #0B0C10 !important;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

/* --- Hero typography tightening --- */
.hero-title {
  font-feature-settings: "ss01", "cv02";
  font-variation-settings: "wght" 800;
}
.hero-description {
  font-size: 1.18rem;
  line-height: 1.65;
  color: #C9CCD8;
  max-width: 56ch;
}
.hero-description strong { color: var(--ink); font-weight: 600; }

/* --- Highlight accent (Fraunces italic) — polish + subtle hover --- */
.highlight {
  position: relative;
  color: var(--accent-2);
  background: linear-gradient(120deg, transparent 0%, transparent 100%);
  background-size: 100% 0.18em;
  background-position: 0 92%;
  background-repeat: no-repeat;
  transition: background-size 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Numeric tabular feel for stats — feels operator/precise */
.stat-number,
.metric-number,
.metric-value,
.achievement-number {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
}

/* --- Section header typography signature --- */
.section-header h2 {
  letter-spacing: -0.025em;
  font-weight: 700;
}
.section-header p {
  color: var(--ink-mute);
  letter-spacing: 0.005em;
}

/* --- Card system unified treatment --- */
.timeline-content,
.project-card,
.achievement-card,
.service-card,
.metric-card,
.client-card,
.bring-item,
.skill-category {
  transition:
    background-color 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.timeline-content:hover,
.project-card:hover,
.achievement-card:hover,
.service-card:hover,
.metric-card:hover,
.client-card:hover,
.bring-item:hover,
.skill-category:hover {
  background-color: var(--surface);
  border-color: var(--border-bright);
  transform: translateY(-3px);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px var(--accent-tint);
}

/* --- Buttons: refined hover micro-interactions --- */
.btn,
.btn-primary,
.btn-secondary,
.btn-outline {
  transition:
    background-color 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    color 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
  letter-spacing: 0.005em;
  font-weight: 600;
}
.btn-primary:hover {
  box-shadow:
    0 6px 24px rgba(59, 130, 246, 0.35),
    0 2px 8px rgba(59, 130, 246, 0.20);
  transform: translateY(-2px);
}
.btn-outline {
  border-color: var(--border-bright);
}
.btn-outline:hover {
  border-color: var(--accent);
  background-color: var(--accent-tint);
  color: var(--accent-2);
}

/* --- Nav refinement --- */
.navbar {
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.navbar.scrolled {
  border-bottom-color: var(--border);
}
.nav-link {
  position: relative;
  transition: color 0.2s;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}
.nav-logo h2 .logo-tagline {
  font-family: 'Fraunces', 'Hanken Grotesk', serif;
  font-style: italic;
  font-weight: 500;
  color: var(--accent-2);
  letter-spacing: -0.005em;
}
.nav-logo .logo-name {
  letter-spacing: -0.015em;
  font-weight: 800;
}
.nav-logo .logo-divider { color: var(--ink-dim); font-weight: 300; }

/* --- Client logos: more visible on dark --- */
.client-logo {
  filter: brightness(0) invert(1) opacity(0.55);
  transition: filter 0.3s, opacity 0.3s, transform 0.3s;
}
.client-logo:hover {
  filter: brightness(0) invert(1) opacity(0.95);
  transform: scale(1.05);
}

/* --- Section atmosphere: subtle top hairline on alternating sections --- */
.about,
.projects,
.clients,
.skills,
.achievements,
.services,
.contact {
  position: relative;
}
.about::before,
.projects::before,
.clients::before,
.skills::before,
.achievements::before,
.services::before,
.contact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1200px, calc(100% - 80px));
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border) 20%,
    var(--border-bright) 50%,
    var(--border) 80%,
    transparent 100%
  );
}

/* --- Section header chip-style kicker (the small descriptor text) --- */
.section-header {
  text-align: center;
}
.section-header h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}
.section-header > p {
  font-size: 1.05rem;
  max-width: 64ch;
  margin: 0 auto;
}

/* --- Expand button refinement --- */
.expand-btn {
  border: 1px solid var(--border);
  background: var(--surface) !important;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.expand-btn:hover {
  border-color: var(--accent);
  background: var(--accent-tint) !important;
  color: var(--accent-2);
}

/* --- Project type / tech-label badges: more refined --- */
.project-type,
.project-year,
.project-status,
.tech-label,
.skill-tag,
.capability-tag {
  border: 1px solid transparent;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.project-type,
.tech-label {
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.10);
  color: var(--accent-soft);
}
.project-year {
  border-color: var(--border-bright);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* --- Hero stats: tighter, more confident --- */
.hero-stats {
  gap: 2.5rem;
  margin-top: 2.5rem;
}
.stat {
  position: relative;
}
.stat-number {
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, var(--ink) 0%, #C9CCD8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  line-height: 1;
}
.stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  margin-top: 0.4rem;
}

/* --- Timeline rail refinement --- */
.timeline::before {
  background: linear-gradient(
    180deg,
    transparent 0%,
    var(--border) 5%,
    var(--border-bright) 50%,
    var(--border) 95%,
    transparent 100%
  ) !important;
  width: 2px !important;
}
.timeline-marker {
  box-shadow:
    0 0 0 6px var(--bg),
    0 0 0 7px rgba(59, 130, 246, 0.18);
}

/* --- Hero buttons row: tighter --- */
.hero-buttons {
  gap: 0.875rem !important;
  margin-top: 1.5rem;
}

/* --- Misc detail polish --- */
strong, b { color: var(--ink); }
em { font-style: italic; }
abbr { text-decoration: none; border-bottom: 1px dotted var(--border-bright); cursor: help; }
hr { border: none; height: 1px; background: var(--border); margin: 2rem 0; }

/* --- Smooth reveal on scroll (works with existing IntersectionObserver if present) --- */
section { scroll-margin-top: 80px; }

/* --- Print: keep dark for consistency, but ensure text legible --- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .navbar, .hero-buttons, .expand-btn { display: none !important; }
}
