:root {
  --portfolio-ink: #111827;
  --portfolio-muted: #667085;
  --portfolio-line: #dfe3ea;
  --portfolio-soft: #f5f7fa;
  --portfolio-accent: #5b50e6;
  --portfolio-accent-dark: #4238bc;
  --portfolio-green: #22a06b;
}

body:has(.portfolio-page) .post-header,
body:has(.portfolio-page) .breadcrumbs,
body:has(.portfolio-page) #theme-toggle {
  display: none;
}

body.list:has(.portfolio-page) .main {
  max-width: 1180px;
  padding-top: 0;
}

body:has(.portfolio-page) .post-content {
  max-width: none;
  margin: 0;
  padding: 0 24px 72px;
}

.portfolio-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: clamp(36px, 6vw, 88px);
  align-items: center;
  min-height: 560px;
  margin: 28px 0 56px;
  padding: clamp(48px, 7vw, 84px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--portfolio-accent) 14%, var(--portfolio-line));
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 10%, color-mix(in srgb, var(--portfolio-accent) 16%, transparent) 0, transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--portfolio-accent) 6%, var(--theme)) 0%, var(--theme) 58%);
}

.portfolio-hero::after {
  position: absolute;
  right: -90px;
  bottom: -150px;
  width: 320px;
  height: 320px;
  border: 1px solid color-mix(in srgb, var(--portfolio-accent) 18%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.portfolio-hero__copy,
.portfolio-hero__profile {
  position: relative;
  z-index: 1;
}

.eyebrow,
.story-type {
  margin: 0 0 18px;
  color: var(--portfolio-accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-transform: uppercase;
}

.portfolio-hero h1,
.focus-section h2,
.section-heading h2,
.contact-strip h2 {
  color: var(--portfolio-ink);
  font-weight: 750;
  letter-spacing: -0.065em;
}

.portfolio-hero h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(3.6rem, 7.5vw, 6.8rem);
  line-height: 0.88;
}

.portfolio-hero h1 span {
  color: var(--portfolio-accent);
}

.portfolio-hero__lead {
  max-width: 650px;
  margin: 30px 0 28px;
  color: var(--portfolio-muted);
  font-size: clamp(1.05rem, 1.8vw, 1.24rem);
  line-height: 1.62;
}

.portfolio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.portfolio-page .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 50px;
  margin: 0;
  padding: 0 20px;
  border: 1px solid var(--portfolio-line);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

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

.portfolio-page .button--primary {
  border-color: var(--portfolio-accent);
  background: var(--portfolio-accent);
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--portfolio-accent) 24%, transparent);
}

.portfolio-page .button--primary:hover {
  border-color: var(--portfolio-accent-dark);
  background: var(--portfolio-accent-dark);
  color: #fff;
}

.portfolio-page .button--quiet {
  background: color-mix(in srgb, var(--theme) 84%, transparent);
  color: var(--portfolio-ink);
}

.portfolio-page .button--quiet:hover {
  border-color: var(--portfolio-ink);
  color: var(--portfolio-ink);
}

.button__arrow {
  transition: transform 160ms ease;
}

.button:hover .button__arrow {
  transform: translate(2px, -2px);
}

.button:focus-visible,
.text-link:focus-visible,
.feature-story:focus-visible,
.project-story:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--portfolio-accent) 44%, transparent);
  outline-offset: 4px;
}

.portfolio-page .portfolio-signals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  max-width: 680px;
  margin: 38px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--portfolio-line);
}

.portfolio-page .portfolio-signals div {
  min-width: 0;
}

.portfolio-page .portfolio-signals dt {
  width: auto;
  margin: 0 0 5px;
  color: var(--portfolio-ink);
  font-size: 0.88rem;
  font-weight: 760;
}

.portfolio-page .portfolio-signals dd {
  width: auto;
  margin: 0;
  color: var(--portfolio-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.portfolio-hero__profile {
  position: relative;
}

.portfolio-photo {
  display: block;
  width: min(100%, 320px);
  aspect-ratio: 0.86;
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--portfolio-accent) 12%, var(--portfolio-line));
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 16px 16px 0 color-mix(in srgb, var(--portfolio-accent) 12%, var(--theme));
}

