*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #666666;
  --border: #e5e5e5;
  --nav-height: 56px;
  --max-width: 720px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-name {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--fg);
}

/* ── Main layout ── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding-top: calc(var(--nav-height) + 5rem);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

section:last-of-type {
  border-bottom: none;
  padding-bottom: 6rem;
}

section h2 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.section-body {
  max-width: 640px;
}

/* ── Hero / About ── */
#about {
  padding-top: calc(var(--nav-height) + 6rem);
}

.hero {
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* About blocks */
.about-block {
  margin-bottom: 1.75rem;
}

.about-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.about-text {
  font-size: 0.97rem;
  color: var(--fg);
  white-space: pre-line;
}

/* ── Education ── */
.education-block {
  padding-top: 0;
  margin-top: 5.5rem;
}

.subsection-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.edu-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}


.edu-entry:last-child {
  padding-bottom: 0;
}

.edu-school {
  font-size: 0.9rem;
  font-weight: 500;
}

.edu-period {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.edu-detail {
  font-size: 0.82rem;
  color: var(--muted);
  grid-column: 1;
}

.edu-location {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
}

/* ── Olympiads ── */
.olympiad-list {
  list-style: none;
}

.olympiad-list li {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 1.5rem;
  align-items: start;
}

.ol-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.ol-result {
  font-size: 0.82rem;
  color: var(--fg);
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.ol-year {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
  grid-column: 2;
}

.ol-detail {
  font-size: 0.8rem;
  color: var(--muted);
  grid-column: 1 / -1;
}

/* ── Work, Civic & Art entries ── */
.entries {
  display: flex;
  flex-direction: column;
}

.entry {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.2rem;
}

.entry-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.entry-period {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.entry-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.entry-bullets {
  list-style: none;
  padding: 0;
}

.entry-bullets li {
  font-size: 0.88rem;
  color: var(--fg);
  padding-left: 1rem;
  position: relative;
  margin-bottom: 0.3rem;
}

.entry-bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.entry-desc {
  font-size: 0.88rem;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.entry-accolade {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

/* ── Art expand ── */
.art-toggle {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.75rem;
  cursor: pointer;
  display: inline-block;
}

.art-toggle:hover {
  color: var(--fg);
}

.art-gallery {
  display: none;
}

.art-gallery.open {
  display: block;
  margin-top: 1.5rem;
}

.art-long-desc {
  font-size: 0.88rem;
  color: var(--fg);
  margin-bottom: 1.5rem;
  line-height: 1.7;
  white-space: pre-line;
}

.art-acclaim {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin: 0 0 1.5rem 0;
  line-height: 1.65;
}

.art-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.art-gallery-grid img {
  width: 100%;
  display: block;
}

.art-gallery-grid img:not(:only-child) {
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.art-gallery-grid img:only-child {
  grid-column: 1 / -1;
  max-width: 50%;
  height: auto;
}

/* ── Other ── */
.other-entry {
  padding: 1.2rem 0;
  border-top: 1px solid var(--border);
}

.other-title {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.other-desc {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Log ── */
.log-substack {
  font-size: 0.97rem;
}

.log-substack a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: border-color 0.15s;
}

.log-substack a:hover {
  border-color: var(--fg);
}

.log-entries {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
}

.log-entries li {
  padding: 0.65rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.88rem;
}

.log-entries a {
  color: var(--fg);
  text-decoration: none;
}

.log-entries a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.log-entries .log-date {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Media ── */
.media-list {
  list-style: none;
  padding: 0;
}

.media-section-header {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2rem 0 0.75rem;
}

.media-group {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.media-category {
  font-size: 0.82rem;
  color: var(--muted);
}

.media-links {
  font-size: 0.85rem;
}

.media-links a {
  color: var(--fg);
  text-decoration: none;
}

.media-links a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Contact ── */
#contact-email a {
  font-size: 1rem;
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: border-color 0.15s;
}

#contact-email a:hover {
  border-color: var(--fg);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  nav {
    padding: 0 1.25rem;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 0.95rem;
  }

  .nav-toggle {
    display: block;
  }

  main {
    padding: 0 1.25rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .olympiad-list li {
    grid-template-columns: 1fr;
  }

  .ol-result {
    text-align: left;
  }

  .edu-entry {
    grid-template-columns: 1fr;
  }

  .edu-period,
  .edu-location {
    text-align: left;
  }

  .entry-header {
    flex-direction: column;
    gap: 0.1rem;
  }

  .art-gallery.open {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
