:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #202126;
  --muted: #656872;
  --line: #dedfe4;
  --hover: #eeeeF3;
  --surface: #fcfcfd;
  --accent: #002fa7;
  --project-bg: #edf2ff;
  --project-border: #d0dcfa;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17181c;
  --fg: #f1f1f4;
  --muted: #aaadb8;
  --line: #32343c;
  --hover: #23252c;
  --surface: #202126;
  --accent: #adc2ff;
  --project-bg: #202b47;
  --project-border: #3d4d72;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 var(--font); }
a { color: inherit; text-underline-offset: 4px; }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { flex: none; vertical-align: middle; }
.theme { position: fixed; z-index: 2; top: 22px; right: 24px; display: flex; align-items: center; width: 42px; height: 24px; padding: 2px; border: 1px solid var(--line); border-radius: 99px; background: var(--hover); cursor: pointer; color: var(--muted); }
.theme span { display: grid; place-items: center; width: 18px; height: 18px; }
.theme .active { border-radius: 100%; background: var(--surface); color: var(--accent); }
.wrap { width: min(900px, calc(100% - 64px)); margin: 0 auto; }
.home {
  width: min(1020px, calc(100% - 80px));
  padding: 76px 0 64px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 34px;
  row-gap: 42px;
}
.masthead, .featured, .socials, .resume-section.others { grid-column: 1 / -1; }
.masthead, .page-nav { display: flex; justify-content: space-between; gap: 18px; }
.masthead {
  align-items: end;
  border-top: 4px solid var(--accent);
  padding-top: 24px;
}
h1 { margin: 0; line-height: 1.05; letter-spacing: -.055em; }
.masthead h1 { font-size: clamp(56px, 9vw, 106px); }
.headline { margin: 12px 0 0; color: var(--muted); font-size: clamp(16px, 2.2vw, 20px); }
nav { display: flex; align-items: center; gap: 16px; }
nav a, .page-nav a { text-decoration: none; font-size: 14px; }
.about-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid currentColor;
  color: var(--accent);
  white-space: nowrap;
}
.section-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.projects, .records { list-style: none; margin: 0; padding: 0; }
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 208px;
  padding: 24px 58px 24px 24px;
  border: 1px solid var(--project-border);
  background: var(--project-bg);
  text-decoration: none;
  transition: border-color .18s ease;
}
.project-card:hover, .project-card:focus-visible { border-color: var(--accent); color: inherit; }
.project-meta { color: var(--accent); font-size: 13px; font-weight: 500; }
.project-card h3 { margin: 12px 0 6px; line-height: 1.1; font-size: clamp(30px, 4vw, 43px); letter-spacing: -.04em; }
.project-card p { margin: 0; color: var(--muted); max-width: 34ch; }
.project-arrow { position: absolute; right: 20px; bottom: 22px; color: var(--accent); transition: transform .18s ease; }
.project-card:hover .project-arrow { transform: translateX(3px); }
.resume-section { border-top: 1px solid var(--line); padding-top: 14px; }
.resume-section .section-title { margin-bottom: 5px; }
.record {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 18px;
  padding: 11px 0;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.records li + li { border-top: 1px solid var(--line); }
.record-summary { display: grid; gap: 3px; }
.record-summary strong { font-weight: 600; }
.record-end { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--accent); }
.record-date { font-size: 13px; color: var(--muted); flex: none; }
.muted { color: var(--muted); }
.socials { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; border-top: 1px solid var(--line); padding-top: 19px; color: var(--muted); }
.socials a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 14px; }
.subpage { max-width: 840px; padding: 38px 0 100px; }
.detail { max-width: 1040px; width: min(1040px, calc(100% - 64px)); }
.page-nav { align-items: center; margin-bottom: 57px; font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.page-nav a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.subpage h1 { color: var(--accent); font-size: clamp(40px, 6vw, 60px); }
.about-top { padding-bottom: 40px; }
.about-top.with-portrait { display: grid; grid-template-columns: minmax(0,1fr) 208px; gap: 40px; min-height: 345px; }
.about-top p { margin: 18px 0 0; max-width: 65ch; font-size: 18px; line-height: 1.6; }
.portrait { margin-top: 28px; aspect-ratio: 3/4; transform: rotate(2deg); border: 5px solid var(--surface); }
.card-cover { background: var(--hover); color: var(--muted); display: grid; place-items: center; font-size: 13px; }
.image-button { padding: 0; display: block; width: 100%; border: 0; background: none; cursor: zoom-in; }
.image-button img { display: block; width: 100%; height: 100%; object-fit: cover; }
.about-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); padding-top: 26px; gap: 40px; }
.about-contact { margin: 32px 0 0; color: var(--accent); }
.gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 32px; }
.gallery > * { aspect-ratio: 16/10; border-radius: 4px; overflow: hidden; }
.cards { display: grid; gap: 14px; margin-top: 16px; }
.card { display: grid; grid-template-columns: 26% 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-decoration: none; min-height: 164px; }
.card:hover { background: var(--hover); color: inherit; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-copy { padding: 20px 22px; }
.card-copy time { font-size: 13px; }
.card-copy h2 { font-size: 24px; margin: 5px 0; }
.card-copy p { margin: 5px 0 16px; }
.card-copy strong { font-size: 13px; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.detail-context { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.detail-deck { margin: 16px 0 0; max-width: 56ch; font-size: clamp(17px, 2.5vw, 22px); line-height: 1.45; }
.project-mark { width: clamp(52px, 10vw, 94px); height: auto; aspect-ratio: 1; object-fit: contain; flex: none; }
.detail-media { margin: 28px 0 0; }
.detail-media img { border-radius: 8px; }
.detail-media figcaption { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; }
.detail-layout { margin-top: 32px; }
.detail-layout:has(.detail-sidebar) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 260px); align-items: start; gap: 52px; }
.detail-copy { max-width: 68ch; line-height: 1.65; }
.story-section h2 { margin: 0 0 10px; font-size: clamp(18px, 3vw, 24px); line-height: 1.2; letter-spacing: -.025em; }
.story-section p { margin: 0; line-height: 1.6; }
.story-section p + p { margin-top: 12px; }
.detail-copy .story-section + .story-section { margin-top: 28px; padding-top: 25px; border-top: 1px solid var(--line); }
.detail-sidebar { background: var(--project-bg); border: 1px solid var(--project-border); padding: 18px; font-size: 14px; overflow-wrap: anywhere; }
.detail-sidebar h2 { font-size: 14px; margin: 0 0 8px; }
.detail-sidebar > * + * { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--project-border); }
.detail-facts { margin: 0; }
.detail-facts > div + div { margin-top: 11px; }
.detail-facts dt { font-size: 12px; color: var(--muted); }
.detail-facts dd { margin: 2px 0 0; }
.tool-list, .detail-links { list-style: none; margin: 0; padding: 0; }
.tool-list { display: flex; flex-wrap: wrap; gap: 5px 10px; color: var(--muted); }
.detail-links li + li { margin-top: 8px; }
.detail-links a { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--accent); }
dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); max-width: 90vw; max-height: 92vh; }
dialog::backdrop { background: #000b; }
dialog form { text-align: right; }
dialog button { background: var(--hover); border: 1px solid var(--line); padding: 4px 10px; border-radius: 4px; cursor: pointer; margin-bottom: 10px; }
dialog img { display: block; max-width: 80vw; max-height: 77vh; }
@media (prefers-reduced-motion: reduce) {
  .project-card, .project-arrow { transition: none; }
}
@media (max-width: 760px) {
  .wrap, .detail { width: calc(100% - 40px); }
  .subpage { padding-top: 66px; }
  .theme { top: 15px; right: 19px; }
  .home { padding-top: 62px; column-gap: 20px; row-gap: 32px; }
  .project-card { padding: 19px 40px 19px 17px; }
  .project-arrow { right: 14px; bottom: 18px; }
  .education { flex-wrap: wrap; }
  .detail-layout:has(.detail-sidebar) { gap: 24px; }
}
@media (max-width: 580px) {
  .home, .projects { grid-template-columns: minmax(0, 1fr); }
  .masthead { align-items: start; flex-direction: column; gap: 10px; padding-top: 18px; }
  .project-card { min-height: 166px; }
  .detail-layout:has(.detail-sidebar), .about-columns { grid-template-columns: 1fr; }
  .detail-header { gap: 12px; }
}
@media (max-width: 520px) {
  .about-top.with-portrait { min-height: 0; grid-template-columns: 1fr; gap: 8px; }
  .portrait { width: min(165px, 75%); }
  .card { grid-template-columns: 23% 1fr; }
  .card-copy { padding: 16px; }
}
