* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #160f24;
  --surface: rgba(47, 34, 68, 0.86);
  --surface-strong: rgba(86, 54, 92, 0.94);
  --text: #fff7ec;
  --muted: #e6d6da;
  --accent: #eea36f;
  --accent-strong: #ffd09c;
  --link: #ffd7a8;
  --border: rgba(255, 208, 156, 0.24);
  --shadow: rgba(35, 13, 52, 0.26);
}

:root[data-theme="sunrise"] {
  color-scheme: light;
  --bg: #bdb2ff;
  --surface: rgba(255, 239, 206, 0.9);
  --surface-strong: rgba(255, 237, 213, 0.98);
  --text: #30243a;
  --muted: #3f343b;
  --accent: #e78b69;
  --accent-strong: #54337a;
  --link: #7550a9;
  --border: rgba(139, 95, 191, 0.22);
  --shadow: rgba(212, 136, 104, 0.16);
}

:root[data-theme="starlight"] {
  color-scheme: dark;
  --bg: #030712;
  --surface: rgba(10, 19, 38, 0.86);
  --surface-strong: rgba(20, 32, 61, 0.96);
  --text: #f4f8ff;
  --muted: #c8d4e8;
  --accent: #86c7ff;
  --accent-strong: #d6e8ff;
  --link: #9ed8ff;
  --border: rgba(158, 216, 255, 0.24);
  --shadow: rgba(0, 0, 0, 0.44);
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 181, 105, 0.34), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(130, 77, 174, 0.46), transparent 34%),
    linear-gradient(160deg, #d98264 0%, #935277 34%, #5d3f91 66%, var(--bg) 100%);
  min-height: 100vh;
}

:root[data-theme="sunrise"] body {
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 214, 151, 0.82), transparent 32%),
    radial-gradient(circle at 88% 8%, rgba(188, 163, 224, 0.46), transparent 36%),
    linear-gradient(160deg, #fff0cf 0%, #f5b68d 36%, #c7a4dd 72%, var(--bg) 100%);
}

:root[data-theme="starlight"] body {
  background: var(--bg) url("assets/starlight.svg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

main {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 88px 0 64px;
}

.home-page {
  min-height: 100svh;
}

.home-page main {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: 96px 48px;
}

.home-page .hero {
  width: 100%;
  margin: 0;
}

.home-page .landing-hero {
  min-height: 0;
}

.wide-page {
  width: min(1040px, calc(100% - 32px));
}

section {
  margin: 56px 0;
}

.hero {
  margin-top: 0;
  padding: 56px 0 24px;
}

.landing-hero {
  min-height: calc(100vh - 152px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-hero {
  padding-bottom: 8px;
}

.eyebrow {
  font-weight: 700;
  color: var(--accent-strong);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.25rem, 8vw, 4.5rem);
  line-height: 1;
  letter-spacing: 0;
  margin: 0 0 24px;
  text-shadow: 0 18px 42px var(--shadow);
}

.interactive-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.2em;
  align-items: baseline;
}

.defined-word {
  position: relative;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-shadow: inherit;
  cursor: pointer;
}

.word-text {
  transition: filter 180ms ease, opacity 180ms ease;
}

.word-definition {
  position: absolute;
  left: 50%;
  top: 60%;
  width: max-content;
  max-width: min(17rem, calc(100vw - 32px));
  padding: 0.18em 0.32em;
  color: var(--accent-strong);
  font-size: clamp(0.92rem, 2vw, 1.1rem);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 10px 28px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

.defined-word:hover .word-text,
.defined-word:focus .word-text {
  filter: blur(5px);
  opacity: 0.24;
}

.defined-word:hover .word-definition,
.defined-word:focus .word-definition {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.defined-word:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 0.08em;
}

.heading-hint {
  width: fit-content;
  margin: -8px 0 18px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  padding-left: 12px;
  font-size: 0.95rem;
  font-weight: 650;
}

h2 {
  font-size: 1.5rem;
  margin: 0 0 25px;
  color: var(--accent-strong);
}

h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.standout {
  color: var(--accent-strong);
  font-weight: 850;
  text-shadow: 0 0 22px color-mix(in srgb, var(--accent), transparent 44%);
}

a {
  color: var(--link);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
  color: var(--accent-strong);
  text-decoration-color: var(--accent);
}

.site-nav {
  position: absolute;
  z-index: 3;
  top: 18px;
  left: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: calc(100% - 180px);
  font-size: 0.95rem;
}

.site-nav a,
.back-link {
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"],
.back-link:hover,
.back-link:focus-visible {
  color: var(--accent-strong);
}

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.project-grid {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface), transparent 10%);
  color: var(--text);
  padding: 8px 16px;
  text-decoration: none;
}

.button-link:hover,
.button-link:focus-visible {
  border-color: var(--accent-strong);
  background: var(--surface-strong);
  color: var(--accent-strong);
}

.theme-picker {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0;
}

.theme-option {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.theme-toggle {
  border-color: var(--accent-strong);
  background: var(--surface-strong);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-strong), transparent 62%);
  min-width: 88px;
}

.theme-options {
  display: flex;
  gap: 8px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
}

.theme-expanded-label {
  display: none;
}

.theme-picker:hover .theme-options,
.theme-picker:focus-within .theme-options {
  max-width: 240px;
  margin-left: 8px;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.theme-picker:hover .theme-collapsed-label,
.theme-picker:focus-within .theme-collapsed-label {
  display: none;
}

.theme-picker:hover .theme-expanded-label,
.theme-picker:focus-within .theme-expanded-label {
  display: inline;
}

.theme-picker:hover .theme-toggle:not([aria-pressed="true"]),
.theme-picker:focus-within .theme-toggle:not([aria-pressed="true"]) {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

.theme-option:hover,
.theme-option:focus-visible {
  background: var(--surface-strong);
}

.theme-option[aria-pressed="true"] {
  border-color: var(--accent-strong);
  background: var(--surface-strong);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-strong), transparent 62%);
}

article {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px var(--shadow);
}

article p {
  flex: 1;
}

article p,
section > p,
.hero p:not(.eyebrow) {
  color: var(--muted);
}

.about-page section {
  margin: 44px 0;
  scroll-margin-top: 32px;
}

.about-page .page-hero {
  margin-top: 0;
  margin-bottom: 50px;
  padding-bottom: 0;
}

.about-page .page-hero h1 {
  margin-bottom: 0;
}

.about-page .page-hero + h2 {
  margin-top: 0;
}

.about-page h2 + section {
  margin-top: 18px;
}

.about-intro {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.profile-frame {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 42px var(--shadow);
  aspect-ratio: 4 / 5;
}

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

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

.about-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.timeline-grid,
.skills-grid {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.timeline-date {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 750;
}

.skill-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.skill-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid color-mix(in srgb, var(--accent-strong), transparent 55%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong), transparent 12%);
  color: var(--accent-strong);
  overflow: hidden;
}

.skill-icon img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px var(--shadow);
}

