:root {
  color-scheme: light;
  --bg: #f3efe6;
  --bg-deep: #e7dcc7;
  --ink: #17151b;
  --muted: #5f5650;
  --accent: #7653a6;
  --accent-soft: rgba(118, 83, 166, 0.14);
  --card: rgba(255, 249, 239, 0.72);
  --line: rgba(31, 26, 23, 0.12);
  --shadow: 0 24px 70px rgba(75, 48, 29, 0.12);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #17151b;
  --bg-deep: #25202d;
  --ink: #f2eee7;
  --muted: #b9b1c1;
  --accent: #f9a825;
  --accent-soft: rgba(249, 168, 37, 0.14);
  --card: rgba(38, 32, 47, 0.82);
  --line: rgba(242, 238, 231, 0.16);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(249, 168, 37, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(74, 88, 69, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, #f8f4ec 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

:root[data-theme='dark'] body {
  background:
    radial-gradient(circle at top left, rgba(109, 79, 135, 0.3), transparent 34%),
    radial-gradient(circle at top right, rgba(74, 88, 69, 0.16), transparent 28%),
    linear-gradient(180deg, #17151b 0%, #211c28 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(31, 26, 23, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 26, 23, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 70%);
  pointer-events: none;
}

.noise,
.orb {
  position: fixed;
  pointer-events: none;
}

.noise {
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

:root[data-theme='dark'] .noise {
  mix-blend-mode: screen;
  opacity: 0.035;
}

.orb {
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.55;
}

.orb-left {
  top: -8rem;
  left: -10rem;
  background: radial-gradient(circle, rgba(249, 168, 37, 0.26), transparent 62%);
}

:root[data-theme='dark'] .orb-left {
  background: radial-gradient(circle, rgba(109, 79, 135, 0.3), transparent 62%);
}

.orb-right {
  right: -12rem;
  top: 18rem;
  background: radial-gradient(circle, rgba(74, 88, 69, 0.18), transparent 62%);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  background: linear-gradient(180deg, rgba(243, 239, 230, 0.82), rgba(243, 239, 230, 0.72));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(31, 26, 23, 0.04);
}

:root[data-theme='dark'] .site-header {
  background: linear-gradient(180deg, rgba(23, 21, 27, 0.9), rgba(23, 21, 27, 0.72));
  border-bottom-color: rgba(242, 238, 231, 0.08);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
}

.topbar-inner {
  background: transparent;
  border-bottom: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: var(--ink);
  overflow: hidden;
}

.brand-mark-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-text,
.nav a,
.eyebrow,
.stat-label,
.project-kicker,
.footer {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-text {
  font-weight: 700;
  font-size: 0.92rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-left: auto;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 700;
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a.is-active {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font: inherit;
}

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

.theme-toggle-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-sun,
:root[data-theme='dark'] .theme-toggle-moon {
  display: none;
}

:root[data-theme='dark'] .theme-toggle-sun {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  grid-template-areas:
    'copy card'
    'lede lede'
    'actions actions';
  gap: 28px;
  align-items: end;
  padding: 72px 0 40px;
}

.hero-copy {
  grid-area: copy;
}

.hero-card {
  grid-area: card;
}

.hero .hero-lede {
  grid-area: lede;
  margin-top: 0;
}

.hero .hero-actions {
  grid-area: actions;
  margin-top: 0;
}

.experience-intro {
  padding-top: 42px;
}

.compact-heading {
  margin-bottom: 16px;
}

.experience-intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.6fr);
  gap: 24px;
  align-items: start;
}

.experience-intro-copy,
.experience-intro-meta {
  padding: 24px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid rgba(31, 26, 23, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.experience-kicker {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
}

.experience-intro-copy p:last-child {
  margin: 0;
}

.experience-intro-meta {
  display: grid;
  gap: 8px;
}

.experience-actions {
  margin-top: 20px;
}

.hero-copy {
  padding-right: 10px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

/* Single-line accent labels read as // code comments, echoing the MT logo. */
.eyebrow::before,
.project-kicker::before,
.footer p::before,
.photo figcaption::before,
.photo-card figcaption::before {
  content: '// ';
  font-family: Consolas, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
  font-weight: 700;
  opacity: 0.6;
  white-space: pre;
}

/* Separators in the skills lists. */
.list-sep {
  margin: 0 0.5em;
  color: var(--accent);
  font-family: Consolas, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
  font-weight: 700;
}

/* Role descriptions read as block comments, like the logo. */
.cv-entry > p::before,
.cv-entry > p::after {
  white-space: pre;
  color: var(--accent);
  font-family: Consolas, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
  font-weight: 700;
  opacity: 0.6;
}

.cv-entry > p::before {
  content: '/* ';
}

.cv-entry > p::after {
  content: ' */';
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 0.95;
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
}

h1 {
  font-size: clamp(3rem, 8vw, 5.8rem);
  max-width: 10ch;
  letter-spacing: -0.04em;
}

.home-hero-title {
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  max-width: 11ch;
}

.lede,
.about-grid p,
.project-card p,
.contact-block p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.03rem;
}

.lede {
  max-width: 58ch;
  margin: 28px 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.button-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-right: 9px;
}

:root[data-theme='dark'] .button-icon {
  filter: invert(1);
}

/* The IMDb wordmark is wide and short, so it gets extra width to match the other icons visually. */
.button-icon[src$='Imdb-Logo.svg'] {
  width: 35px;
  height: 14px;
}

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

.button-primary {
  background: var(--ink);
  color: #f9f4eb;
}

.button-secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.35);
}

.hero-card,
.project-card,
.contact-block {
  background: var(--card);
  border: 1px solid rgba(31, 26, 23, 0.08);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  padding: 28px;
  display: grid;
  gap: 16px;
}

.stat {
  padding: 18px 0;
  border-bottom: 1px solid rgba(31, 26, 23, 0.08);
}

.stat:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.stat-value {
  font-size: 1.22rem;
  font-weight: 600;
}

.section {
  padding: 42px 0 0;
}

.section-heading {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

h2 {
  font-size: clamp(1.9rem, 4vw, 3.25rem);
  max-width: 12ch;
  letter-spacing: -0.03em;
}

.about-grid,
.project-grid {
  display: grid;
  gap: 18px;
}

.about-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cv-stack {
  display: grid;
  gap: 16px;
}

.cv-entry {
  padding: 24px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid rgba(31, 26, 23, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.cv-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 12px;
}

.cv-role {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.cv-role-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 10px 0;
  border-top: 1px solid rgba(31, 26, 23, 0.08);
}

.cv-role-row .cv-role,
.cv-role-row .cv-meta {
  margin: 0;
}

.cv-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: right;
}

.cv-date,
.education-date {
  color: var(--accent);
  font-weight: 700;
}

.education-grade {
  color: var(--muted);
  font-weight: 400;
}

.contact-block .eyebrow {
  color: var(--accent);
}

.cv-entry p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.nowrap {
  white-space: nowrap;
}

.skills-extension {
  margin-top: 56px;
}

.skills-extension .section-heading h3 {
  margin-bottom: 0;
}

.project-card,
.contact-block {
  padding: 26px;
}

.project-card {
  min-height: 220px;
}

.project-kicker {
  display: inline-block;
  margin-bottom: 30px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Keep degree abbreviations like M.Sc. in their usual casing. */
.degree-kicker {
  text-transform: none;
}

h3 {
  font-size: 1.6rem;
  margin-bottom: 14px;
}

.contact-block {
  width: min(760px, calc(100% - 32px));
  margin: 44px auto 76px;
}

.contact-block.has-photo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: start;
}

.toolbox {
  gap: 28px 18px;
}

.toolbox p {
  margin: 0;
}

/* Sits in the right column next to Interests, Languages, and Awards. */
.toolbox-photo {
  grid-column: 2;
  grid-row: span 3;
}

.toolbox-photo img {
  object-position: 50% 45%;
}

/* A photo that fills a card and stretches to match the height of its grid row. */
.photo-card {
  position: relative;
  min-height: 220px;
  margin: 0;
  overflow: hidden;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.photo-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-card figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 48px 18px 16px;
  color: #f2eee7;
  background: linear-gradient(transparent, rgba(23, 21, 27, 0.8));
  font-size: 0.85rem;
  line-height: 1.5;
}

.contact-details {
  display: grid;
  gap: 10px;
  max-width: 60ch;
}

.contact-details p {
  margin: 0;
}

.contact-details a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 56px 0 32px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.footer p {
  margin: 0;
}

.footer p::before,
.photo figcaption::before {
  color: var(--accent);
}

.about-text {
  margin-bottom: 28px;
}

.about-text p {
  margin: 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.photo {
  margin: 0;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.photo-summer img {
  object-position: 50% 75%;
}

.photo-japan img {
  object-position: 50% 80%;
}

.photo figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .toolbox-photo {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 4 / 3;
  }


  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero,
  .about-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-areas:
      'copy'
      'lede'
      'actions'
      'card';
    padding-top: 48px;
  }

  h1 {
    max-width: 11ch;
  }

  .nav {
    gap: 14px;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .contact-block.has-photo {
    grid-template-columns: 1fr;
  }

  .contact-photo {
    max-width: 240px;
  }


  .shell {
    width: min(100% - 20px, 1120px);
  }

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

  .topbar {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px 28px;
    padding: 16px 0;
  }

  .nav {
    margin-left: 0;
    justify-content: flex-start;
    gap: 8px 18px;
  }

  .hero {
    gap: 18px;
  }

  .cv-entry {
    padding: 20px;
  }

  .cv-entry-head,
  .cv-role-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .cv-meta {
    text-align: left;
  }

  .hero-card,
  .project-card,
  .contact-block {
    border-radius: 22px;
  }

  h1 {
    font-size: clamp(2.7rem, 14vw, 4rem);
  }

  .home-hero-title {
    font-size: clamp(2.3rem, 11vw, 3.5rem);
  }
}