.profile-note {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 28px auto 0;
  color: var(--portfolio-muted);
  font-size: 0.88rem;
}

.profile-note__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--portfolio-green);
  box-shadow: 0 0 0 4px #d8f3e7;
}

.focus-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 8vw, 120px);
  padding: clamp(56px, 8vw, 100px) 0;
  border-top: 1px solid var(--portfolio-line);
}

.focus-section h2,
.section-heading h2,
.contact-strip h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.02;
}

.focus-section__body {
  align-self: end;
  margin: 0;
  color: var(--portfolio-muted);
  font-size: 1.08rem;
  line-height: 1.72;
}

.capabilities-section,
.experience-section,
.writing-section {
  padding: clamp(62px, 9vw, 112px) 0;
  border-top: 1px solid var(--portfolio-line);
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.capability-card {
  min-height: 320px;
  padding: 28px;
  border: 1px solid var(--portfolio-line);
  border-radius: 14px;
  background: var(--portfolio-soft);
}

.capability-card:nth-child(2) { background: #eeedff; }
.capability-card:nth-child(3) { background: #edf8f3; }

.capability-card__number {
  color: var(--portfolio-accent);
  font-size: 0.8rem;
  font-weight: 750;
}

.capability-card h2 {
  margin: 82px 0 14px;
  color: var(--portfolio-ink);
  font-size: 1.45rem;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.capability-card p,
.experience-row p,
.feature-story p,
.project-story p {
  color: var(--portfolio-muted);
  line-height: 1.62;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 42px;
}

.text-link {
  flex-shrink: 0;
  color: var(--portfolio-accent);
  font-weight: 750;
  text-decoration: none;
}

.text-link:hover { color: var(--portfolio-accent-dark); }

.experience-list { border-top: 1px solid var(--portfolio-line); }

.experience-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 160px;
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--portfolio-line);
}

.experience-row__years,
.experience-row__area {
  margin: 0;
  color: var(--portfolio-muted);
  font-size: 0.9rem;
}

.experience-row h3 {
  margin: 0 0 8px;
  color: var(--portfolio-ink);
  font-size: 1.25rem;
}

.experience-row div p { margin: 0; }
.experience-row__area { text-align: right; }

.writing-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
}

.feature-story,
.project-story {
  display: flex;
  min-height: 350px;
  flex-direction: column;
  padding: 32px;
  border-radius: 16px;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.feature-story:hover,
.project-story:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.12);
}

