:root {
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --radius: 14px;
  --radius-lg: 22px;
  --pad: 18px;
  --speed: 200ms;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.1);
  --accent: #0d9488;
  --accent-2: #7c3aed;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --hero-gradient: radial-gradient(900px 420px at 10% -20%, rgba(13, 148, 136, 0.18), transparent 50%),
    radial-gradient(700px 380px at 95% 0%, rgba(124, 58, 237, 0.12), transparent 45%);
  --header-bg: rgba(244, 246, 251, 0.82);
  --code-bg: #eefeec;
}

html[data-theme="dark"] {
  --bg: #070b12;
  --bg-elevated: #0f1624;
  --text: #e8edf5;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #2dd4bf;
  --accent-2: #a78bfa;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --hero-gradient: radial-gradient(900px 420px at 8% -10%, rgba(45, 212, 191, 0.14), transparent 45%),
    radial-gradient(800px 400px at 100% 0%, rgba(167, 139, 250, 0.12), transparent 40%);
  --header-bg: rgba(7, 11, 18, 0.78);
  --code-bg: #0a101c;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  transition: background-color var(--speed), color var(--speed);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.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;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(1.3) blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

a.brand-home {
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  display: block;
  height: 56px;
  width: auto;
  max-width: min(260px, 55vw);
  object-fit: contain;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text);
  opacity: 0.88;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a:hover {
  opacity: 1;
  background: var(--accent-soft);
  text-decoration: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  gap: 2px;
}

.lang-switch__link {
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  transition: background var(--speed), color var(--speed);
}

.lang-switch__link:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.lang-switch__link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.toggle-group {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  gap: 4px;
}

.toggle-group button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--speed), color var(--speed);
}

.toggle-group button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--speed), border-color var(--speed);
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

/* Hero */
.hero {
  padding: 56px 0 32px;
  background: var(--hero-gradient);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 920px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.hero-main {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 28px;
  min-width: 0;
}

.hero-profile {
  flex-shrink: 0;
}

/* Кръг чрез overflow — работи и при кеширан/override на border-radius за img на хостинг */
.hero-profile__clip {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  box-shadow:
    0 0 0 4px var(--accent-soft),
    0 12px 32px rgba(0, 0, 0, 0.22);
  background: var(--bg-elevated);
}

html[data-theme="light"] .hero-profile__clip {
  box-shadow:
    0 0 0 4px var(--accent-soft),
    0 10px 28px rgba(15, 23, 42, 0.12);
}

.hero-profile__img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 0;
}

/* Лого в hero — по-широка рамка от кръг за пълен текст/икона */
.hero-profile__clip--brand {
  width: min(240px, 88vw);
  height: auto;
  min-height: 160px;
  aspect-ratio: 1;
  border-radius: 20px;
}

.hero-profile__img--brand {
  object-fit: contain;
  object-position: center center;
  padding: 10px;
  box-sizing: border-box;
}

.hero-copy {
  flex: 1;
  min-width: 0;
}

@media (max-width: 560px) {
  .hero-main {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-copy .tag {
    justify-content: center;
  }

  .hero-lead {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions,
  .hero-actions--primary,
  .hero-actions--secondary {
    justify-content: center;
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  margin-bottom: 14px;
}

.tag-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  color: var(--text);
  line-height: 1.15;
}

.hero-title {
  margin: 0 0 14px;
}

.hero-focus {
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 62ch;
  margin: 0 0 18px;
  line-height: 1.5;
}

.hero-lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 54ch;
  margin: 0 0 22px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions--primary {
  margin-bottom: 4px;
}

.hero-actions--secondary {
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .hero-focus {
    margin-left: auto;
    margin-right: auto;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--speed), box-shadow var(--speed), border-color var(--speed);
}

.btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-soft), rgba(124, 58, 237, 0.1));
  border-color: var(--border);
  color: var(--accent);
}

html[data-theme="dark"] .btn-primary {
  color: var(--text);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--pad);
  box-shadow: var(--shadow-sm);
}

.card h2,
.card h3 {
  font-family: var(--font-display);
  margin-top: 0;
}

.quick-facts ul {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Sections */
section {
  padding: 44px 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.section-intro {
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 70ch;
}

/* GitHub spotlight */
.github-section__cta {
  margin: 0 0 20px;
}

.github-repo-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.github-repo-cards__item {
  margin: 0;
}

.github-repo-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition:
    border-color var(--speed),
    transform var(--speed),
    box-shadow var(--speed);
}

.github-repo-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.github-repo-card__repo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

.github-repo-card__repo:hover .github-repo-card__name {
  text-decoration: underline;
}

.github-repo-card__demo {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  align-self: flex-start;
}

.github-repo-card__demo:hover {
  color: var(--accent);
  text-decoration: underline;
}

.github-repo-card__name {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.88rem;
}

.github-repo-card__note {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Grid cards about */
.two-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

@media (max-width: 720px) {
  .two-cols {
    grid-template-columns: 1fr;
  }
}

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

/* Timeline */
.timeline {
  display: grid;
  gap: 16px;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  margin-left: 4px;
}

.timeline-item h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 4px;
}

.timeline-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ERP */
.erp-banner {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 22px;
  background: linear-gradient(120deg, var(--accent-soft), transparent);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  aspect-ratio: 16 / 10;
  background: var(--bg);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-item figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: #fff;
}

html[data-theme="light"] .gallery-item figcaption {
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.85));
}

