:root {
  --bg: #15171c;
  --surface: #1f232b;
  --surface-strong: #262b35;
  --text: #f4f6fb;
  --muted: #b7bfcc;
  --border: #363d4a;
  --chosen-border: var(--border);
  --border-image: none;
  --gradient-angle: 0deg;
  --accent: #4ea1ff;
  --accent-strong: #1e90ff;
  --chip-bg: #293141;
  --chip-border: #3a465a;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.25);

  --advanced: #48d17a;
  --strong: #78c6ff;
  --intermediate: #ffd166;
  --basic: #ff9f6e;

  color-scheme: dark;
}

@property --gradient-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

body.light-theme {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-strong: #f7f9fc;
  --text: #1e2430;
  --muted: #5f6b7a;
  --border: #aeb8c5;
  --chosen-border: var(--border);
  --border-image: none;
  --gradient-angle: 0deg;
  --accent: #006fd6;
  --accent-strong: #005fc0;
  --chip-bg: #eef4fb;
  --chip-border: #aeb8c5;
  --shadow: 0 18px 45px rgba(18, 38, 63, 0.08);

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 2rem;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(circle at top left, rgba(78, 161, 255, 0.12), transparent 34rem),
    var(--bg);
  color: var(--text);
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

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

a:hover,
a:focus {
  color: var(--accent-strong);
  text-decoration: underline;
}

a[data-private-repository] {
  cursor: not-allowed;
}

a[data-private-repository]::after {
  content: "Private";
  display: inline-flex;
  align-items: center;
  margin-left: 0.45rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.4;
  text-transform: uppercase;
  vertical-align: middle;
}

html[lang="fi"] a[data-private-repository]::after {
  content: "Yksityinen";
}

.private-repository-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1200;
  width: min(25rem, calc(100vw - 2rem));
  padding: 1rem 3rem 1rem 1rem;
  border: 1px solid var(--chosen-border);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(78, 161, 255, 0.12), transparent 55%),
    var(--surface-strong);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(0.8rem);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.private-repository-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.private-repository-toast strong {
  display: block;
  margin-bottom: 0.25rem;
}

.private-repository-toast p {
  margin: 0;
  color: var(--muted);
}

.private-repository-toast button {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.private-repository-toast button:hover,
.private-repository-toast button:focus {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent-strong);
}

button,
a {
  outline-offset: 3px;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.2;
  color: var(--text);
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
}

p {
  margin-top: 0;
}

ul {
  margin-top: 0;
}

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

.page-actions {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent-strong);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  transition: all 0.4s ease;
}

.action-button {
  position: relative;
  overflow: hidden;
}

.action-button::before {
  content: "";
  position: absolute;
  inset: -80%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(78, 161, 255, 0.9) 0 1px, transparent 2px);
  background-size: 42px 42px, 28px 28px;
  opacity: 0;
  transform: translateY(20%) rotate(0deg);
  pointer-events: none;
}

.action-button:hover {
  color: #000000;
  transform: scale(1.06) translateY(-2px);
  filter: brightness(1.18) saturate(1.25);
  box-shadow:
    0 0 18px rgba(78, 161, 255, 0.75),
    0 0 38px rgba(78, 161, 255, 0.45),
    0 14px 44px rgba(0, 0, 0, 0.35);
}

.action-button:hover::before {
  opacity: 0.45;
  animation: button-sparks 2s ease-in-out infinite;
}

@keyframes button-sparks {
  0%, 100% {
    transform: translateY(20%) rotate(0deg);
  }
  25% {
    transform: translateY(-5%) rotate(4deg);
  }
  50% {
    transform: translateY(-15%) rotate(10deg);
  }
  75% {
    transform: translateY(-5%) rotate(4deg);
  }
}

.action-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 20%,
    rgba(255, 255, 255, 0.55),
    transparent 80%
  );
  transform: translateX(-140%);
  pointer-events: none;
}

.action-button:hover::after {
  animation: button-shine 0.75s ease;
}

@keyframes button-shine {
  to {
    transform: translateX(140%);
  }
}

@keyframes spin-border {
  0% {
    --gradient-angle: 0deg;
  }
  100% {
    --gradient-angle: 360deg;
  }
}

.action-button.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--chosen-border);
}

