:root {
  color-scheme: light;
  --ink: #141414;
  --muted: #5f6461;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --teal: #114b5f;
  --teal-deep: #0b2f3d;
  --coral: #ef6f5e;
  --gold: #d9a441;
  --line: rgba(20, 20, 20, 0.14);
  --shadow: 0 28px 90px rgba(14, 31, 35, 0.22);
  --wash-teal: rgba(17, 75, 95, 0.12);
  --wash-coral: rgba(239, 111, 94, 0.14);
  --glass: rgba(255, 255, 255, 0.72);
  --soft-hover: rgba(255, 255, 255, 0.64);
  --primary-bg: var(--ink);
  --primary-fg: #ffffff;
  --secondary-shadow: 0 12px 24px rgba(17, 75, 95, 0.1);
  --logo-filter: grayscale(1) brightness(0);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #f4f0ea;
    --muted: #b8b1aa;
    --paper: #12110f;
    --panel: #1b1917;
    --teal: #5fb7cc;
    --teal-deep: #d9f2f7;
    --coral: #ff8f7d;
    --gold: #e4b75f;
    --line: rgba(244, 240, 234, 0.16);
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
    --wash-teal: rgba(95, 183, 204, 0.16);
    --wash-coral: rgba(255, 143, 125, 0.12);
    --glass: rgba(27, 25, 23, 0.72);
    --soft-hover: rgba(244, 240, 234, 0.08);
    --primary-bg: #f4f0ea;
    --primary-fg: #12110f;
    --secondary-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    --logo-filter: grayscale(1) brightness(0) invert(1);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, var(--wash-teal), transparent 42%),
    linear-gradient(315deg, var(--wash-coral), transparent 38%),
    var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

.site-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 40px 0 28px;
}

.profile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  align-items: stretch;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.profile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-top: 7px solid var(--teal);
}

.portrait-wrap {
  min-height: 620px;
  background: var(--teal-deep);
}

.portrait {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.92) contrast(1.04);
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 6vw, 72px);
  min-width: 0;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 34px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  color: var(--teal-deep);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(4rem, 6vw, 5.7rem);
  line-height: 0.92;
  font-weight: 850;
  letter-spacing: 0;
}

.role {
  margin: 24px 0 0;
  color: var(--coral);
  font-size: clamp(1.45rem, 2.6vw, 2.55rem);
  font-weight: 760;
  line-height: 1.12;
}

.summary {
  max-width: 560px;
  margin: 36px 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.62;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 42px;
}

.primary-action,
.secondary-action,
.profile-menu summary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 800;
  line-height: 1;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.primary-action {
  background: var(--primary-bg);
  color: var(--primary-fg);
  box-shadow: 0 14px 28px rgba(20, 20, 20, 0.18);
}

