:root {
  --bg: #fbfaf7;
  --panel: #ffffff;
  --text: #242b2a;
  --muted: #737b78;
  --line: #e2e5e1;
  --accent: #236b5c;
  --accent-soft: #e8f1ed;
  --header: rgba(251, 250, 247, 0.92);
  --shadow: 0 14px 40px rgba(28, 43, 39, 0.07);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Palatino Linotype, Georgia, serif;
}

body[theme="dark"] {
  --bg: #151a19;
  --panel: #1d2422;
  --text: #e8ece9;
  --muted: #9aa49f;
  --line: #303936;
  --accent: #79c5ac;
  --accent-soft: #203b33;
  --header: rgba(21, 26, 25, 0.92);
  --shadow: 0 14px 42px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.72 var(--sans); transition: background .2s ease, color .2s ease; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { opacity: .75; }
.wrapper { min-height: 100vh; display: flex; flex-direction: column; }

#header-desktop, #header-mobile { position: sticky; top: 0; z-index: 20; width: 100%; background: var(--header); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
#header-desktop .header-wrapper, #header-mobile .header-wrapper { width: min(1100px, calc(100% - 40px)); min-height: 68px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.header-title a { color: var(--text); font: 600 1.25rem/1.1 var(--serif); text-decoration: none; letter-spacing: -.02em; }
.menu-inner { display: flex; align-items: center; gap: 1.4rem; }
.menu-item { color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .025em; text-decoration: none; }
.menu-item.active, .menu-item:hover { color: var(--accent); opacity: 1; }
.menu-item.delimiter { width: 1px; height: 18px; margin-left: .1rem; background: var(--line); }
.theme-switch { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.theme-switch::before { content: "◐"; color: var(--text); font-size: 1rem; }
.theme-switch i { display: none; }
#header-mobile { display: none; }

.main { flex: 1; width: 100%; }
.container { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
.page { width: min(760px, 100%); margin: 0 auto; padding: 5rem 0 4rem; }
.single-title { position: relative; margin: 0 0 2.6rem; font: 500 clamp(1.7rem, 4vw, 2.68rem)/1.08 var(--serif); letter-spacing: -.03em; }
.single-title::after { content: ""; display: block; width: 44px; height: 3px; margin-top: 1.25rem; background: var(--accent); }
.content { font-size: .92rem; }
.content h3 { margin: 3.25rem 0 1rem; font: 600 1.45rem/1.3 var(--serif); letter-spacing: -.015em; }
.content h3:first-child { margin-top: 0; }
.content p { margin: 0 0 1.25rem; }
.content ul { margin: .65rem 0 1.35rem; padding: 0; list-style: none; }
.content li { position: relative; margin: 0; padding: .52rem 0 .52rem 1.35rem; line-height: 1.55; border-bottom: 1px solid var(--line); }
.content li::before { content: ""; position: absolute; left: 0; top: 1.13rem; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.content li p { margin: 0; }
.content strong { color: var(--text); font-weight: 650; }
.content code, .home-profile code { padding: .1rem .3rem; background: var(--accent-soft); border-radius: 4px; font-size: .88em; }
.content table { width: 100%; margin: .75rem 0 1.35rem; border-collapse: collapse; font-size: .92rem; line-height: 1.45; }
.content th, .content td { padding: .48rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.content th { color: var(--text); background: var(--accent-soft); font-weight: 650; }
.experience-page { width: min(1050px, 100%); }
.experience-page .content li { white-space: nowrap; }

.home-profile { width: 100%; margin: 0 auto; padding: 5.2rem 0 4.6rem; display: grid; grid-template-columns: minmax(260px, .58fr) minmax(400px, 1fr); align-items: center; gap: clamp(3rem, 6vw, 5rem); }
.home-profile-image { width: 100%; max-width: 360px; margin: 0; padding: 5px; border: 1px solid var(--line); border-radius: 18px 56px 18px 18px; background: var(--panel); box-shadow: var(--shadow); }
.home-profile-image img { width: 100%; height: auto; aspect-ratio: 3 / 2; display: block; object-fit: cover; object-position: center; border-radius: 13px 51px 13px 13px; }
.home-profile-copy { text-align: left; }
.home-profile-title { margin: 0; font: 500 clamp(1.65rem, 4vw, 2.52rem)/1.1 var(--serif); letter-spacing: -.03em; }
.home-profile-subtitle { margin: .8rem 0 2.25rem; color: var(--accent); font-size: .84rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.home-profile-about { max-width: 620px; margin: 0; padding: 1.8rem 2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); text-align: left; }
.home-profile-about p { margin: 0 0 .9rem; }
.home-profile-about p:last-child { margin-bottom: 0; }
.home-profile-about .edit-hint { color: var(--muted); font-size: .78rem; text-align: center; }
.home-profile-links { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: .5rem .75rem; margin-top: 1.75rem; font-size: .82rem; font-weight: 600; }
.home-profile-links span { color: var(--line); }
.profile-focus { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.profile-focus span { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--accent-soft); font-size: .7rem; font-weight: 650; letter-spacing: .025em; }

.footer { padding: 1.8rem 20px 2.5rem; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.footer-container { font-size: .75rem; letter-spacing: .03em; }
.footer-line + .footer-line { margin-top: .2rem; }
.footer-name { margin-bottom: .75rem; color: var(--text); font: 600 1rem/1.3 var(--serif); letter-spacing: 0; }
.footer address { margin: 0; font-style: normal; line-height: 1.55; }
.footer address span { display: block; }
.footer address .address-gap { margin-top: .55rem; }
#fixed-buttons { position: fixed; right: 1.25rem; bottom: 1.25rem; }
.fixed-button { width: 38px; height: 38px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 50%; box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
#back-to-top::before { content: "↑"; }
#back-to-top i { display: none; }

@media (max-width: 820px) {
  #header-desktop { display: none; }
  #header-mobile { display: block; }
  #header-mobile .header-container { position: relative; }
  #header-mobile .menu-toggle { width: 28px; height: 24px; display: flex; flex-direction: column; justify-content: center; gap: 5px; cursor: pointer; }
  #header-mobile .menu-toggle span { width: 100%; height: 2px; background: var(--text); transition: transform .2s, opacity .2s; }
  #header-mobile .menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  #header-mobile .menu-toggle.active span:nth-child(2) { opacity: 0; }
  #header-mobile .menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  #header-mobile .menu { display: none; padding: .5rem 20px 1rem; background: var(--bg); border-top: 1px solid var(--line); text-align: center; }
  #header-mobile .menu.active { display: block; }
  #header-mobile .menu .menu-item { display: block; padding: .55rem; }
  .page { padding-top: 3.5rem; }
  .single-title { margin-bottom: 2.5rem; }
  .home-profile { padding: 4rem 0; grid-template-columns: 1fr; gap: 2.5rem; }
  .home-profile-image { max-width: 680px; justify-self: start; }
  .home-profile-copy { max-width: 680px; }
  .experience-page .content li { white-space: normal; }
}

@media (max-width: 520px) {
  .container, #header-mobile .header-wrapper { width: min(100% - 28px, 1100px); }
  .home-profile-about { padding: 1.35rem; }
  .content li { padding-left: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