.feature-story { background: var(--portfolio-ink); }
.project-story { background: #eeedff; }
.feature-story .story-type,
.feature-story h3,
.feature-story > span { color: #fff; }
.feature-story p:not(.story-type) { color: #cbd2df; }
.project-story .story-type,
.project-story > span { color: var(--portfolio-accent-dark); }

.feature-story h3,
.project-story h3 {
  margin: 12px 0 14px;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.project-story h3 { color: var(--portfolio-ink); }
.feature-story > span,
.project-story > span { margin-top: auto; font-weight: 750; }

.contact-strip {
  margin-top: 72px;
  padding: clamp(48px, 8vw, 90px);
  border-radius: 20px;
  background: var(--portfolio-soft);
  text-align: center;
}

.contact-strip h2 {
  max-width: 660px;
  margin: 0 auto 30px;
}

.contact-strip .portfolio-actions { justify-content: center; }

@media (max-width: 760px) {
  body.list:has(.portfolio-page) .main {
    padding-right: 0;
    padding-left: 0;
  }
  body:has(.portfolio-page) .post-content { padding: 0 18px 48px; }
  .portfolio-hero,
  .focus-section,
  .writing-grid { grid-template-columns: 1fr; }
  .portfolio-hero {
    min-height: auto;
    margin: 16px 0 38px;
    padding: 38px 24px 42px;
    border-radius: 22px;
  }
  .portfolio-hero h1 {
    font-size: clamp(3rem, 14vw, 4.5rem);
  }
  .portfolio-hero h1 span {
    white-space: nowrap;
  }
  .portfolio-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .portfolio-actions .button {
    width: 100%;
  }
  .portfolio-page .portfolio-signals {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .portfolio-page .portfolio-signals div {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 12px;
  }
  .portfolio-hero__profile {
    width: 100%;
    max-width: 310px;
    margin: 8px auto 0;
  }
  .capabilities-grid { grid-template-columns: 1fr; }
  .capability-card { min-height: auto; }
  .capability-card h2 { margin-top: 46px; }
  .experience-row { grid-template-columns: 82px minmax(0, 1fr); gap: 14px; }
  .experience-row__area { display: none; }
  .section-heading { align-items: start; flex-direction: column; margin-bottom: 30px; }
  .feature-story,
  .project-story { min-height: 290px; }
  .contact-strip { margin-top: 42px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --portfolio-ink: #f3f5f9;
    --portfolio-muted: #a7afbf;
    --portfolio-line: #303744;
    --portfolio-soft: #1a202b;
    --portfolio-accent: #a49cff;
    --portfolio-accent-dark: #c4bfff;
  }
  .capability-card { background: #1a202b; }
  .capability-card:nth-child(2),
  .project-story { background: #252345; }
  .capability-card:nth-child(3) { background: #18352b; }
  .feature-story { background: #090d14; }
  .portfolio-photo { box-shadow: 15px 15px 0 #29264d; }
  .profile-note__dot { box-shadow: 0 0 0 4px #17462f; }
}

.dark {
  --portfolio-ink: #f3f5f9;
  --portfolio-muted: #a7afbf;
  --portfolio-line: #303744;
  --portfolio-soft: #1a202b;
  --portfolio-accent: #a49cff;
  --portfolio-accent-dark: #c4bfff;
}

.dark .capability-card { background: #1a202b; }
.dark .capability-card:nth-child(2),
.dark .project-story { background: #252345; }
.dark .capability-card:nth-child(3) { background: #18352b; }
.dark .feature-story { background: #090d14; }
.dark .portfolio-photo { box-shadow: 15px 15px 0 #29264d; }
.dark .profile-note__dot { box-shadow: 0 0 0 4px #17462f; }

/* Shared page shell */
body {
  background: var(--theme);
}

.header {
  border-bottom: 1px solid var(--portfolio-line);
  background: color-mix(in srgb, var(--theme) 92%, transparent);
  backdrop-filter: blur(12px);
}

.nav {
  max-width: 1120px;
  padding: 0 24px;
}

.logo a {
  color: var(--portfolio-ink);
  font-size: 0.96rem;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.logo img {
  display: none;
}

#menu a {
  color: var(--portfolio-muted);
  font-size: 0.9rem;
  font-weight: 650;
}

#menu a:hover,
#menu .active {
  color: var(--portfolio-accent);
}

body.list .main {
  max-width: 1120px;
  padding: clamp(46px, 7vw, 82px) 24px 72px;
}

body.list .page-header {
  max-width: 760px;
  margin: 0 0 42px;
}

.page-header h1,
.post-title {
  color: var(--portfolio-ink);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.35rem);
}

.post-description,
.breadcrumbs,
.post-meta,
.entry-footer {
  color: var(--portfolio-muted);
}

.post-entry,
.first-entry {
  position: relative;
  margin: 0 0 14px;
  padding: 28px 30px;
  border: 1px solid var(--portfolio-line);
  border-radius: 14px;
  background: var(--theme);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.post-entry:hover,
.first-entry:hover {
  border-color: var(--portfolio-accent);
  box-shadow: 0 16px 34px rgba(16, 24, 40, 0.09);
  transform: translateY(-2px);
}

.entry-header h2,
.first-entry .entry-header h2 {
  color: var(--portfolio-ink);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 740;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.entry-content {
  color: var(--portfolio-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.entry-footer {
  margin-top: 17px;
  font-size: 0.84rem;
}

.post-single {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 94px) 0 72px;
}

.post-header {
  margin: 0 0 42px;
}

.post-title {
  margin: 18px 0;
  font-size: clamp(2.45rem, 5vw, 4.15rem);
}

.post-meta {
  font-size: 0.9rem;
}

.post-content {
  color: var(--portfolio-ink);
  font-size: 1.06rem;
  line-height: 1.78;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--portfolio-ink);
  font-weight: 740;
  letter-spacing: -0.04em;
  line-height: 1.14;
}

.post-content h2 {
  margin-top: 3.1rem;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
}

.post-content h3 {
  margin-top: 2.2rem;
  font-size: 1.3rem;
}

.post-content a {
  color: var(--portfolio-accent);
  text-decoration-color: color-mix(in srgb, var(--portfolio-accent) 42%, transparent);
  text-underline-offset: 3px;
}

.post-content blockquote {
  margin: 1.8rem 0;
  padding: 2px 0 2px 22px;
  border-left: 3px solid var(--portfolio-accent);
  color: var(--portfolio-muted);
}

.post-content code {
  border-radius: 5px;
  color: var(--portfolio-accent-dark);
}

.post-content pre {
  border: 1px solid var(--portfolio-line);
  border-radius: 12px;
}

.post-content hr {
  border-color: var(--portfolio-line);
}

.post-tags li a,
.pagination a {
  border-radius: 999px;
  background: var(--portfolio-soft);
  color: var(--portfolio-ink);
}

/* About and contact */
body:has(.about-content) .post-single {
  max-width: 960px;
}

.about-content {
  color: var(--portfolio-muted);
}

.about-content .about-hero {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(24px, 5vw, 58px);
  align-items: center;
  margin: 0 0 58px;
  padding: 0 0 48px;
  border-bottom: 1px solid var(--portfolio-line);
}

.about-content .about-photo {
  width: 180px;
  height: 210px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 12px 12px 0 #e8e7ff;
}

.about-content .about-hero-text h1 {
  margin: 0 0 15px;
  color: var(--portfolio-ink);
  font-size: clamp(2.25rem, 5vw, 3.85rem);
  letter-spacing: -0.06em;
  line-height: 0.96;
}

.about-content h2 {
  margin-top: 3rem;
}

.about-content .contact-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 42px;
}

.about-content .contact-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--portfolio-line);
  border-radius: 9px;
  color: var(--portfolio-ink);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.about-content .contact-button:hover {
  border-color: var(--portfolio-accent);
  color: var(--portfolio-accent);
  transform: translateY(-2px);
}

/* CV */
body:has(.post-content > h1:first-child) .post-single {
  max-width: 860px;
}

.post-content > h1:first-child {
  margin: 0 0 10px;
  font-size: clamp(2.45rem, 5vw, 4.2rem);
}

.post-content > h1:first-child + p {
  margin-top: 0;
  color: var(--portfolio-accent);
  font-size: 1.08rem;
  font-weight: 700;
}

.footer {
  max-width: 1120px;
  padding: 30px 24px;
  border-top: 1px solid var(--portfolio-line);
  color: var(--portfolio-muted);
}

.footer a {
  color: var(--portfolio-ink);
}

@media (max-width: 760px) {
  .nav,
  body.list .main {
    padding-left: 18px;
    padding-right: 18px;
  }

  #menu {
    flex: 0 0 100%;
    width: 100%;
    margin: 0;
    justify-content: space-between;
    overflow-x: visible;
    line-height: 44px;
  }

  #menu li + li {
    margin-inline-start: 0;
  }

  #menu a {
    font-size: 0.82rem;
  }

  .post-single {
    padding: 50px 18px;
  }

  .post-entry,
  .first-entry {
    padding: 23px 21px;
  }

  .about-content .about-hero {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 36px;
  }

  .about-content .about-photo {
    width: 104px;
    height: 124px;
    box-shadow: 8px 8px 0 #e8e7ff;
  }
}

@media (prefers-color-scheme: dark) {
  .header { background: color-mix(in srgb, var(--theme) 92%, transparent); }
  .post-entry,
  .first-entry { background: var(--theme); }
  .about-content .about-photo { box-shadow: 10px 10px 0 #29264d; }
}