.print-options-dialog {
  width: min(34rem, calc(100vw - 2rem));
  padding: 1.4rem;
  border: 1px solid var(--chosen-border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.print-options-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.print-options-dialog h2 {
  margin-bottom: 0.55rem;
}

.print-options-dialog p {
  color: var(--muted);
}

.print-options-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.hero,
.section,
.footer {
  background: rgba(31, 35, 43, 0.92);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--chosen-border);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(1.25rem, 4vw, 2rem);
  margin-bottom: 1.25rem;
}

.section {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: 1.25rem;
}

.footer {
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--muted);
  text-align: center;
}

.footer p {
  margin: 0;
}

.nav-menu {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.nav-menu a {
  padding: 0.5rem 1rem;
  border: 1px solid var(--chosen-border);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
  transition: all 0.4s ease;
}

.nav-menu a:hover {
  background: var(--accent);
  color: white;
}

.profile {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.profile-image {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.profile-main {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin-bottom: 0.4rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subtitle {
  max-width: 820px;
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
}

.contact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.6rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list li {
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
}

.contact-label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.clean-list,
.info-list {
  padding-left: 1.2rem;
}

.target-roles {
  padding: 0.8rem 1rem;
  margin: 1rem 0 0;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--surface-strong);
}

.section-intro {
  max-width: 820px;
  margin-bottom: 1rem;
  color: var(--muted);
}

.skill-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: -0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.skill-legend span {
  display: inline-flex;
  align-items: center;
}

.skill-legend span::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.4rem;
  border-radius: 999px;
}

.skill-legend .advanced::before {
  background: var(--advanced);
}

.skill-legend .strong::before {
  background: var(--strong);
}

.skill-legend .intermediate::before {
  background: var(--intermediate);
}

.clean-list li,
.info-list li,
.experience-item li {
  margin-bottom: 0.45rem;
}

.skill-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.skill-group,
.experience-item,
.project-card,
.timeline-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
}

.skill-group {
  padding: 1rem;
}

.skills,
.interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.skill,
.interest-list span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.92rem;
}

.skill::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 999px;
  background: var(--muted);
}

.skill.advanced::before {
  background: var(--advanced);
}

.skill.strong::before {
  background: var(--strong);
}

.skill.intermediate::before {
  background: var(--intermediate);
}

.skill.basic::before {
  background: var(--basic);
}

.experience-item {
  padding: 1.15rem;
  margin-bottom: 1rem;
}

.experience-independent {
  border-left: 4px solid var(--accent);
}

.experience-item:last-child {
  margin-bottom: 0;
}

.experience-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.meta {
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.experience-item ul {
  margin-bottom: 0;
  padding-left: 1.2rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project-card {
  padding: 1rem;
}

.project-card p:last-child {
  margin-bottom: 0;
}

.tech-stack {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 0.8rem;
}

.timeline-item {
  padding: 1rem;
}

.timeline-item p:last-child {
  margin-bottom: 0;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
}

.info-list {
  margin-bottom: 0;
}

@media (max-width: 850px) {
  body {
    padding: 1rem;
  }

  .page-actions {
    position: static;
    margin: 0 auto 1rem;
    justify-content: center;
  }

  .profile {
    flex-direction: column;
  }

  .profile-image {
    width: 150px;
    height: 150px;
  }

  .contact-list,
  .skill-groups,
  .project-grid,
  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body {
    padding: 0.75rem;
  }

  .profile > a {
    display: none;
  }

  .profile {
    gap: 0.75rem;
  }

  .contact-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .contact-list li {
    padding: 0.6rem;
  }

  .contact-list li:nth-child(3) {
    grid-column: 1 / -1;
  }

  .hero,
  .section,
  .footer {
    border-radius: 16px;
  }

  .action-button {
    width: 100%;
  }

  .page-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal[hidden] {
  display: none !important;
}

.modal:not([hidden]) {
  display: flex;
}

.modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
}

#prev-image,
#next-image {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.8);
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #000;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

#prev-image {
  left: 20px;
}

#next-image {
  right: 20px;
}

#prev-image:hover,
#next-image:hover {
  background: rgba(255, 255, 255, 1);
}

#close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #000;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

#close-modal:hover {
  background: rgba(255, 255, 255, 1);
}

