@font-face {
  font-family: "FontAwesome";
  src: url("../fonts/fontawesome-webfont.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Flaticon";
  src: url("../fonts/Flaticon.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

.fa,
.flaticon {
  display: inline-block;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.fa { font-family: "FontAwesome"; }
.flaticon { font-family: "Flaticon"; }

.fa-home::before { content: "\f015"; }
.fa-download::before { content: "\f019"; }
.fa-bars::before { content: "\f0c9"; }
.fa-suitcase::before { content: "\f0f2"; }
.fa-graduation-cap::before { content: "\f19d"; }
.fa-envelope::before { content: "\f0e0"; }
.fa-linkedin::before { content: "\f0e1"; }
.fa-github::before { content: "\f09b"; }
.fa-external-link::before { content: "\f08e"; }

.flaticon-html::before { content: "\f10f"; }
.flaticon-sitemap::before { content: "\f124"; }
.flaticon-brainstorming::before { content: "\f105"; }
.flaticon-settings::before { content: "\f123"; }

:root {
  --bg: #07141f;
  --bg-deep: #050d14;
  --panel: #0d1e2a;
  --panel-2: #102532;
  --panel-3: #132b3a;
  --text: #edf5fa;
  --muted: #8fa8b9;
  --line: rgba(94, 184, 235, .16);
  --line-strong: rgba(94, 184, 235, .34);
  --accent: #32b9f4;
  --accent-soft: rgba(50, 185, 244, .12);
  --shadow: 0 24px 70px rgba(0, 0, 0, .32);
  --radius: 8px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 76% 6%, rgba(36, 145, 211, .15), transparent 34rem),
    linear-gradient(145deg, var(--bg), var(--bg-deep));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("../images/template-bg.png") center top / auto repeat;
  opacity: .38;
  filter: invert(1) hue-rotate(165deg) saturate(1.05) brightness(1.18);
  mix-blend-mode: screen;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { outline-color: var(--accent); }

#preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
}

.spinner {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cv-shell {
  position: relative;
  z-index: 1;
  width: min(1170px, calc(100% - 30px));
  margin: 60px auto;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 30px;
}

.profile-card,
.topbar,
.content-card {
  background: rgba(13, 30, 42, .96);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-card {
  align-self: start;
  overflow: hidden;
}

.profile-name {
  padding: 22px 20px 25px;
  background: linear-gradient(135deg, rgba(50,185,244,.08), transparent);
}

.profile-name strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
  letter-spacing: .025em;
}

.profile-name span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.profile-image {
  margin: -8px 0 8px;
  clip-path: polygon(0 8%, 100% 0, 100% 94%, 0 100%);
  background: var(--panel-2);
}

.profile-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 42%;
  filter: saturate(.9) contrast(1.03);
}

.profile-meta {
  position: relative;
  margin: 12px 18px 4px 34px;
  padding-left: 18px;
  border-left: 2px solid var(--line-strong);
}

.profile-meta::before {
  content: "";
  position: absolute;
  top: -32px;
  left: -21px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--accent);
  background-image: url("../images/glasses-w.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 27px 10px;
  box-shadow: 0 2px 32px rgba(50, 185, 244, .3), 0 0 0 6px var(--accent-soft);
}

.profile-meta > div {
  position: relative;
  padding: 0 0 20px;
}

.profile-meta > div::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--panel);
}

.profile-meta span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.profile-meta strong,
.profile-meta a {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.profile-meta a:hover { color: var(--accent); }

.primary-button,
.linkedin-button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #031019;
  font-weight: 750;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.primary-button:hover,
.linkedin-button:hover {
  color: #031019;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(50,185,244,.18);
}

.print-button {
  display: block;
  margin: 18px auto 28px;
  padding: 10px 18px;
  font-size: 12px;
}

.main-column { min-width: 0; }

.topbar {
  position: relative;
  min-height: 70px;
  margin-bottom: 30px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
}

.desktop-nav {
  display: flex;
  align-items: stretch;
}

.nav-tab {
  min-width: 104px;
  padding: 0 15px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .065em;
  cursor: pointer;
}

.nav-tab:hover,
.nav-tab.active { color: var(--text); }

.nav-home {
  min-width: 70px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--accent);
  color: #031019 !important;
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.linkedin-button {
  align-self: center;
  margin-right: 18px;
  padding: 10px 16px;
  font-size: 12px;
}

.menu-button {
  display: none;
  align-self: center;
  margin-right: 16px;
  width: 40px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 70px;
  right: 0;
  z-index: 50;
  width: 210px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.mobile-menu button {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
}

.mobile-menu button:hover { color: var(--accent); }

.content-card {
  min-height: 580px;
  overflow: hidden;
}

.tab-page { display: none; }
.tab-page.active { display: block; }

.hero-banner {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #06131d;
}

.hero-banner img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 1;
  object-fit: cover;
  object-position: center;
}

.content-section {
  padding: 32px 34px 36px;
}

.section-line { border-bottom: 1px solid var(--line); }
.alt-section { background: rgba(255,255,255,.018); }

.section-title {
  position: relative;
  display: inline-block;
  margin-bottom: 28px;
  padding: 0 3px 2px;
}

.section-title span {
  position: absolute;
  left: 0;
  bottom: 1px;
  width: 100%;
  height: 6px;
  background: var(--accent);
  opacity: .34;
}

.section-title h1,
.section-title h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.service-card {
  min-height: 170px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.service-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.service-symbol {
  margin-bottom: 28px;
  color: var(--accent);
  font: 800 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .05em;
}

.service-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.skill-cloud,
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-cloud span,
.project-tags span {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--accent-soft);
  color: #bcd7e6;
  font: 650 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.resume-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
}

.resume-column-title {
  margin: 0 0 26px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 15px;
}

.timeline {
  position: relative;
  margin-left: 5px;
  padding-left: 25px;
  border-left: 2px solid var(--line-strong);
}

.timeline article {
  position: relative;
  padding-bottom: 30px;
}

.timeline article:last-child { padding-bottom: 0; }

.timeline article::before {
  content: "";
  position: absolute;
  left: -32px;
  top: 22px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--panel);
}

.timeline-date {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.timeline h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.project-grid {
  display: grid;
  gap: 14px;
}

.project-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.project-card.featured {
  background:
    linear-gradient(135deg, rgba(50,185,244,.08), transparent 45%),
    var(--panel-2);
}

.project-index {
  padding-top: 28px;
  border-right: 1px solid var(--line);
  color: var(--accent);
  text-align: center;
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.project-body { padding: 28px; }

.project-type {
  margin-bottom: 8px;
  color: var(--muted);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}

.project-body h3 {
  margin: 0 0 13px;
  font-size: 28px;
}

.project-tags { margin: 18px 0 22px; }

.project-link {
  display: inline-flex;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}

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

.contact-lead {
  max-width: 660px;
  margin-bottom: 28px;
  font-size: 14px;
}

.contact-links {
  display: grid;
  gap: 10px;
}

.contact-links > a {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.contact-links > a:hover {
  border-color: var(--line-strong);
  background: var(--panel-3);
}

.contact-icon {
  color: var(--accent);
  text-align: center;
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.contact-links a > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.contact-links strong { font-size: 13px; }
.contact-links small { color: var(--muted); font-size: 11px; }
.contact-links b { color: var(--accent); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.footer strong { color: var(--text); }

@media (max-width: 991px) {
  .cv-shell {
    margin-top: 28px;
    grid-template-columns: 1fr;
  }

  .profile-card {
    display: grid;
    grid-template-columns: 220px 1fr;
  }

  .profile-name { grid-column: 2; }
  .profile-image {
    grid-column: 1;
    grid-row: 1 / span 3;
    margin: 0;
    clip-path: none;
  }
  .profile-image img { height: 100%; min-height: 250px; }
  .profile-meta { grid-column: 2; }
  .profile-card .print-button {
    grid-column: 2;
    justify-self: start;
    margin-left: 34px;
  }
}

@media (max-width: 720px) {
  .cv-shell {
    width: min(100% - 20px, 680px);
    gap: 18px;
  }

  .profile-card { display: block; }
  .profile-image { clip-path: polygon(0 8%, 100% 0, 100% 94%, 0 100%); }
  .profile-image img { min-height: 0; }

  .desktop-nav,
  .linkedin-button { display: none; }

  .topbar {
    min-height: 64px;
    justify-content: flex-end;
  }

  .menu-button { display: block; }

  .hero-banner img { aspect-ratio: 2.5 / 1; }

  .content-section { padding: 26px 20px 30px; }

  .intro-grid,
  .service-grid,
  .resume-grid {
    grid-template-columns: 1fr;
  }

  .resume-grid { gap: 34px; }

  .project-card { grid-template-columns: 48px 1fr; }
  .project-body { padding: 22px 18px; }
  .project-body h3 { font-size: 24px; }
}

@media print {
  @page { size: A4; margin: 10mm; }

  body {
    background: #fff;
    color: #111;
    font-size: 9pt;
  }

  body::before,
  #preloader,
  .topbar,
  .footer,
  .hero-banner,
  .print-button {
    display: none !important;
  }

  .cv-shell {
    width: 100%;
    margin: 0;
    display: block;
  }

  .profile-card,
  .content-card {
    background: #fff;
    color: #111;
    border: 1px solid #bbb;
    box-shadow: none;
  }

  .profile-card {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px;
  }

  .profile-name {
    grid-column: 2;
    padding: 2px 0;
    background: none;
  }

  .profile-name span { color: #555; }

  .profile-image {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin: 0;
    clip-path: none;
  }

  .profile-image img {
    width: 82px;
    height: 82px;
    border-radius: 4px;
  }

  .profile-meta {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .profile-meta::before,
  .profile-meta > div::before { display: none; }

  .profile-meta > div { padding: 0; }
  .profile-meta span { color: #666; }
  .profile-meta strong,
  .profile-meta a { color: #111; }

  .content-card { border: 0; }
  .tab-page { display: block !important; }

  .content-section {
    padding: 10px 12px;
    break-inside: avoid;
  }

  .section-line { border-bottom: 1px solid #ddd; }
  .alt-section { background: #fff; }

  .section-title { margin-bottom: 10px; }
  .section-title span { background: #111; }
  .section-title h1,
  .section-title h2 { color: #111; font-size: 13pt; }

  p { color: #444; font-size: 8.5pt; line-height: 1.45; }

  .intro-grid { gap: 14px; }

  .service-grid {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .service-card {
    min-height: 0;
    padding: 9px;
    background: #fff;
    border-color: #ccc;
  }

  .service-symbol {
    margin-bottom: 5px;
    color: #111;
  }

  .skill-cloud span,
  .project-tags span {
    padding: 3px 5px;
    background: #fff;
    color: #333;
    border-color: #bbb;
  }

  .resume-grid { gap: 20px; }
  .resume-column-title { color: #111; border-color: #111; }
  .timeline { border-color: #bbb; }
  .timeline article { padding-bottom: 12px; }
  .timeline article::before { border-color: #111; background: #fff; }
  .timeline-date { color: #333; }
  .timeline h4 { color: #111; }

  .project-grid { gap: 7px; }
  .project-card { background: #fff; border-color: #bbb; }
  .project-index { color: #111; border-color: #bbb; }
  .project-body { padding: 11px; }
  .project-body h3 { color: #111; font-size: 15pt; }
  .project-link { display: none; }

  .contact-links {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .contact-links > a {
    padding: 8px;
    background: #fff;
    color: #111;
    border-color: #bbb;
  }

  .contact-icon,
  .contact-links b { color: #111; }
}

/* Navigation / links */
.nav-home svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
  display: block;
  margin: 0 auto;
}

.timeline-link {
  color: var(--text);
  border-bottom: 1px solid transparent;
}

.timeline-link:hover,
.timeline-link:focus {
  color: var(--accent);
  border-color: var(--accent);
}

/* Print refinements: let long sections flow naturally between pages. */
@media print {
  .profile-image img {
    min-height: 0 !important;
    max-height: 82px !important;
    object-fit: cover !important;
  }

  .profile-card {
    min-height: 0 !important;
    height: auto !important;
    align-items: start !important;
  }

  .profile-meta {
    align-content: start !important;
  }

  .content-section {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .service-card,
  .timeline article,
  .project-card,
  .contact-links > a {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  #home,
  #resume,
  #portfolio,
  #contact {
    break-before: auto !important;
    page-break-before: auto !important;
  }

  .resume-grid,
  .project-grid,
  .contact-links {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .content-section {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .service-card {
    padding: 7px !important;
  }

  .project-body {
    padding: 9px !important;
  }

  .timeline article {
    padding-bottom: 10px !important;
  }

  .timeline-link {
    color: #111 !important;
    border: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   Original Mat template fidelity layer
   Reintroduces its icon language, motion and responsive behavior while
   preserving the customized dark palette and CV content.
   -------------------------------------------------------------------------- */

.nav-tab,
.primary-button,
.linkedin-button,
.menu-button,
.service-card,
.project-card,
.project-link,
.contact-links > a,
.profile-meta a {
  transition:
    color .3s ease,
    background-color .3s ease,
    border-color .3s ease,
    box-shadow .3s ease,
    transform .3s ease,
    opacity .3s ease;
}

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

.nav-home:hover {
  background: #57c9fa;
  transform: none;
}

.tab-page.active {
  animation: template-page-fade .18s linear both;
}

@keyframes template-page-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.service-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.service-card {
  min-height: 186px;
  padding: 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .13);
}

.service-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
}

.service-symbol {
  min-height: 52px;
  margin-bottom: 18px;
  color: var(--accent);
  font: inherit;
  letter-spacing: 0;
}

.service-symbol .flaticon::before {
  font-size: 44px;
  line-height: 1;
}

.resume-column-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  margin: 0 0 0 -20px;
}

.resume-column-icon {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #031019;
  box-shadow: 0 8px 28px rgba(50, 185, 244, .23);
  font-size: 18px;
}

.resume-column-title {
  margin: 0;
  padding: 0;
  border: 0;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}

.contact-links > a:hover {
  transform: translateX(3px);
}

.primary-button .fa,
.linkedin-button .fa {
  margin-left: 6px;
}

.linkedin-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.linkedin-button .fa {
  margin-left: 0;
}

.menu-button {
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.contact-icon {
  font-size: 17px;
}

.profile-meta {
  position: relative;
  display: grid;
  row-gap: 20px;
  margin: 14px 10px 4px 26px;
  padding-left: 20px;
  border-left: 2px solid var(--line-strong);
}

.profile-meta::before {
  content: "";
  position: absolute;
  top: -40px;
  left: -21px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 32px rgba(50, 185, 244, .3), 0 0 0 6px var(--accent-soft);
}

.profile-meta::after {
  content: "";
  position: absolute;
  top: -25px;
  left: -16px;
  width: 30px;
  height: 10px;
  background: url("../images/glasses-w.png") no-repeat center / 27px 10px;
  pointer-events: none;
}

.profile-meta > div {
  position: relative;
  min-height: 28px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  padding: 0;
}

.profile-meta > div::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--panel);
  transform: translateY(-50%);
}

.profile-meta span {
  display: block;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1;
  letter-spacing: .09em;
  text-align: left;
  text-transform: uppercase;
}

.profile-meta strong,
.profile-meta a {
  display: block;
  min-width: 0;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}

.profile-image {
  margin-top: -22px;
}

.profile-image img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 42%;
}

/* Bootstrap-like widths used by the original template. */
@media (min-width: 1200px) {
  .cv-shell { width: 1170px; }
}

@media (min-width: 992px) and (max-width: 1199px) {
  .cv-shell { width: 970px; }
}

@media (max-width: 991px) {
  .cv-shell {
    width: min(750px, calc(100% - 30px));
    margin-top: 30px;
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .profile-card {
    display: block;
    padding-bottom: 30px;
  }

  .profile-name {
    grid-column: auto;
  }

  .profile-image {
    grid-column: auto;
    grid-row: auto;
    clip-path: polygon(0 9%, 100% 0, 100% 94%, 0 100%);
  }

  .profile-image img {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    object-position: center 42%;
  }

  .profile-meta {
    width: fit-content;
    min-width: 310px;
    max-width: calc(100% - 52px);
    margin: 14px auto 4px;
    padding-left: 20px;
  }

  .profile-card .print-button {
    display: block;
    margin: 18px auto 0;
  }

  .topbar {
    margin-top: 30px;
  }

  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resume-grid {
    grid-template-columns: 1fr;
    gap: 42px;
  }
}

@media (max-width: 991px) and (min-width: 576px) {
  .profile-image {
    margin-top: -40px;
  }

  .profile-name strong {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  .cv-shell {
    width: min(100% - 30px, 750px);
    gap: 18px;
  }

  .profile-image {
    margin-top: -18px;
  }

  .desktop-nav {
    display: flex;
  }

  .desktop-nav .nav-tab:not(.nav-home) {
    display: none;
  }

  .nav-home {
    display: grid;
    place-items: center;
    min-width: 70px;
    height: 70px;
  }

  .linkedin-button {
    display: inline-flex;
    margin-left: auto;
    margin-right: 10px;
  }

  .menu-button {
    display: inline-flex;
    margin-right: 16px;
  }

  .topbar {
    min-height: 70px;
    align-items: stretch;
    justify-content: flex-start;
  }

  .mobile-menu {
    display: block;
    position: absolute;
    top: 78px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition:
      max-height .28s ease,
      padding .28s ease,
      opacity .2s ease,
      transform .28s ease,
      visibility 0s linear .28s;
  }

  .mobile-menu.is-open {
    max-height: 300px;
    padding: 8px;
    border-color: var(--line);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition:
      max-height .28s ease,
      padding .28s ease,
      opacity .2s ease,
      transform .28s ease,
      visibility 0s linear 0s;
  }

  .mobile-menu button {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    text-align: center;
  }

  .mobile-menu button:last-child {
    border-bottom: 0;
  }

  .content-section {
    padding: 26px 20px 30px;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    grid-template-columns: 48px 1fr;
  }

  .project-body {
    padding: 22px 18px;
  }

  .project-body h3 {
    font-size: 24px;
  }
}

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

  .profile-meta {
    width: calc(100% - 52px);
    min-width: 0;
  }

  .linkedin-button {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
  }

  .linkedin-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .linkedin-button .fa {
    margin: 0;
  }

  .resume-column-heading {
    margin-bottom: 0;
  }
}

@media (max-width: 321px) {
  .linkedin-button {
    display: none;
  }
}

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

@media print {
  .profile-meta::after { display: none !important; }

  .resume-column-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    color: #111;
    background: #fff;
    border: 1px solid #999;
    box-shadow: none;
    font-size: 11px;
  }

  .resume-column-heading {
    min-height: 0;
    margin-bottom: 8px;
  }

  .service-symbol .flaticon::before {
    font-size: 20px;
  }
}

/* Final A4 print layout — keep this block last so screen breakpoints cannot override it. */
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body::before,
  body::after,
  #preloader,
  .topbar,
  .footer,
  .print-button,
  .mobile-menu {
    display: none !important;
  }

  .cv-shell {
    position: static !important;
    z-index: auto !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .main-column {
    min-width: 0 !important;
  }

  /* Compact horizontal identity block instead of the screen profile card. */
  .profile-card {
    display: grid !important;
    grid-template-columns: 30mm minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    column-gap: 7mm !important;
    row-gap: 2mm !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 0 6mm !important;
    padding: 4mm !important;
    border: 1px solid #bfc4c8 !important;
    border-radius: 2.5mm !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: visible !important;
    align-items: start !important;
  }

  .profile-image {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
    width: 30mm !important;
    height: 30mm !important;
    min-width: 30mm !important;
    min-height: 30mm !important;
    margin: 0 !important;
    padding: 0 !important;
    clip-path: none !important;
    -webkit-clip-path: none !important;
    border-radius: 2mm !important;
    background: transparent !important;
    overflow: hidden !important;
  }

  .profile-image img {
    display: block !important;
    width: 30mm !important;
    height: 30mm !important;
    min-width: 30mm !important;
    min-height: 30mm !important;
    max-width: 30mm !important;
    max-height: 30mm !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    object-position: center 42% !important;
    border-radius: 2mm !important;
    filter: none !important;
  }

  .profile-name {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: end !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
  }

  .profile-name strong {
    margin: 0 0 1mm !important;
    color: #111 !important;
    font-size: 17pt !important;
    line-height: 1.1 !important;
    letter-spacing: 0 !important;
  }

  .profile-name span {
    color: #555 !important;
    font-size: 8.5pt !important;
    line-height: 1.3 !important;
  }

  .profile-meta {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1.5mm 7mm !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .profile-meta::before,
  .profile-meta::after,
  .profile-meta > div::before {
    display: none !important;
    content: none !important;
  }

  .profile-meta > div {
    display: flex !important;
    align-items: baseline !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 1.5mm !important;
  }

  .profile-meta span {
    flex: 0 0 auto !important;
    margin: 0 !important;
    color: #777 !important;
    font-size: 6.8pt !important;
    line-height: 1.2 !important;
    letter-spacing: .04em !important;
  }

  .profile-meta strong,
  .profile-meta a {
    min-width: 0 !important;
    color: #111 !important;
    font-size: 8pt !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    border: 0 !important;
  }

  /* Print every tab as a continuous CV document. */
  .content-card {
    display: block !important;
    min-height: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .tab-page {
    display: block !important;
    opacity: 1 !important;
    animation: none !important;
  }

  #resume,
  #portfolio {
    break-before: page;
    page-break-before: always;
  }

  .content-section {
    margin: 0 0 5mm !important;
    padding: 4mm !important;
    border: 1px solid #d3d6d8 !important;
    border-radius: 2mm !important;
    background: #fff !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .section-line {
    margin-bottom: 5mm !important;
    padding-bottom: 4mm !important;
    border-bottom: 1px solid #d3d6d8 !important;
  }

  .alt-section {
    background: #fff !important;
  }

  .section-title {
    margin: 0 0 4mm !important;
    padding: 0 0 1mm !important;
  }

  .section-title span {
    bottom: 0 !important;
    height: 2px !important;
    opacity: 1 !important;
    background: #4aaed8 !important;
  }

  .section-title h1,
  .section-title h2 {
    color: #111 !important;
    font-size: 14pt !important;
    line-height: 1.2 !important;
  }

  p {
    color: #444 !important;
    font-size: 8.2pt !important;
    line-height: 1.45 !important;
  }

  .intro-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 7mm !important;
  }

  .service-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 4mm !important;
  }

  .service-card {
    min-height: 0 !important;
    padding: 4mm !important;
    border: 1px solid #ccc !important;
    border-radius: 2mm !important;
    background: #fff !important;
    box-shadow: none !important;
    transform: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .service-symbol {
    min-height: 0 !important;
    margin: 0 0 2mm !important;
    color: #3e9fc8 !important;
  }

  .service-symbol .flaticon::before {
    font-size: 18pt !important;
  }

  .service-card h3 {
    margin: 0 0 1.5mm !important;
    color: #111 !important;
    font-size: 9pt !important;
  }

  .skill-cloud,
  .project-tags {
    gap: 1.5mm !important;
  }

  .skill-cloud span,
  .project-tags span {
    padding: 1mm 1.5mm !important;
    border: 1px solid #bbb !important;
    border-radius: 1mm !important;
    background: #fff !important;
    color: #222 !important;
    font-size: 6.8pt !important;
  }

  /* Resume keeps the two-column geometry of the original template. */
  .resume-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10mm !important;
  }

  .resume-column-heading {
    min-height: 10mm !important;
    margin: 0 0 3mm -5mm !important;
    gap: 3mm !important;
  }

  .resume-column-icon {
    flex: 0 0 10mm !important;
    width: 10mm !important;
    height: 10mm !important;
    color: #111 !important;
    background: #fff !important;
    border: 1.5px solid #4aaed8 !important;
    box-shadow: none !important;
    font-size: 9pt !important;
  }

  .resume-column-title {
    color: #111 !important;
    font-size: 10pt !important;
  }

  .timeline {
    margin-left: 0 !important;
    padding-left: 5mm !important;
    border-left: 1.5px solid #7abbd5 !important;
  }

  .timeline article {
    padding: 0 0 5mm !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .timeline article::before {
    left: calc(-5mm - 4px) !important;
    top: 5mm !important;
    width: 6px !important;
    height: 6px !important;
    border: 1.5px solid #4aaed8 !important;
    background: #fff !important;
    transform: none !important;
  }

  .timeline-date {
    margin: 0 0 1mm !important;
    color: #388eaf !important;
    font-size: 6.8pt !important;
  }

  .timeline h4 {
    margin: 0 0 1.5mm !important;
    color: #111 !important;
    font-size: 9pt !important;
  }

  .timeline-link {
    color: #111 !important;
    border: 0 !important;
  }

  .project-grid {
    gap: 4mm !important;
  }

  .project-card {
    grid-template-columns: 14mm 1fr !important;
    border: 1px solid #ccc !important;
    border-radius: 2mm !important;
    background: #fff !important;
    box-shadow: none !important;
    transform: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .project-index {
    padding-top: 5mm !important;
    border-color: #ccc !important;
    color: #388eaf !important;
    font-size: 7pt !important;
  }

  .project-body {
    padding: 4mm !important;
  }

  .project-type {
    margin-bottom: 1mm !important;
    color: #666 !important;
    font-size: 6.5pt !important;
  }

  .project-body h3 {
    margin: 0 0 2mm !important;
    color: #111 !important;
    font-size: 13pt !important;
  }

  .project-tags {
    margin: 3mm 0 !important;
  }

  .project-link {
    color: #111 !important;
    font-size: 7.5pt !important;
    border-bottom: 1px solid #999 !important;
  }

  .contact-lead {
    margin-bottom: 4mm !important;
    font-size: 8.5pt !important;
  }

  .contact-links {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 3mm !important;
  }

  .contact-links > a {
    grid-template-columns: 8mm 1fr !important;
    gap: 2mm !important;
    padding: 3mm !important;
    border: 1px solid #ccc !important;
    border-radius: 2mm !important;
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
    transform: none !important;
    break-inside: avoid !important;
  }

  .contact-icon {
    color: #388eaf !important;
  }

  .contact-links small {
    color: #666 !important;
    font-size: 6.5pt !important;
  }

  .contact-links b {
    display: none !important;
  }
}

