/* =====================================================================
   Lorik Bajrami - single-page portfolio (architect / technical)
   Plain CSS, zero JS. Light default; dark via prefers-color-scheme.
   ===================================================================== */

/* ---- design tokens ---- */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #11161d;
  --text-muted: #5b6776;
  --border: #e2e6ec;
  --accent: #1f3b5b;
  --accent-weak: rgba(31, 59, 91, 0.1);
  --on-accent: #ffffff;

  --ring: rgba(17, 22, 29, 0.14);
  --btn-shadow: 0 2px 6px rgba(17, 22, 29, 0.1);
  --btn-shadow-hover: 0 8px 22px rgba(17, 22, 29, 0.16);
  --grid: rgba(17, 22, 29, 0.04);

  --maxw: 820px;
  --space: 1.5rem;
  --radius: 999px;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;
}

/* Dark palette, shared by the two ways dark can be active:
   (1) the OS prefers dark and the user hasn't forced light, or
   (2) the user explicitly chose dark via the toggle (data-theme="dark").
   Kept in one declaration list applied to both selectors to avoid drift. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1116;
    --surface: #161b22;
    --text: #e6edf3;
    --text-muted: #8b98a8;
    --border: #232b36;
    --accent: #60a5fa;
    --accent-weak: rgba(96, 165, 250, 0.14);
    --on-accent: #0e1116;

    --ring: rgba(230, 237, 243, 0.18);
    --btn-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    --btn-shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.55);
    --grid: rgba(230, 237, 243, 0.05);
  }
}

:root[data-theme='dark'] {
  --bg: #0e1116;
  --surface: #161b22;
  --text: #e6edf3;
  --text-muted: #8b98a8;
  --border: #232b36;
  --accent: #60a5fa;
  --accent-weak: rgba(96, 165, 250, 0.14);
  --on-accent: #0e1116;

  --ring: rgba(230, 237, 243, 0.18);
  --btn-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  --btn-shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.55);
  --grid: rgba(230, 237, 243, 0.05);
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* The full-bleed hero grid (.hero::before) extends -50vw past each side.
     Clip horizontal overflow so it can't be scrolled into. `clip` (not
     `hidden`) avoids creating a scroll container, so the sticky topbar
     keeps working. */
  overflow-x: clip;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
}

/* ---- layout container ---- */
.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space);
}

/* visually-hidden but available to assistive tech */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- hero ---- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3rem;
  padding: 4rem 0 3.5rem;
}

/* faint hairline grid, pure CSS, faded toward edges (CSP-safe, no image) */
.hero::before {
  content: '';
  position: absolute;
  inset: -2rem -50vw;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 80% at 30% 40%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 80% at 30% 40%, #000 0%, transparent 75%);
}

.hero__frame {
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 50%;
  border: 1.5px solid var(--ring);
}

.hero__photo {
  width: 220px;
  height: 220px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--bg);
}

.hero__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.hero__name {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.hero__title {
  margin: 0;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 600;
}

/* ---- social / CV buttons ---- */
.social {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--btn-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, color 0.2s ease,
    border-color 0.2s ease;
}

.social__btn svg {
  width: 22px;
  height: 22px;
}

.social__btn:hover {
  transform: translateY(-3px);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--btn-shadow-hover);
}

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