@media print {
  :root,
  body.light-theme {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --text: #000000;
    --muted: #444444;
    --border: #cccccc;
    --accent: #000000;
    --accent-strong: #000000;
    --chip-bg: #ffffff;
    --chip-border: #bbbbbb;
    --shadow: none;
  }

  @page {
    margin: 1.4cm;
  }

  @page onePageCv {
    size: A4;
    margin: 0.55cm;
  }

  body {
    padding: 0;
    background: #ffffff;
    color: #000000;
    font-size: 10.5pt;
  }

  a {
    color: #000000;
    text-decoration: none;
  }

  .page-actions,
  .print-options-dialog,
  .border-color-picker {
    display: none;
  }

  .cv-container {
    width: 100%;
  }

  .hero,
  .section,
  .footer,
  .skill-group,
  .experience-item,
  .project-card,
  .timeline-item {
    box-shadow: none;
    background: #ffffff;
  }

  .hero,
  .section,
  .footer {
    padding: 0;
    margin-bottom: 0.9rem;
    border: none;
    border-radius: 0;
  }

  .profile {
    gap: 1rem;
  }

  .profile-image {
    width: 110px;
    height: 110px;
    border-radius: 10px;
  }

  h1 {
    font-size: 24pt;
  }

  h2 {
    margin-top: 0.3rem;
    padding-bottom: 0.15rem;
    border-bottom: 1px solid #cccccc;
    font-size: 14pt;
  }

  h3 {
    font-size: 11.5pt;
  }

  .subtitle {
    font-size: 11pt;
  }

  .contact-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.25rem 0.8rem;
  }

  .contact-list li {
    padding: 0;
    border: none;
  }

  .contact-label {
    display: inline;
    margin-right: 0.3rem;
  }

  .skill-groups,
  .project-grid,
  .two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .skill-group,
  .experience-item,
  .project-card,
  .timeline-item {
    padding: 0.55rem 0;
    border: none;
    border-bottom: 1px solid #dddddd;
    border-radius: 0;
    break-inside: avoid;
  }

  .skill,
  .interest-list span {
    padding: 0.15rem 0.45rem;
    border-color: #bbbbbb;
    background: #ffffff;
    color: #000000;
  }

  .section,
  .experience-item,
  .project-card,
  .timeline-item,
  .skill-group {
    break-inside: avoid;
  }

  .footer {
    display: none;
  }

  body.print-one-page {
    page: onePageCv;
    font-size: 8.15pt;
    line-height: 1.2;
  }

  body.print-one-page .cv-container {
    width: 100%;
    max-width: none;
  }

  body.print-one-page .nav-menu,
  body.print-one-page .cv-section-details,
  body.print-one-page .cv-section-interests,
  body.print-one-page .footer {
    display: none;
  }

  body.print-one-page .hero,
  body.print-one-page .section {
    margin-bottom: 0.24rem;
  }

  body.print-one-page .profile {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
  }

  body.print-one-page .profile-image {
    display: block;
    width: 58px;
    height: 58px;
    border-radius: 7px;
  }

  body.print-one-page .eyebrow {
    margin-bottom: 0.05rem;
    font-size: 6.8pt;
  }

  body.print-one-page h1 {
    margin-bottom: 0.08rem;
    font-size: 16pt;
    letter-spacing: 0;
  }

  body.print-one-page h2 {
    margin: 0.1rem 0 0.16rem;
    padding-bottom: 0.05rem;
    font-size: 9.2pt;
  }

  body.print-one-page h3 {
    margin-bottom: 0.05rem;
    font-size: 7.9pt;
  }

  body.print-one-page p,
  body.print-one-page ul {
    margin-bottom: 0.14rem;
  }

  body.print-one-page .subtitle {
    max-width: none;
    margin-bottom: 0.16rem;
    font-size: 8.4pt;
  }

  body.print-one-page .contact-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.08rem 0.35rem;
    font-size: 7.2pt;
  }

  body.print-one-page .contact-list li {
    display: inline;
  }

  body.print-one-page .contact-list li::after {
    content: " |";
  }

  body.print-one-page .contact-list li:last-child::after {
    content: "";
  }

  body.print-one-page .contact-label {
    font-size: 6.4pt;
  }

  body.print-one-page .clean-list,
  body.print-one-page .info-list,
  body.print-one-page .experience-item ul {
    padding-left: 0.75rem;
  }

  body.print-one-page .clean-list li,
  body.print-one-page .info-list li,
  body.print-one-page .experience-item li {
    margin-bottom: 0.02rem;
  }

  body.print-one-page .skill-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.18rem 0.45rem;
  }

  body.print-one-page .skill-legend {
    gap: 0.15rem 0.5rem;
    margin: 0 0 0.12rem;
    font-size: 6.6pt;
  }

  body.print-one-page .skill-legend span::before {
    width: 0.28rem;
    height: 0.28rem;
    margin-right: 0.14rem;
  }

  body.print-one-page .skill-group-secondary {
    display: none;
  }

  body.print-one-page .skill-group,
  body.print-one-page .experience-item,
  body.print-one-page .timeline-item {
    padding: 0.12rem 0;
    border-bottom: 1px solid #dddddd;
  }

  body.print-one-page .skills {
    gap: 0.08rem 0.18rem;
  }

  body.print-one-page .skill {
    min-height: 0;
    padding: 0;
    border: none;
    font-size: 6.7pt;
  }

  body.print-one-page .skill::before {
    width: 0.28rem;
    height: 0.28rem;
    margin-right: 0.14rem;
  }

  body.print-one-page .meta {
    margin-bottom: 0.04rem;
    font-size: 7.1pt;
  }

  body.print-one-page .experience-item:nth-of-type(-n+4) li:nth-child(n+3),
  body.print-one-page .experience-item:nth-of-type(n+5) li:nth-child(n+2),
  body.print-one-page .timeline-item:nth-child(n+5) {
    display: none;
  }

  body.print-one-page .cv-section-summary p:nth-of-type(2) {
    display: none;
  }

  body.print-one-page .target-roles {
    padding: 0;
    margin: 0.1rem 0 0;
    border: none;
    background: transparent;
  }

  body.print-one-page .section-intro {
    display: none;
  }

  body.print-one-page .project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.18rem 0.45rem;
  }

  body.print-one-page .project-card:nth-child(n+4),
  body.print-one-page .project-card > p:not(.tech-stack),
  body.print-one-page .project-card ul {
    display: none;
  }

  body.print-one-page .project-card {
    padding: 0.12rem 0;
  }

  body.print-one-page .tech-stack {
    margin: 0;
    font-size: 6.7pt;
    font-weight: 600;
  }

  body.print-one-page .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.08rem 0.45rem;
  }

  body.print-one-page .timeline-item p:not(.meta) {
    display: none;
  }
}