.text-icon {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.secondary-action,
.profile-menu summary {
  border: 1px solid var(--line);
  color: var(--teal-deep);
}

.primary-action:hover,
.secondary-action:hover,
.profile-menu summary:hover {
  transform: translateY(-2px);
}

.primary-action:hover {
  background: var(--teal-deep);
}

.secondary-action:hover,
.profile-menu summary:hover {
  box-shadow: var(--secondary-shadow);
}

.profile-menu {
  position: relative;
}

.profile-menu summary {
  width: 48px;
  padding: 0;
  cursor: pointer;
  list-style: none;
  background: var(--glass);
}

.profile-menu summary::-webkit-details-marker {
  display: none;
}

.profile-menu summary span {
  font-size: 1.45rem;
  line-height: 1;
}

.profile-menu[open] summary {
  background: var(--teal);
  color: #fff;
}

.profile-menu-list {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  z-index: 2;
  min-width: 136px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-menu-list a {
  padding: 13px 16px;
  color: var(--teal-deep);
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1;
}

.profile-menu-list a + a {
  border-top: 1px solid var(--line);
}

.profile-menu-list a:hover {
  background: var(--soft-hover);
}

.references {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}

.references h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.reference-list {
  width: min(100%, 980px);
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
}

.reference-list li {
  min-width: 0;
}

.reference-logo {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.reference-logo img {
  width: min(136px, 100%);
  height: 32px;
  display: block;
  object-fit: contain;
  opacity: 0.5;
  filter: var(--logo-filter);
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 760;
}

.site-footer a {
  padding: 8px 10px;
  border-radius: 6px;
}

.site-footer a:hover {
  color: var(--teal-deep);
  background: var(--soft-hover);
}

.legal-shell {
  width: min(860px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-items: center;
  padding: 40px 0;
}

.legal-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 6vw, 64px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.legal-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-top: 7px solid var(--teal);
}

.back-link {
  display: inline-flex;
  margin-bottom: 34px;
  color: var(--teal-deep);
  font-size: 0.9rem;
  font-weight: 800;
}

.back-link:hover {
  color: var(--coral);
}

.legal-panel h1 {
  font-size: clamp(3rem, 7vw, 4.8rem);
  line-height: 0.96;
}

.legal-section {
  max-width: 640px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.legal-section h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.25;
}

.legal-section p {
  margin: 0;
}

.cv-shell {
  width: min(1040px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0;
}

.cv-page {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 56px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.cv-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-top: 7px solid var(--teal);
}

.cv-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: start;
}

.cv-header .back-link {
  margin-bottom: 18px;
}

.cv-header h1 {
  max-width: none;
  font-size: clamp(3.4rem, 7vw, 5rem);
}

.cv-role {
  margin: 14px 0 0;
  color: var(--coral);
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  font-weight: 800;
  line-height: 1.08;
}

.cv-contact-card {
  min-width: 210px;
  margin: 42px 0 0;
  display: grid;
  gap: 14px;
  justify-items: start;
}

.cv-avatar {
  width: 104px;
  height: 104px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
  filter: saturate(0.92) contrast(1.04);
}

.cv-contact {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  list-style: none;
}

.cv-contact a {
  color: var(--teal-deep);
}

.cv-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.cv-section h2 {
  margin: 0 0 12px;
  color: var(--teal-deep);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.cv-section p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.cv-profile p {
  max-width: 820px;
  color: var(--ink);
  font-size: 1.05rem;
}

.cv-skills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
}

.cv-skills strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

.cv-timeline {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 30px;
  list-style: none;
}

.cv-timeline li {
  break-inside: avoid;
}

.cv-item-head {
  display: grid;
  gap: 3px;
  margin-bottom: 6px;
}

.cv-item-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.22;
}

.cv-item-head span {
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.2;
}

.cv-compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.cv-compact-grid > div {
  break-inside: avoid;
}

@media print {
  :root {
    color-scheme: light;
    --ink: #111111;
    --muted: #444444;
    --paper: #ffffff;
    --panel: #ffffff;
    --teal-deep: #111111;
    --coral: #111111;
    --line: rgba(0, 0, 0, 0.18);
  }

  @page {
    size: A4;
    margin: 12mm;
  }

  html,
  body {
    min-height: 0;
    background: #ffffff;
  }

  .cv-shell {
    width: auto;
    min-height: 0;
    padding: 0;
  }

  .cv-page {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .cv-page::before,
  .back-link,
  .cv-download {
    display: none;
  }

  .cv-header {
    gap: 18px;
  }

  .cv-header h1 {
    font-size: 38pt;
  }

  .cv-role {
    margin-top: 6px;
    font-size: 17pt;
  }

  .cv-contact-card {
    margin-top: 4px;
    gap: 8px;
  }

  .cv-avatar {
    width: 58px;
    height: 58px;
    border-radius: 4px;
  }

  .cv-contact {
    font-size: 8.5pt;
  }

  .cv-linkedin a {
    font-size: 0;
  }

  .cv-linkedin a::after {
    content: attr(data-print-label);
    font-size: 8.5pt;
  }

  .cv-section {
    margin-top: 13px;
    padding-top: 10px;
  }

  .cv-section h2 {
    margin-bottom: 7px;
    font-size: 8.5pt;
  }

  .cv-section p,
  .cv-profile p {
    font-size: 8.8pt;
    line-height: 1.32;
  }

  .cv-timeline {
    gap: 10px 18px;
  }

  .cv-item-head {
    margin-bottom: 3px;
  }

  .cv-item-head h3 {
    font-size: 9pt;
    line-height: 1.15;
  }

  .cv-item-head span {
    font-size: 7.8pt;
  }
}

@media (max-width: 820px) {
  .site-shell {
    width: min(100% - 22px, 620px);
    padding-top: 18px;
  }

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

  .portrait-wrap {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .intro {
    padding: 32px 24px 30px;
  }

  .eyebrow {
    margin-bottom: 24px;
  }

  h1 {
    max-width: 9ch;
  }

  .summary {
    margin-top: 24px;
  }

  .actions {
    margin-top: 30px;
  }

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

  .cv-header,
  .cv-skills,
  .cv-timeline,
  .cv-compact-grid {
    grid-template-columns: 1fr;
  }

  .cv-contact {
    margin-top: 0;
  }

  .cv-contact-card {
    margin-top: 0;
  }
}

@media (max-width: 420px) {
  .actions {
    display: grid;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .profile-menu-list {
    top: calc(100% + 8px);
    left: 0;
  }

  .reference-list {
    grid-template-columns: 1fr;
  }
}
