:root {
  color-scheme: dark;
  --bg-main: #131b33;
  --bg-overlay: radial-gradient(circle at 10% 0%, #1f2a4e 0%, #161f3a 40%, #131b33 75%);
  --surface: #1a2443;
  --line: #3e4a70;
  --text-main: #d9e0f3;
  --text-muted: #9ca9cc;
  --accent: #f28d39;
  --accent-soft: rgba(242, 141, 57, 0.16);
  --shadow: 0 16px 36px rgba(5, 8, 17, 0.4);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg-main: #f2f4fb;
  --bg-overlay: radial-gradient(circle at 10% 0%, #ffffff 0%, #f3f6ff 35%, #ebeff9 80%);
  --surface: #ffffff;
  --line: #d8dff0;
  --text-main: #1c2845;
  --text-muted: #5f6c8b;
  --accent: #ba5f11;
  --accent-soft: rgba(186, 95, 17, 0.12);
  --shadow: 0 14px 32px rgba(23, 36, 70, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-overlay), var(--bg-main);
  color: var(--text-main);
  font-family: 'IBM Plex Sans', 'Avenir Next', 'Trebuchet MS', sans-serif;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02) 0,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 72px
  );
  opacity: 0.45;
}

h1,
h2,
h3,
.site-title,
.top-nav,
.theme-toggle {
  font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  letter-spacing: 0.01em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(780px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 3rem;
}

.masthead {
  position: sticky;
  top: 0.7rem;
  z-index: 30;
  margin: 1.2rem 0 1.5rem;
  padding: 0 0.25rem;
  border-radius: 0.75rem;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--bg-main) 88%, transparent);
}

.masthead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  row-gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.72rem 0.65rem;
}

.site-title {
  color: var(--text-main);
  font-size: 1.72rem;
  font-weight: 700;
  text-decoration: none;
}

.masthead-controls {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.top-nav {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.28rem;
  align-items: center;
}

.top-nav a,
.nav-dropdown-toggle {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.94rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0.5rem;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.top-nav a:hover,
.top-nav a.active,
.nav-dropdown-toggle:hover,
.nav-dropdown[open] .nav-dropdown-toggle {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.nav-dropdown-toggle::-webkit-details-marker {
  display: none;
}

.nav-dropdown-toggle::after {
  content: '▾';
  font-size: 0.72em;
  opacity: 0.8;
}

.nav-dropdown[open] .nav-dropdown-toggle::after {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  min-width: 170px;
  display: grid;
  gap: 0.1rem;
  padding: 0.35rem;
  border-radius: 0.62rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  z-index: 40;
}

.nav-dropdown:not([open]) .nav-dropdown-menu {
  display: none;
}

.nav-dropdown-menu a {
  border-radius: 0.45rem;
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text-main);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  color: var(--accent);
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

main {
  padding-top: 0.9rem;
}

.section-block {
  scroll-margin-top: 4rem;
}

.intro-card {
  display: grid;
  grid-template-columns: 114px minmax(0, 1fr);
  grid-template-areas:
    'avatar copy'
    'details details';
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise-in 0.4s ease-out both;
}

.hero-avatar {
  grid-area: avatar;
  width: 114px;
  height: 114px;
  border-radius: 999px;
  object-fit: cover;
  object-position: center;
  border: 2px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  box-shadow: var(--shadow);
}

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

.intro-copy h1 {
  margin: 0 0 0.24rem;
  font-size: clamp(1.35rem, 3.3vw, 2rem);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.intro-details {
  grid-area: details;
}

.intro-markdown {
  margin-top: 0.15rem;
}

.intro-markdown p {
  margin: 0 0 0.55rem;
}

.contact-inline {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.contact-inline a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--text-main);
}

.contact-inline a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.section-feed {
  display: grid;
  gap: 0;
}

.entry-card {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise-in 0.45s ease-out both;
}

.entry-card:nth-child(2) {
  animation-delay: 0.06s;
}

.entry-card:nth-child(3) {
  animation-delay: 0.12s;
}

.entry-card h2 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(1.2rem, 2.6vw, 1.55rem);
}

.entry-card h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.entry-meta {
  margin: 0.18rem 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

.markdown-content h2,
.markdown-content h3 {
  margin: 0.95rem 0 0.42rem;
}

.markdown-content h2 {
  font-size: 1.16rem;
}

.markdown-content h3 {
  font-size: 1.02rem;
}

.markdown-content p {
  margin: 0 0 0.7rem;
}

.markdown-content ul {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
}

.markdown-content li {
  margin-bottom: 0.33rem;
}

.markdown-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.95rem 0;
}

.inline-error {
  margin: 0;
  padding: 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid color-mix(in srgb, #b63c3c 30%, var(--line));
  background: color-mix(in srgb, #b63c3c 8%, transparent);
}

.experience-item {
  margin-bottom: 0.8rem;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--line) 86%, var(--accent));
  border-radius: 0.78rem;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.experience-item:last-child {
  margin-bottom: 0;
}

.experience-head {
  margin-bottom: 0.5rem;
}

.experience-head h3 {
  margin: 0 0 0.12rem;
  color: var(--text-main);
  font-size: 1.03rem;
}

.company {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.more-toggle {
  margin-top: 0.25rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  border-radius: 0.55rem;
  padding: 0.26rem 0.6rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
}

.more-toggle:hover,
.more-toggle:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.experience-hidden {
  margin-top: 0.65rem;
}

.contact-lead {
  margin: 0 0 0.55rem;
}

.contact-list {
  margin: 0;
  padding-left: 1.18rem;
}

.embed-card {
  border: 1px solid color-mix(in srgb, var(--line) 86%, var(--accent));
  border-radius: 0.78rem;
  padding: 0.85rem;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.embed-card .instagram-media {
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.embed-fallback {
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.hidden {
  display: none;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .site-title {
    font-size: 1.45rem;
  }

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

  .masthead-controls {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 980px) {
  .top-nav a,
  .nav-dropdown-toggle {
    font-size: 0.9rem;
    padding: 0.26rem 0.46rem;
  }

  .theme-label {
    display: none;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(780px, calc(100% - 1.2rem));
    padding-top: 0.8rem;
  }

  .intro-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      'avatar'
      'copy'
      'details';
    gap: 0.8rem;
  }

  .hero-avatar {
    width: 92px;
    height: 92px;
  }

  .top-nav {
    flex-wrap: wrap;
  }

  .theme-label {
    display: none;
  }

  .embed-card {
    grid-template-columns: 1fr;
  }
}

.inline-error code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--text-main);
}