@media (max-width: 760px) {
  .border-color-picker {
    top: auto;
    bottom: 0.8rem;
    left: 50%;
    flex-direction: row;
    transform: translateX(-50%);
  }
}

/* Portfolio-specific styles */

.portfolio-page .hero {
  position: relative;
  overflow: hidden;
}

.portfolio-page .hero::after {
  content: "";
  position: absolute;
  right: -5rem;
  top: -5rem;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(78, 161, 255, 0.22), transparent 70%);
  pointer-events: none;
}

.portfolio-page .hero > * {
  position: relative;
  z-index: 1;
}

.portfolio-page .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.25rem 0 0;
}

.portfolio-page .skills-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.portfolio-page .skills-list li {
  position: relative;
  min-width: 0;
  padding: 0.85rem 1rem 0.85rem 2.35rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-strong);
  color: var(--muted);
}

.portfolio-page .skills-list li::before {
  content: "◆";
  position: absolute;
  left: 0.95rem;
  color: var(--accent);
  font-size: 0.85rem;
}

.portfolio-page .carousel {
  position: relative;
  width: 100%;
  margin-top: 1.5rem;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(78, 161, 255, 0.08), transparent 45%),
    var(--surface-strong);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

.portfolio-page .carousel-viewport {
  overflow: hidden;
  width: 100%;
  border-radius: 21px 21px 0 0;
}

.portfolio-page .carousel-slides {
  display: flex;
  width: 100%;
  transition: transform 0.5s ease;
}

.portfolio-page .carousel-slide {
  flex: 0 0 100%;
  min-width: 100%;
}

.portfolio-page .carousel-slide img {
  width: 100%;
  height: clamp(260px, 48vw, 560px);
  object-fit: contain;
  display: block;
  padding: 1rem;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.14);
}