.qualifications-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.qualifications-table th,
.qualifications-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.qualifications-table th {
  color: var(--accent-strong);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qualifications-table td {
  color: var(--muted);
}

.qualifications-table tbody tr:last-child td {
  border-bottom: 0;
}

.project-page {
  --project-accent: var(--accent-strong);
}

.project-page .eyebrow,
.project-page h2 {
  color: var(--project-accent);
}

.project-page article {
  border-color: color-mix(in srgb, var(--project-accent), transparent 70%);
}

.project-hero {
  padding-top: 32px;
}

.detail-grid {
  display: grid;
  gap: 18px;
}

.project-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.project-nav a {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: 6px 12px;
  text-decoration: none;
}

.project-nav a:hover,
.project-nav a:focus-visible,
.project-nav a[aria-current="page"] {
  border-color: var(--project-accent);
  color: var(--project-accent);
}

.security-page {
  --project-accent: #9be7d8;
}

.security-page[data-theme="sunrise"] {
  --project-accent: #17796d;
}

.beacons-page {
  --project-accent: #ffe08a;
}

.beacons-page[data-theme="sunrise"] {
  --project-accent: #946400;
}

.jsm-page {
  --project-accent: #b9e994;
}

.jsm-page[data-theme="sunrise"] {
  --project-accent: #3f7526;
}

.art-page {
  --project-accent: #ffadc7;
}

.art-page[data-theme="sunrise"] {
  --project-accent: #a33961;
}

.music-page {
  --project-accent: #aebcff;
}

.music-page[data-theme="sunrise"] {
  --project-accent: #4758a7;
}

@media (min-width: 680px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (min-width: 960px) {
  .project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .home-page .interactive-heading {
    flex-direction: column;
    align-items: flex-start;
    font-size: clamp(4.2rem, 15vw, 6.4rem);
    gap: 0.04em;
  }

  .home-page .word-definition {
    font-size: clamp(1.05rem, 3.6vw, 1.4rem);
  }
}

@media (max-width: 720px) {
  main {
    padding-top: 120px;
  }

  .home-page main {
    padding-block: 128px 32px;
  }

  .site-nav {
    max-width: calc(100% - 32px);
  }

  .theme-toggle {
    min-width: 88px;
  }

  .theme-picker {
    top: 56px;
    left: 16px;
    right: auto;
  }

  .theme-options {
    transform: translateX(-10px);
  }

  .about-intro {
    grid-template-columns: 1fr;
  }

  .profile-frame {
    max-width: 320px;
  }
}
