:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --text: #171714;
  --muted: #6c6c65;
  --line: #dfdfd8;
  --line-strong: #c9c9c0;
  --accent-soft: #eeeeea;
  --button-primary-bg: #171714;
  --button-primary-text: #ffffff;
  --content: 920px;
  --radius: 16px;
}

html[data-theme="dark"] {
  --bg: #151513;
  --surface: #20201d;
  --text: #f3f3ee;
  --muted: #aaa9a0;
  --line: #363631;
  --line-strong: #5b5b53;
  --accent-soft: #2b2b26;
  --button-primary-bg: #f3f3ee;
  --button-primary-text: #171714;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

a:focus-visible,
summary:focus-visible,
.project-row-toggle:focus-visible {
  outline: 3px solid #8d8d84;
  outline-offset: 4px;
}

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

.page-shell {
  width: min(calc(100% - 2.5rem), var(--content));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.top-actions a:hover,
.theme-toggle:hover,
.site-footer a:hover,
.project-action:hover {
  color: var(--text);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.github-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.72;
  transition: opacity 160ms ease, filter 160ms ease;
}

.github-link:hover .github-icon {
  opacity: 1;
}

.linkedin-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

html[data-theme="dark"] .github-icon {
  filter: invert(1);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 34px;
  padding: 0.24rem 0.7rem 0.24rem 0.38rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 3px solid #8d8d84;
  outline-offset: 4px;
}

.theme-toggle-track {
  display: flex;
  width: 37px;
  height: 22px;
  align-items: center;
  padding: 2px;
  background: var(--text);
  border-radius: 999px;
  transition: background-color 180ms ease;
}

.theme-toggle-knob {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

html[data-theme="dark"] .theme-toggle-track {
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
}

html[data-theme="dark"] .theme-toggle-knob {
  color: var(--surface);
  background: var(--text);
  transform: translateX(15px);
}

.theme-icon {
  display: none;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-icon-moon {
  display: block;
  fill: currentColor;
  stroke: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.nav-cv {
  padding: 0.5rem 0.8rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

.nav-divider {
  width: 1px;
  height: 20px;
  margin: 0 0.1rem;
  background: var(--line);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  grid-template-rows: auto auto auto auto;
  grid-template-areas:
    "eyebrow visual"
    "title visual"
    "intro visual"
    "actions visual";
  column-gap: 3rem;
  align-items: center;
  padding: 5.5rem 0 4.5rem;
}

.hero-copy,
.hero-action-row {
  display: contents;
}

.eyebrow,
.project-type {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow {
  grid-area: eyebrow;
  margin-bottom: 1.15rem;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.045em;
}

h1 {
  grid-area: title;
  font-size: clamp(3.25rem, 8vw, 5.8rem);
  line-height: 0.95;
  font-weight: 760;
}

h2 {
  font-size: 1.12rem;
  line-height: 1.2;
  font-weight: 720;
}

.hero-intro {
  grid-area: intro;
  max-width: 42ch;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.hero-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.7rem;
}

.hero-github {
  gap: 0.45rem;
}

.hero-linkedin {
  gap: 0.45rem;
}

.external-link-icon,
.button-icon {
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
}

.button-with-icon {
  gap: 0.45rem;
}

.button-icon {
  width: 15px;
  height: 15px;
}

.cv-file-icon {
  stroke-width: 1.75;
}

.button-mail-icon {
  stroke-width: 1.9;
}

.external-link-icon {
  width: 15px;
  height: 15px;
  transition: transform 160ms ease;
}

.hero-github:hover .hero-external-arrow,
.hero-linkedin:hover .hero-external-arrow {
  transform: translate(1px, -1px);
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 720;
  transition: transform 160ms ease, background-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: var(--button-primary-text);
  background: var(--button-primary-bg);
  border-color: var(--button-primary-bg);
}

.button-secondary {
  background: var(--surface);
}

.hero-visual {
  grid-area: visual;
  align-self: center;
  margin: 0;
}

.hero-visual img {
  width: 190px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  filter: saturate(0.8);
}

.accordion-stack {
  display: grid;
  gap: 0.75rem;
  padding-bottom: 4rem;
}

.accordion {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.accordion[open] {
  border-color: var(--line-strong);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--text) 7%, transparent);
}

.accordion summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 76px;
  padding: 1rem 1.25rem;
  transition: background-color 180ms ease;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.accordion summary::before {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 0;
  width: 3px;
  content: "";
  background: transparent;
  border-radius: 0 999px 999px 0;
  transition: background-color 180ms ease;
}

.accordion[open] > summary {
  background: color-mix(in srgb, var(--accent-soft) 68%, var(--surface));
}

.accordion[open] > summary::before {
  background: var(--line-strong);
}

.accordion[open] .summary-index {
  color: var(--text);
}

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

.summary-index {
  width: 2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.summary-label {
  min-width: 0;
  flex: 1;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.expand-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: transform 180ms ease, background-color 160ms ease, border-color 160ms ease;
}

.accordion summary:hover .expand-icon {
  background: var(--accent-soft);
  border-color: var(--text);
}

.expand-icon svg,
.project-expand-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.accordion[open] .expand-icon {
  transform: rotate(180deg);
}

.accordion-content {
  overflow: hidden;
  padding: 0 1.25rem 1.45rem;
  border-top: 1px solid var(--line);
}

.accordion.is-opening > .accordion-content {
  animation: accordion-open 220ms ease both;
}

.accordion.is-closing > .accordion-content {
  pointer-events: none;
  animation: accordion-close 180ms ease both;
}

.career-list,
.project-list {
  display: grid;
}

.career-entry {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.entry-year {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.career-entry p,
.supporting-note,
.working-style p,
.project-row > p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.career-entry .career-role {
  color: var(--text);
  font-weight: 650;
}

.career-entry .career-description {
  margin-top: 0.15rem;
}

.supporting-note {
  max-width: 100%;
  margin-top: 1.2rem;
}

.career-history {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.career-history > h2 {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.career-credential {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.credential-mark {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 8px;
  color: var(--button-primary-text);
  background: var(--button-primary-bg);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.credential-copy {
  display: grid;
  gap: 0.08rem;
}

.credential-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.career-credential strong {
  font-size: 0.96rem;
  line-height: 1.25;
}

.credential-code {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
}

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

.skill-group {
  min-width: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.tags span {
  padding: 0.35rem 0.6rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
}

.working-style {
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.working-style p {
  max-width: 65ch;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(155px, 0.8fr) minmax(0, 1.5fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--line);
}

.project-row-toggle {
  cursor: pointer;
}

.project-row-toggle:hover .project-more {
  background: var(--accent-soft);
  border-color: var(--text);
}

.project-row:last-child,
.career-entry:last-child {
  border-bottom: 0;
}

.project-detail {
  margin: -0.45rem 0 0;
  padding: 0 0 1.2rem;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.project-detail.is-opening {
  animation: project-detail-open 220ms ease both;
}

.project-detail.is-closing {
  pointer-events: none;
  animation: project-detail-close 180ms ease both;
}

.project-more {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  pointer-events: none;
  font: inherit;
}

.project-row-toggle[aria-expanded="true"] .project-more {
  color: var(--text);
}

.project-expand-icon {
  display: grid;
  place-items: center;
  transition: transform 180ms ease;
}

.project-row-toggle[aria-expanded="true"] .project-expand-icon {
  transform: rotate(180deg);
}

.project-detail-content {
  display: grid;
  grid-template-columns: minmax(150px, 0.65fr) minmax(0, 1.35fr);
  gap: 1.25rem;
  padding: 1rem 0 1.25rem;
}

.project-detail-content > img {
  width: 100%;
  height: clamp(180px, 42vw, 220px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.project-detail-content > img.project-image-contain {
  object-fit: contain;
  padding: 1.75rem;
  background: var(--bg);
}

.project-detail-content > img.project-image-clock {
  object-fit: cover;
}

.project-detail-content > img.project-image-ai {
  object-fit: contain;
  padding: 0.45rem;
  background: var(--bg);
}

html[data-theme="dark"] .project-detail-content > img.project-image-clock {
  filter: invert(1);
}

.project-detail-label {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.project-detail-content h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
}

.project-detail-content p:not(.project-detail-label) {
  margin: 0.45rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.project-detail-content .project-action {
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
}

.project-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.project-type {
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
}

.project-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.5rem 0.72rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 750;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.project-action:hover {
  background: var(--accent-soft);
  border-color: var(--text);
  transform: translateY(-1px);
}

.project-action img {
  width: 14px;
  height: 14px;
  object-fit: contain;
  opacity: 0.72;
}

html[data-theme="dark"] .project-action img {
  filter: invert(1);
}

.project-action:hover .project-action-arrow {
  transform: translate(1px, -1px);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 2rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.back-to-top {
  position: fixed;
  right: max(1rem, calc((100vw - var(--content)) / 2));
  bottom: 1.25rem;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.55rem 0.8rem;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 12%, transparent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.back-to-top:hover {
  background: var(--accent-soft);
  border-color: var(--text);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

@keyframes accordion-open {
  from {
    max-height: 0;
    opacity: 0;
    transform: translateY(-0.35rem);
  }

  to {
    max-height: 2400px;
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes accordion-close {
  from {
    max-height: 2400px;
    opacity: 1;
    transform: translateY(0);
  }

  to {
    max-height: 0;
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}

@keyframes project-detail-open {
  from {
    max-height: 0;
    opacity: 0;
    transform: translateY(-0.25rem);
  }

  to {
    max-height: 1200px;
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes project-detail-close {
  from {
    max-height: 1200px;
    opacity: 1;
    transform: translateY(0);
  }

  to {
    max-height: 0;
    opacity: 0;
    transform: translateY(-0.2rem);
  }
}

@media (max-width: 900px) {
  .hero {
    display: block;
    padding: 4rem 0 3.5rem;
  }

  .hero-copy {
    display: block;
  }

  .hero-action-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 1.7rem;
  }

  h1 {
    font-size: clamp(3rem, 7vw, 4.8rem);
  }

  .hero-actions {
    flex: 0 1 auto;
    display: flex;
    width: auto;
    min-width: 0;
    align-items: flex-start;
    gap: 0.7rem;
    margin-top: 0;
    flex-wrap: wrap;
  }

  .hero-visual {
    flex: 0 0 155px;
    width: 155px;
    margin: 0;
  }

  .hero-visual img {
    width: 100%;
    border-radius: 18px;
  }

  .accordion summary {
    min-height: 68px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(calc(100% - 1.4rem), var(--content));
  }

  .topbar {
    padding: 1rem 0;
  }

  .top-actions {
    gap: 0.8rem;
  }

  .hero {
    padding: 3.75rem 0 3rem;
  }

  .accordion summary {
    min-height: 68px;
    padding: 0.9rem 1rem;
  }

  .summary-index {
    width: 1.55rem;
  }

  .summary-label {
    min-width: 0;
  }

  .accordion-content {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .career-entry,
  .project-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .career-credential {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .credential-code {
    grid-column: 2;
    margin-top: -0.35rem;
    white-space: normal;
  }

  .project-row {
    gap: 0.55rem;
    align-items: start;
  }

  .project-detail-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .project-detail-content > img {
    height: 200px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .project-action {
    width: fit-content;
  }

  .back-to-top {
    right: 1rem;
    bottom: 1rem;
  }

  .project-more {
    width: 38px;
  }
}

@media (max-width: 480px) {
  .hero {
    padding-top: 3.25rem;
  }

  .hero-action-row {
    gap: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .button,
  .expand-icon,
  .project-action,
  .external-link-icon,
  .project-action-arrow,
  .project-expand-icon,
  .hero-external-arrow,
  .back-to-top,
  .accordion summary,
  .accordion.is-opening > .accordion-content,
  .accordion.is-closing > .accordion-content,
  .project-detail.is-opening,
  .project-detail.is-closing {
    transition: none;
    animation: none;
  }
}