.border-color-picker {
  position: fixed;
  top: 50%;
  left: 0.8rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.5rem;
  border: 1px solid var(--chosen-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}

.border-color-picker button {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--swatch-color) 76%, #ffffff);
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.border-color-picker button.gradient-swatch {
  background: conic-gradient(from 0deg, #4ea1ff, #8b5cf6, #ec4899, #4ea1ff);
  border-color: #ffffff;
}

body.gradient-border .hero,
body.gradient-border .section,
body.gradient-border .footer,
body.gradient-border .nav-menu a,
body.gradient-border .skill-group,
body.gradient-border .experience-item,
body.gradient-border .project-card,
body.gradient-border .timeline-item,
body.gradient-border .contact-list li,
body.gradient-border .portfolio-page .carousel,
body.gradient-border .portfolio-page .portfolio-card,
body.gradient-border .case-study-card,
body.gradient-border .case-study-link {
  border-color: transparent;
  isolation: isolate;
  position: relative;
}

body.gradient-border .hero::before,
body.gradient-border .section::before,
body.gradient-border .footer::before,
body.gradient-border .nav-menu a::before,
body.gradient-border .skill-group::before,
body.gradient-border .experience-item::before,
body.gradient-border .project-card::before,
body.gradient-border .timeline-item::before,
body.gradient-border .contact-list li::before,
body.gradient-border .portfolio-page .carousel::before,
body.gradient-border .portfolio-page .portfolio-card::before,
body.gradient-border .case-study-card::before,
body.gradient-border .case-study-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--gradient-angle), #4ea1ff, #8b5cf6, #ec4899, #4ea1ff);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin-border 2.5s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.border-color-picker button:hover,
.border-color-picker button:focus {
  transform: scale(1.12);
}

.border-color-picker button.active,
.border-color-picker button[aria-pressed="true"] {
  border-color: #ffffff;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--swatch-color),
    inset 0 0 0 2px rgba(0, 0, 0, 0.16);
}

.border-color-picker button.gradient-swatch.active,
.border-color-picker button.gradient-swatch[aria-pressed="true"] {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px #8b5cf6,
    0 0 18px rgba(139, 92, 246, 0.55),
    inset 0 0 0 2px rgba(0, 0, 0, 0.16);
}

.skill-group,
.experience-item,
.project-card,
.timeline-item,
.contact-list li,
.skill,
.interest-list span,
.portfolio-page .skills-list li,
.portfolio-page .carousel,
.portfolio-page .portfolio-card,
.portfolio-page .portfolio-card-image,
.portfolio-page .project-meta li,
.portfolio-page .tech-stack,
.case-study-card,
.case-study-image,
.case-study-link {
  border-color: var(--chosen-border);
}

@media print {
  .border-color-picker {
    display: none;
  }
}

@media (max-width: 760px) {
  .border-color-picker {
    top: auto;
    bottom: 0.8rem;
    left: 50%;
    flex-direction: row;
    transform: translateX(-50%);
  }
}

.portfolio-page .carousel-title {
  position: relative;
  color: white;
  font-family: 'Oswald', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  margin: 0;
  padding: 0.85rem 1rem 0;
  z-index: 2;
}

.portfolio-page .carousel-controls {
  position: relative;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.75rem 1rem 1rem;
}

.portfolio-page .carousel-control {
  position: relative;
  width: 2.15rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition:
    width 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.portfolio-page .carousel-control::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.55rem);
  width: max-content;
  max-width: min(14rem, 80vw);
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text);
  content: attr(data-title);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 0.2rem);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
  white-space: normal;
  z-index: 4;
}

.portfolio-page .carousel-control:hover,
.portfolio-page .carousel-control:focus {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.78);
}

.portfolio-page .carousel-control:hover::after,
.portfolio-page .carousel-control:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.portfolio-page .carousel-control.active,
.portfolio-page .carousel-control[aria-current="true"] {
  width: 3.4rem;
  border-color: var(--accent);
  background: var(--accent);
}

.portfolio-page .portfolio-projects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.portfolio-page .portfolio-projects.featured-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portfolio-page .case-study-list {
  display: grid;
  gap: 1rem;
}

.portfolio-page .case-study-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  gap: 1.25rem;
  align-items: center;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(78, 161, 255, 0.055), transparent 45%),
    var(--surface-strong);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.portfolio-page .case-study-content {
  min-width: 0;
}

.portfolio-page .case-study-kicker {
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portfolio-page .case-study-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}

.portfolio-page .case-study-points div {
  min-width: 0;
}

.portfolio-page .case-study-points dt {
  margin-bottom: 0.2rem;
  color: var(--text);
  font-weight: 800;
}

.portfolio-page .case-study-points dd {
  margin: 0;
  color: var(--muted);
}

