:root {
  --bg: #faf9f6;
  --surface: #f2f1ed;
  --text: #141517;
  --text-secondary: #4e535c;
  --text-muted: #767c87;
  --border: #e3e2dd;
  --border-strong: #c9c8c2;
  --link-underline: #b5b4ae;
  --link-hover: #141517;
  --focus-ring: #141517;
  --tag-bg: transparent;
  --photo-filter: none;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --measure: 820px;
  --rail: 196px;
}

[data-theme="dark"] {
  --bg: #111214;
  --surface: #181a1e;
  --text: #eceef0;
  --text-secondary: #a4abb5;
  --text-muted: #747b87;
  --border: #25282f;
  --border-strong: #393e48;
  --link-underline: #464c58;
  --link-hover: #ffffff;
  --focus-ring: #eceef0;
  --tag-bg: rgba(255, 255, 255, 0.02);
  --photo-filter: brightness(0.92) contrast(1.03);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.96875rem;
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.25rem 1.75rem 4rem;
}

/* Toolbar */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.75rem;
}

.toolbar__group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.toolbar__sep {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  user-select: none;
}

.toolbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.tool-btn:hover {
  color: var(--text);
}

.tool-btn:focus-visible,
.link:focus-visible,
.copy-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.tool-btn--seg {
  padding: 0.25rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.tool-btn--seg[aria-pressed="true"] {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
}

.tool-btn--outline {
  border-color: var(--border);
  height: 32px;
}

.tool-btn--outline:hover {
  border-color: var(--border-strong);
  background-color: var(--surface);
}

.tool-btn--icon {
  border-color: var(--border);
  width: 32px;
  height: 32px;
  padding: 0;
}

.tool-btn--icon:hover {
  border-color: var(--border-strong);
  background-color: var(--surface);
}

.icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Theme icon visibility */
.icon--sun {
  display: none;
}

.icon--moon {
  display: block;
}

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

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

/* Hero */

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.75rem;
}

.hero__main {
  min-width: 0;
  flex: 1;
}

.hero__name {
  margin: 0;
  font-size: clamp(1.625rem, 3.2vw, 2.0625rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.18;
  color: var(--text);
}

.hero__role {
  margin: 0.45rem 0 0;
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hero__meta li {
  display: inline-flex;
  align-items: center;
}

.hero__meta li + li::before {
  content: "·";
  margin: 0 0.65rem;
  color: var(--border-strong);
}

.hero__email-item {
  gap: 0.35rem;
}

.link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.link:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

.copy-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.copy-btn:hover {
  color: var(--text);
  background-color: var(--surface);
}

.copy-btn .icon {
  width: 13px;
  height: 13px;
}

.copy-btn .icon--check {
  display: none;
}

.copy-btn.is-copied {
  color: var(--text);
}

.copy-btn.is-copied .icon--copy {
  display: none;
}

.copy-btn.is-copied .icon--check {
  display: block;
}

.copy-btn__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hero__portrait {
  margin: 0;
  flex-shrink: 0;
}

.hero__portrait img {
  display: block;
  width: 100px;
  height: 101px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  filter: var(--photo-filter);
  transition: filter 0.2s ease, border-color 0.2s ease;
}

.hero__portrait img:hover {
  filter: none;
}

/* Summary */

.summary {
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
}

.summary__text {
  margin: 0;
  max-width: 66ch;
  font-size: 1rem;
  line-height: 1.68;
  color: var(--text);
}

/* Editorial Two-Column Sections */

.section {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 1.25rem 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.section__title {
  margin: 0;
  padding-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Experience Timeline */

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.timeline__item {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
}

.timeline__year {
  font-family: var(--font-mono);
  font-size: 0.84375rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.timeline__body {
  line-height: 1.52;
}

.timeline__company {
  font-weight: 500;
  color: var(--text);
}

.timeline__dash {
  margin: 0 0.35rem;
  color: var(--text-muted);
}

.timeline__role {
  color: var(--text-secondary);
}

/* Selected Projects */

.projects {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.projects__item {
  break-inside: avoid;
}

.projects__title {
  margin: 0;
  font-size: 0.96875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.projects__desc {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Skills */

.skills {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.skills__group {
  break-inside: avoid;
}

.skills__label {
  margin: 0 0 0.65rem;
  font-size: 0.90625rem;
  font-weight: 500;
  color: var(--text);
}

.skills__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-tag {
  padding: 0.28rem 0.62rem;
  font-size: 0.84375rem;
  line-height: 1.35;
  color: var(--text-secondary);
  background-color: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer__domain {
  font-family: var(--font-mono);
  font-size: 0.78125rem;
}

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

/* Responsive */

@media (max-width: 720px) {
  .page {
    padding: 1.5rem 1.25rem 3rem;
  }

  .toolbar {
    margin-bottom: 2rem;
  }

  .hero {
    gap: 1.25rem;
  }

  .hero__portrait img {
    width: 80px;
    height: 81px;
  }

  .section {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    padding: 1.6rem 0;
  }

  .section__title {
    padding-top: 0;
  }
}

@media (max-width: 480px) {
  .hero {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 1rem;
  }

  .hero__portrait img {
    width: 76px;
    height: 77px;
  }

  .timeline__item {
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* Print / Save as PDF */

@page {
  size: A4 portrait;
  margin: 13mm 15mm;
}

@media print {
  :root,
  [data-theme="dark"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #111111;
    --text-secondary: #333333;
    --text-muted: #555555;
    --border: #dcdcdc;
    --border-strong: #aaaaaa;
    --link-underline: transparent;
    --tag-bg: transparent;
    --photo-filter: none;
  }

  html {
    font-size: 13.5px;
  }

  body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .page {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .toolbar,
  .copy-btn,
  .footer {
    display: none !important;
  }

  .hero {
    padding-bottom: 1.1rem;
    gap: 1.25rem;
  }

  .hero__portrait img {
    width: 78px;
    height: 79px;
    filter: none !important;
    border-color: #cccccc;
  }

  .hero__name {
    font-size: 1.65rem;
  }

  .hero__role {
    margin-top: 0.25rem;
    font-size: 0.98rem;
  }

  .hero__meta {
    margin-top: 0.65rem;
    font-size: 0.85rem;
  }

  .link {
    text-decoration: none;
  }

  .summary {
    padding: 0.95rem 0 1.1rem;
  }

  .summary__text {
    max-width: none;
    font-size: 0.94rem;
    line-height: 1.5;
  }

  .section {
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 0.75rem 1.25rem;
    padding: 1.05rem 0;
  }

  .timeline {
    gap: 0.45rem;
  }

  .timeline__item {
    grid-template-columns: 2.9rem minmax(0, 1fr);
    gap: 0.65rem;
    break-inside: avoid;
  }

  .projects {
    gap: 0.72rem;
  }

  .projects__desc {
    margin-top: 0.12rem;
    line-height: 1.45;
  }

  .skills {
    gap: 0.8rem;
  }

  .skills__label {
    margin-bottom: 0.35rem;
  }

  .skills__list {
    gap: 0.32rem;
  }

  .skill-tag {
    padding: 0.16rem 0.48rem;
    font-size: 0.82rem;
    border-color: #d0d0d0;
  }
}