/* Projects */
.projects-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

@media (max-width: 980px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

.projects-table-wrap {
  display: none;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

body[data-projects-view="table"] .projects-grid {
  display: none;
}

body[data-projects-view="table"] .projects-table-wrap {
  display: block;
}

.projects-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.projects-table th,
.projects-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.projects-table th {
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--bg);
}

.projects-table tr:last-child td {
  border-bottom: 0;
}

.project-card {
  position: relative;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.project-meta {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}

.project-card-main {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-card-main:hover {
  text-decoration: none;
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 18px 0 0;
}

.project-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.project-desc--compact {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-cover {
  margin: 0.5rem 0 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.project-cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.project-open-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--accent);
  font-weight: 600;
}

.project-readme {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.project-shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.project-shot {
  margin: 0;
}

.project-shot a {
  display: block;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color var(--speed), box-shadow var(--speed);
}

.project-shot a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.project-shot img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.project-shot-cap {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.project-actions .btn {
  padding: 10px 14px;
  font-size: 0.85rem;
}

.project-page {
  padding-top: 18px;
}

.project-page__back-wrap {
  margin-bottom: 14px;
}

.project-page__card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.project-page__title {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.project-page__lead {
  margin: 0;
  color: var(--muted);
}

.project-page__detail {
  margin-top: 0;
}

.project-page__shots {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.hero-stats {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.hero-stats strong {
  color: var(--text);
  font-weight: 700;
}

.hero-stats__sep {
  margin: 0 0.35rem;
  opacity: 0.6;
}

.project-detail {
  margin: 0.25rem 0 0;
  padding: 0;
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.project-detail dt {
  margin: 0.5rem 0 0.15rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.project-detail dt:first-child {
  margin-top: 0;
}

.project-detail dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.projects-table-detail {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.projects-table-excerpt {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.projects-table-shots {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.skills-section {
  background: linear-gradient(180deg, transparent, var(--accent-soft) 0%, transparent 55%);
}

.tech-stack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.tech-stack-grid.tech-stack-grid--merged {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 1100px) {
  .tech-stack-grid.tech-stack-grid--merged {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .tech-stack-grid {
    grid-template-columns: 1fr;
  }

  .tech-stack-grid.tech-stack-grid--merged {
    grid-template-columns: 1fr;
  }
}

.tech-stack-card__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.tech-stack-card__body {
  margin: 0;
  font-size: 0.94rem;
  color: var(--muted);
  line-height: 1.55;
}

.services-card__title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.services-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.65;
}

.about-highlights {
  margin-bottom: 1.25rem;
}

.about-highlights__title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.about-highlights__list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.65;
}

/* Interests */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-weight: 600;
  font-size: 0.9rem;
}

a.chip-link {
  color: inherit;
  text-decoration: none;
  transition: border-color var(--speed), background var(--speed), transform var(--speed);
}

a.chip-link:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.dogs-section {
  background: linear-gradient(180deg, transparent, var(--accent-soft) 0%, transparent 42%);
}

.gallery-grid--dogs .gallery-item--dog figcaption {
  background: linear-gradient(transparent, rgba(180, 83, 9, 0.55));
}

html[data-theme="light"] .gallery-grid--dogs .gallery-item--dog figcaption {
  background: linear-gradient(transparent, rgba(120, 53, 15, 0.78));
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 720px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.contact-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.contact-form textarea {
  min-height: 140px;
  resize: vertical;
}

.contact-form .field {
  margin-bottom: 12px;
}

.field-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.contact-flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.45;
  border: 1px solid var(--border);
}

.contact-flash--ok {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.contact-flash--err {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--text);
}

html[data-theme="light"] .contact-flash--err {
  background: rgba(220, 38, 38, 0.08);
}

/* Footer */
.site-footer {
  padding: 36px 0 52px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.88);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-inner {
  max-width: min(1100px, 100%);
  max-height: 100%;
  position: relative;
}

.lightbox-inner img {
  max-height: calc(100vh - 48px);
  width: auto;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox-caption {
  margin-top: 12px;
  text-align: center;
  color: #e2e8f0;
  font-weight: 600;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
}

.lightbox-prev {
  left: 8px;
}

.lightbox-next {
  right: 8px;
}

@media (max-width: 640px) {
  .lightbox-nav {
    display: none;
  }
}

/* Skip link & focus (a11y) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  border-radius: 0 0 10px 0;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.skip-link:focus {
  left: 12px;
  outline: none;
}
.skip-link:focus-visible {
  left: 12px;
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-group button:focus-visible {
  outline-offset: 2px;
}

/* Footer layout */
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.9rem;
}

.footer-nav a {
  color: var(--accent);
  text-decoration: none;
}
.footer-nav a:hover {
  text-decoration: underline;
}

.footer-sep {
  color: var(--muted);
  user-select: none;
}

/* Cases */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.case-card h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.case-context {
  margin: 0 0 14px;
  font-size: 0.92rem;
}

.case-block {
  margin-bottom: 14px;
}

.case-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.case-stack {
  font-size: 0.9rem;
  margin: 0 0 14px;
  color: var(--muted);
}

.case-outcome {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.case-outcome strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}

.case-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Testimonials */
.testimonials-section {
  padding-bottom: 8px;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.testimonial-card {
  margin: 0;
}

.testimonial-quote {
  margin: 0 0 16px;
  font-size: 1.02rem;
  line-height: 1.55;
  font-style: italic;
}

.testimonial-footer {
  margin: 0;
}

.testimonial-cite {
  font-style: normal;
  font-size: 0.92rem;
}

.testimonial-name {
  font-weight: 700;
  color: var(--text);
}

/* Contact privacy blurb */
.contact-privacy {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

/* Legal page */
.legal-page {
  padding: 36px 0 56px;
  max-width: 720px;
}

.legal-header h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.legal-body h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.15rem;
  font-family: var(--font-display);
}

.legal-body p,
.legal-body ul {
  margin: 0 0 1rem;
  line-height: 1.65;
}

.legal-body ul {
  padding-left: 1.25rem;
}

.legal-back {
  margin-top: 2.5rem;
}

/* AI chat widget (bottom-right) */
.alex-chat {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1200;
  font-family: var(--font-body);
}

.alex-chat-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform var(--speed), box-shadow var(--speed);
}

.alex-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.18);
}

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

.alex-chat-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(100vw - 20px, 520px);
  height: min(92vh, 720px);
  max-height: min(92vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.alex-chat-panel[hidden] {
  display: none !important;
}

.alex-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.alex-chat-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.alex-chat-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.alex-chat-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--speed), color var(--speed);
}

.alex-chat-close:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.alex-chat-suggestions-wrap {
  flex: 0 1 min(50vh, 420px);
  min-height: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.alex-chat-suggestions-wrap[hidden] {
  display: none !important;
}

.alex-chat-suggestions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 8px;
  flex-shrink: 0;
}

.alex-chat-suggestions-heading {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.alex-chat-suggestions-toggle {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--speed), border-color var(--speed);
}

.alex-chat-suggestions-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.alex-chat-suggestions-body {
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 10px;
}

.alex-chat-suggestions-wrap--collapsed {
  flex: 0 0 auto;
}

.alex-chat-suggestions-wrap--collapsed .alex-chat-suggestions-body {
  display: none;
}

.alex-chat-suggestions-cats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alex-chat-cat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.alex-chat-cat-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.alex-chat-cat-summary::-webkit-details-marker {
  display: none;
}

.alex-chat-cat-summary::after {
  content: "";
  flex-shrink: 0;
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform var(--speed);
}

.alex-chat-cat[open] > .alex-chat-cat-summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.alex-chat-cat-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 10px 12px 12px;
}

.alex-chat-cat[open] .alex-chat-cat-questions {
  min-height: 12rem;
}

.alex-chat-suggestion {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background var(--speed), border-color var(--speed), color var(--speed);
}

.alex-chat-suggestion:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

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

.alex-chat-messages {
  flex: 1 1 auto;
  max-height: min(34vh, 280px);
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Още по-висока зона за примерни въпроси на тесни екрани */
@media (max-width: 540px) {
  .alex-chat-suggestions-wrap:not(.alex-chat-suggestions-wrap--collapsed) {
    flex: 0 1 min(54vh, 440px);
  }

  .alex-chat-suggestions-body {
    min-height: 210px;
  }

  .alex-chat-messages {
    max-height: min(30vh, 220px);
  }
}

.alex-chat-bubble {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  line-height: 1.5;
}

.alex-chat-bubble p {
  margin: 0;
}

.alex-chat-bubble--user {
  align-self: flex-end;
  max-width: 92%;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.alex-chat-bubble--assistant {
  align-self: flex-start;
  max-width: 96%;
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.alex-chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.alex-chat-input {
  width: 100%;
  resize: vertical;
  min-height: 52px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}

.alex-chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.alex-chat-send {
  align-self: flex-end;
}
