/* ── Base: reset, typography, shared components (header, buttons, tags, footer) ── */

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

html {
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent-text);
}

[hidden] {
  display: none !important;
}

/* ── Accessibility helpers ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Site header (shared by every page) ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition:
    color 0.15s,
    background 0.15s;
}
.site-nav a:hover {
  color: var(--text-primary);
  background: var(--surface-sunken);
}
.site-nav a[aria-current='page'] {
  color: var(--accent-text);
  background: var(--accent-soft);
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.icon-btn:hover {
  color: var(--accent-text);
  border-color: var(--accent);
}
.theme-toggle .icon-moon,
:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme='light']) .theme-toggle .icon-moon {
    display: block;
  }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    transform 0.1s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-sm {
  font-size: 13px;
  padding: 8px 14px;
}

/* ── Chips & tags ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
}
.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ── Page shell ── */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.status-text {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 12px 0;
}
.status-text.is-error {
  color: var(--text-secondary);
}

/* ── Footer ── */
.site-footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px 24px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  font-size: 13px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}
.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--accent-text);
}

/* ── Mobile ── */
@media (max-width: 720px) {
  .site-header-inner {
    padding: 0 16px;
    gap: 12px;
  }
  .brand-name {
    display: none;
  }
  /* Up to five nav items (Assistant, Projects, Services, Articles, CV): on narrow screens the
     nav shrinks and scrolls sideways on its own, so the page itself never scrolls horizontally. */
  .site-nav {
    min-width: 0;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .site-nav a {
    padding: 6px 8px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .header-actions {
    flex-shrink: 0;
  }
  .header-actions .btn {
    display: none;
  }
  .page {
    padding: 20px 16px 96px;
  }
}

/* Language switch (shows the language you would switch to) */
.lang-toggle {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
