:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --surface: #f2f2f2;
  --control-bg: #f2f2f2;
  --text: #333333;
  --muted: #3f3f3f;
  --card-bg: #fdfdfd;
  --card-hover: #f2f2f2;
  --border: rgba(25, 25, 25, 0.13);
  --focus: #4d72e8;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #131315;
  --surface: #202024;
  --control-bg: #29292f;
  --text: #f1f1f3;
  --muted: #c6c6cb;
  --card-bg: #19191d;
  --card-hover: #29292f;
  --border: rgba(255, 255, 255, 0.16);
  --focus: #a5b6ff;
}

* { box-sizing: border-box; }

html {
  background: var(--page-bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page-bg);
  color: var(--text);
  font-family: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  transition: background-color 180ms ease, color 180ms ease;
}

a { color: inherit; }
button { font: inherit; }

.skip-link {
  position: absolute;
  z-index: 10;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--text);
  color: var(--page-bg);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(690px, calc(100% - 48px));
  margin-inline: auto;
  padding-block: 56px;
}

.header-top,
.display-controls,
.contact-links,
.primary-nav,
.site-footer {
  display: flex;
  align-items: center;
}

.header-top { justify-content: space-between; min-height: 40px; }
.display-controls { gap: 12px; }

.avatar-mark {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  text-decoration: none;
}

.avatar-mark img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-tab,
.cv-link {
  min-height: 37px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}

.theme-toggle {
  display: block;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.theme-toggle img {
  display: block;
  width: 32px;
  height: 32px;
}

.theme-toggle:hover,
.cv-link:hover { filter: brightness(0.96); }

.profile-intro { margin-block-start: 17px; }

.profile-intro h1 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  line-height: 27px;
}

.bio {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 25px;
  text-wrap: pretty;
}