.social__text {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

/* ---- footer ---- */
.footer {
  flex-shrink: 0;
  padding: 0 var(--space) 2rem;
}

/* The divider is constrained to the content width (centered), not edge-to-edge. */
.footer__inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.footer__contact {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.footer__contact:hover {
  color: var(--accent);
}

.footer__copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---- 404 ---- */
.notfound {
  text-align: center;
  padding: 3rem 0;
}

.notfound__code {
  margin: 0;
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.notfound__text {
  margin: 0.5rem 0 1.5rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.notfound__home {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.notfound__home:hover {
  text-decoration: underline;
}

/* ---- responsive ---- */
@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
    padding: 3rem 0 2.5rem;
  }

  .hero__content {
    align-items: center;
    width: 100%;
  }

  .section {
    padding: 2.5rem 0;
  }

  .timeline__head {
    justify-content: flex-start;
  }
}

/* ---- skip link ---- */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s ease;
}

.skip-link:focus-visible {
  top: 0.75rem;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ---- sticky top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(160%) blur(8px);
}

/* Full-bleed bar: brand pinned to the far left, nav + theme toggle to the
   far right of the viewport (the toggle is the right-most element). */
.topbar__inner {
  width: 100%;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}

/* inline favicon mark; colors follow the theme variables */
.topbar__mark {
  display: block;
  border-radius: 8px;
}

.topbar__mark-tile {
  fill: var(--bg);
}

.topbar__mark-border {
  stroke: var(--border);
  stroke-width: 1;
}

.topbar__mark-text {
  fill: currentColor;
}

/* groups the section links and the theme toggle on the right of the bar */
.topbar__right {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.topbar__links {
  display: flex;
  gap: 1.4rem;
}

.topbar__link {
  position: relative;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0;
  transition: color 0.2s ease;
}

/* Animated underline that grows from the left on hover, in the single accent. */
.topbar__link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.topbar__link:hover {
  color: var(--accent);
}

.topbar__link:hover::after {
  width: 100%;
}

/* Selected section (set by nav.js scroll-spy): full underline + bolder label.
   Pure progressive enhancement, absent JS links still work. */
.topbar__link[aria-current]::after {
  width: 100%;
}

.topbar__link[aria-current] {
  color: var(--accent);
  font-weight: 600;
}

.topbar__link:focus-visible,
.topbar__brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---- theme toggle ---- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

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

/* ---- language toggle ---- */
/* The `hidden` attribute keeps the toggle out of view (and out of the tab
   order / a11y tree) while the language switch is temporarily disabled. A
   targeted rule is needed because the display below would otherwise override
   the UA `[hidden]` style. */
.lang-toggle[hidden] {
  display: none;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.lang-toggle:hover {
  border-color: var(--accent);
}

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

.lang-toggle__sep {
  opacity: 0.5;
}

/* The active language is highlighted; the inactive one is muted. Default page
   language is English. */
.lang-toggle__opt--de {
  color: var(--text-muted);
}

.lang-toggle__opt--en {
  color: var(--accent);
}

:root[data-lang='de'] .lang-toggle__opt--en {
  color: var(--text-muted);
}

:root[data-lang='de'] .lang-toggle__opt--de {
  color: var(--accent);
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
}

/* Icon reflects the action: show the moon in light mode (click -> dark),
   the sun in dark mode (click -> light). Covers OS default and both
   explicit overrides. */
.theme-toggle__icon--sun {
  display: none;
}

.theme-toggle__icon--moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle__icon--sun {
    display: block;
  }
  :root:not([data-theme='light']) .theme-toggle__icon--moon {
    display: none;
  }
}

:root[data-theme='dark'] .theme-toggle__icon--sun {
  display: block;
}
:root[data-theme='dark'] .theme-toggle__icon--moon {
  display: none;
}
:root[data-theme='light'] .theme-toggle__icon--sun {
  display: none;
}
:root[data-theme='light'] .theme-toggle__icon--moon {
  display: block;
}

/* hide section links on narrow screens; brand + theme toggle remain */
@media (max-width: 560px) {
  .topbar__links {
    display: none;
  }
}

/* ---- section primitive ---- */
.section {
  padding: 3rem 0;
  scroll-margin-top: 5rem; /* clear the sticky topbar on anchor jump */
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.section__index {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.section__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---- about ---- */
.about__text {
  margin: 0;
  font-size: 1.05rem;
}

/* ---- experience timeline ---- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline__item {
  position: relative;
  padding-left: 1.75rem;
  border-left: 2px solid var(--border);
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 0.4rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.timeline__role {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline__org {
  margin: 0.15rem 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.timeline__place {
  color: var(--text-muted);
}

.timeline__place::before {
  content: '· ';
}

.timeline__bullets {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline__bullets li {
  padding-left: 0.2rem;
}

.timeline__bullets li::marker {
  color: var(--accent);
}

/* ---- skills ---- */
.skill-group {
  margin-bottom: 1.5rem;
}

.skill-group__label,
.certs__label {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.85rem;
  line-height: 1.3;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.certs {
  margin-top: 2rem;
}

.cert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.4rem 1.5rem;
}

.cert-list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.cert-list li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Certificate name links to its public verification page. */
.cert-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.cert-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.cert-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---- scroll-driven reveal (progressive enhancement, no JS) ---- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .section {
      animation: reveal-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 25%;
    }
  }
}

@keyframes reveal-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- language switch (no-flash, CSS-driven) ----
   Both languages ship in the markup; only the active one shows. Default page
   language is English; lang.js sets :root[data-lang] before paint. `revert`
   restores each element's natural display (inline span / block paragraph). */
[data-t][lang='de'] {
  display: none;
}

:root[data-lang='de'] [data-t][lang='en'] {
  display: none;
}

:root[data-lang='de'] [data-t][lang='de'] {
  display: revert;
}