.portfolio-page .case-study-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.portfolio-page .case-study-link:hover,
.portfolio-page .case-study-link:focus {
  color: #ffffff;
  background: var(--accent-strong);
  text-decoration: none;
}

.portfolio-page .case-study-image {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: zoom-in;
}

.portfolio-page .portfolio-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(78, 161, 255, 0.055), transparent 45%),
    var(--surface-strong);
  padding: 1rem;
  opacity: 0;
  transform: translateY(1.3rem);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
  transition:
    opacity 0.55s ease,
    transform 0.55s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.portfolio-page .portfolio-card.visible,
.portfolio-page .portfolio-card.visible-left,
.portfolio-page .portfolio-card.visible-right {
  opacity: 1;
  transform: translateY(0);
}

.portfolio-page .portfolio-card:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  transform: translateY(-0.2rem);
}

.portfolio-page .portfolio-card.featured {
  padding: 1.1rem;
}

.portfolio-page .portfolio-card h3 {
  margin-bottom: 0.7rem;
}

.portfolio-page .portfolio-card p:last-child {
  margin-bottom: 0;
}

.portfolio-page .portfolio-card-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  display: block;
  margin: 0.2rem 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: zoom-in;
}

.portfolio-page .project-impact {
  margin-bottom: 0.75rem;
  color: var(--text);
  font-weight: 700;
}

.portfolio-page .project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0.9rem 0;
  list-style: none;
}

.portfolio-page .project-meta li {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.25rem 0.62rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.portfolio-page .tech-stack {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.portfolio-page .contact-section {
  text-align: center;
}

.portfolio-page .contact-section p {
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
  color: var(--muted);
}

.portfolio-page .contact-section .hero-actions {
  justify-content: center;
}

/* Portfolio modal enhancement */
.portfolio-page .modal {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
}

.portfolio-page .modal img {
  max-width: min(92vw, 1180px);
  max-height: 86vh;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.portfolio-page .modal-button,
.portfolio-page #prev-image,
.portfolio-page #next-image,
.portfolio-page #close-modal {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
}

.portfolio-page .modal-button:hover,
.portfolio-page #prev-image:hover,
.portfolio-page #next-image:hover,
.portfolio-page #close-modal:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 980px) {
  .portfolio-page .portfolio-projects,
  .portfolio-page .portfolio-projects.featured-grid,
  .portfolio-page .skills-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-page .case-study-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .portfolio-page .hero-actions {
    flex-direction: column;
  }

  .portfolio-page .hero-actions .action-button {
    width: 100%;
  }

  .portfolio-page .portfolio-projects,
  .portfolio-page .portfolio-projects.featured-grid,
  .portfolio-page .skills-list,
  .portfolio-page .case-study-points {
    grid-template-columns: 1fr;
  }

  .portfolio-page .carousel-slide img {
    height: 260px;
    padding: 0.75rem;
  }

  .portfolio-page .carousel-control {
    width: 1.65rem;
    height: 0.55rem;
  }

  .portfolio-page .carousel-control.active,
  .portfolio-page .carousel-control[aria-current="true"] {
    width: 2.6rem;
  }
}

@media print {
  .portfolio-page .carousel,
  .portfolio-page .modal {
    display: none !important;
  }

  .portfolio-page .portfolio-projects,
  .portfolio-page .portfolio-projects.featured-grid,
  .portfolio-page .skills-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .portfolio-page .portfolio-card {
    opacity: 1;
    transform: none;
    padding: 0.55rem 0;
    border: none;
    border-bottom: 1px solid #dddddd;
    border-radius: 0;
    box-shadow: none;
    background: #ffffff;
    break-inside: avoid;
  }

  .portfolio-page .portfolio-card-image {
    display: none;
  }

  .portfolio-page .case-study-card {
    padding: 0.55rem 0;
    border: none;
    border-bottom: 1px solid #dddddd;
    border-radius: 0;
    box-shadow: none;
    background: #ffffff;
    break-inside: avoid;
  }

  .portfolio-page .case-study-image {
    display: none;
  }

  .portfolio-page .case-study-points {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .portfolio-page .project-meta li,
  .portfolio-page .tech-stack,
  .portfolio-page .case-study-link {
    border-color: #bbbbbb;
    background: #ffffff;
    color: #000000;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-page *,
  .portfolio-page *::before,
  .portfolio-page *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .portfolio-page .portfolio-card {
    opacity: 1;
    transform: none;
  }
}