.bio a,
.contact-links a {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.contact-block { margin-block-start: 72px; }

.contact-prompt {
  margin: 0;
  color: var(--muted);
  line-height: 25px;
  text-wrap: pretty;
}

.contact-links { flex-wrap: wrap; gap: 0 20px; }

.contact-links a {
  display: inline-flex;
  height: 21px;
  align-items: center;
  color: var(--text);
  line-height: 25px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.cv-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 151px;
  height: 32px;
  min-height: 32px;
  padding: 6px 12px;
  background: var(--control-bg);
  font-size: 15px;
  line-height: 20px;
}

.cv-link img {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.cv-link span { white-space: nowrap; }

.primary-nav {
  flex-wrap: wrap;
  gap: 0 21px;
  margin-block-start: 72px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  cursor: pointer;
  line-height: 25px;
  transition: color 140ms ease, background-color 140ms ease;
}

.nav-tab.is-current { background: var(--control-bg); }
.nav-tab:hover { color: #111111; }
:root[data-theme="dark"] .nav-tab:hover { color: #ffffff; }

.work-section {
  max-width: 1536px;
  margin-inline: auto;
  padding: 24px 70px;
  outline: none;
}

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

.project-card {
  overflow: hidden;
  aspect-ratio: 2760 / 1921;
  margin: 0;
  border-radius: 28px;
  background: var(--surface);
}

.project-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-footer {
  max-width: 1536px;
  min-height: 153px;
  gap: 48px;
  margin-inline: auto;
  padding: 64px 70px;
  color: var(--muted);
}

.copyright {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

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

.case-studies-section {
  width: min(1032px, 100%);
  margin-inline: auto;
  padding: 24px 32px 40px;
}

.case-studies-list {
  display: grid;
  width: min(878px, 100%);
  gap: 12px;
  margin-inline: auto;
}

.case-study-card {
  display: flex;
  min-width: 0;
  min-height: 97px;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 16px;
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
  transition: background-color 140ms ease;
}

.case-study-card:hover,
.case-study-card:focus-visible { background: var(--card-hover); }

.case-study-card > img {
  display: block;
  width: 115px;
  height: 79px;
  flex: 0 0 115px;
  border-radius: 8px;
  object-fit: cover;
}

.case-study-card-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.case-study-card-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  line-height: 27.2px;
  overflow-wrap: anywhere;
}

.case-study-card-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  line-height: 25px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.experience-section {
  width: min(690px, 100%);
  margin-inline: auto;
  padding: 0 24px 48px;
}

.experience-list {
  display: grid;
  gap: 34px;
}

.experience-entry { min-width: 0; }

.experience-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding-block-end: 11px;
}

.experience-title-line {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.experience-title-line h3 {
  flex: 0 0 auto;
  margin: 0;
  color: var(--text);
  font-size: 21px;
  font-weight: 600;
  line-height: 27.2px;
}

.experience-company,
.experience-dates {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 25px;
}

.experience-dates {
  flex: 0 0 auto;
  color: var(--text);
  white-space: nowrap;
}

.experience-bullets {
  margin: 0;
  padding-inline-start: 22.5px;
  color: var(--muted);
  font-size: 15px;
  line-height: 25px;
}

.experience-bullets li { padding-inline-start: 0; }

.case-detail-section {
  width: 100%;
  padding: 56px 24px 0;
  background: #fdfdfd;
}

:root[data-theme="dark"] .case-detail-section { background: var(--page-bg); }

.case-detail {
  display: flex;
  width: min(1536px, 100%);
  flex-direction: column;
  gap: 52px;
  margin-inline: auto;
  background: var(--page-bg);
}

.case-detail-toolbar {
  display: flex;
  width: min(740px, 100%);
  align-items: center;
  justify-content: space-between;
  gap: 17px;
  margin-inline: auto;
}

.case-back-link {
  display: inline-flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  line-height: 27.2px;
  text-decoration: none;
  white-space: nowrap;
}

.case-back-icon {
  display: inline-grid;
  width: 44px;
  height: 32px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 999px;
  background: var(--control-bg);
}

.case-back-icon img { display: block; width: 20px; height: 20px; }
.case-back-link:hover > span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.detail-theme-toggle { flex: 0 0 32px; }

.case-detail-title {
  width: min(740px, 100%);
  margin: 0 auto 52px;
  color: var(--text);
  font-size: clamp(24px, 2.3vw, 29px);
  font-weight: 600;
  line-height: 37px;
  overflow-wrap: anywhere;
}

.case-article-body {
  color: var(--muted);
  font-size: 15px;
  line-height: 25px;
}

.case-article-body > p,
.case-article-body > ul,
.case-article-body > h2,
.case-article-body > h3,
.case-article-body > h4 {
  width: min(701px, 100%);
  margin-inline: auto;
}

.case-article-body > p { margin-block: 0 16px; }
.case-article-body > ul { margin-block: 0 18px; padding-inline-start: 23px; }
.case-article-body > li { text-wrap: pretty; }

.case-article-body > h2,
.case-article-body > h3,
.case-article-body > h4 {
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.case-article-body > h2 { margin-block: 56px 19px; font-size: 21px; font-weight: 600; line-height: 27.2px; }
.case-article-body > h3 { margin-block: 24px 10px; font-size: 17px; }
.case-article-body > h4 { margin-block: 22px 8px; font-size: 16px; }

.case-article-figure {
  width: 100%;
  margin: 28px auto 34px;
}

.case-article-figure.is-narrow { width: min(700px, 100%); }

.case-article-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.case-article-figure figcaption {
  margin-block-start: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 25px;
  text-align: center;
}

.case-detail-empty {
  width: min(740px, 100%);
  margin: 20px auto;
  color: var(--muted);
}

.case-project-link {
  display: inline-flex;
  margin: 12px 0 0 max(0px, calc((100% - 740px) / 2));
  color: var(--text);
  text-underline-offset: 3px;
}

.empty-page-message {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 920px) {
  .work-section { padding-inline: 24px; }
  .site-footer { padding-inline: 24px; }
  .case-studies-section { padding-inline: 24px; }
}

@media (max-width: 700px) {
  .site-header {
    width: calc(100% - 40px);
    padding-block: 32px 36px;
  }

  .profile-intro { margin-block-start: 16px; }
  .contact-block { margin-block-start: 40px; }
  .primary-nav { gap: 8px; margin-block-start: 40px; }
  .work-section { padding: 20px; }
  .project-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .project-card { border-radius: 24px; }
  .case-studies-section { padding: 12px 20px 36px; }
  .case-study-card { align-items: flex-start; }
  .case-study-card-title { font-size: 16px; line-height: 23px; }
  .case-study-card-summary { font-size: 14px; line-height: 21px; }
  .experience-section { padding-inline: 20px; }
  .experience-list { gap: 30px; }
  .experience-heading { align-items: flex-start; flex-direction: column; gap: 2px; padding-block-end: 8px; }
  .experience-title-line { flex-wrap: wrap; gap: 3px 10px; }
  .experience-title-line h3 { font-size: 19px; }
  .case-detail-section { padding: 40px 20px 0; }
  .case-detail-title { margin-block-end: 24px; }
  .case-detail { gap: 36px; }
  .case-article-figure { margin-block: 22px 27px; }

  .site-footer {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 40px 20px;
  }
}

@media (max-width: 420px) {
  body { font-size: 14px; }
  .site-header { width: calc(100% - 32px); }
  .display-controls { gap: 6px; }
  .primary-nav { column-gap: 4px; }
  .nav-tab { padding-inline: 9px; font-size: 13px; }
  .work-section { padding-inline: 16px; }
  .site-footer { padding-inline: 16px; }
  .case-studies-section { padding-inline: 16px; }
  .case-study-card { gap: 10px; padding: 7px; border-radius: 13px; }
  .case-study-card > img { width: 84px; height: 63px; flex-basis: 84px; }
  .case-study-card-title { font-size: 15px; line-height: 21px; }
  .case-study-card-summary { font-size: 13px; line-height: 19px; }
  .experience-section { padding-inline: 16px; }
  .experience-title-line h3 { font-size: 18px; }
  .experience-company,.experience-dates,.experience-bullets { font-size: 14px; }
  .experience-bullets { padding-inline-start: 20px; line-height: 23px; }
  .case-detail-section { padding-inline: 16px; }
  .case-back-link { font-size: 16px; }
  .case-detail-title { font-size: 23px; line-height: 31px; }
  .case-article-body { font-size: 14px; line-height: 23px; }
  .case-article-body > h2 { font-size: 20px; }
  .contact-links { gap: 8px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
