:root {
  color-scheme: light;
  --container: min(960px, calc(100% - 40px));
  --article: min(720px, calc(100% - 40px));
  --ink: #16181d;
  --muted: #5b6470;
  --soft-muted: #8b95a3;
  --line: #e7e9ee;
  --panel: #ffffff;
  --soft: #f5f6f8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e7f3ef;
  --code: #f3f4f6;
  --bg: #fbfbf9;
  --header-bg: rgba(251, 251, 249, 0.92);
  --shadow-floating: 0 6px 20px rgba(15, 17, 21, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eaee;
  --muted: #9aa3b1;
  --soft-muted: #6c7585;
  --line: #262a32;
  --panel: #16181d;
  --soft: #1b1e24;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #133f3a;
  --code: #1b1e24;
  --bg: #0f1115;
  --header-bg: rgba(15, 17, 21, 0.88);
  --shadow-floating: 0 6px 20px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  padding: 14px max(20px, calc((100% - 960px) / 2));
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 0.98rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--bg);
  background: var(--ink);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-switch__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 52px;
  height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.lang-switch__button:hover,
.lang-switch__button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--ink);
}

.lang-switch__button.is-active {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}

.lang-switch__flag {
  display: block;
  flex-shrink: 0;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

.lang-switch__code {
  line-height: 1;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
}

/* Home */
.home-intro {
  width: var(--container);
  margin: 0 auto;
  padding: 56px 0 24px;
}

.home-intro h1 {
  max-width: 720px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.4vw, 2.85rem);
  font-weight: 700;
  line-height: 1.15;
}

.intro-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

/* Sections */
.profile-hero,
.about-section,
.expertise-section,
.feed-layout,
.topic-section,
.about-note {
  width: var(--container);
  margin: 0 auto;
}

/* Profile Hero */
.profile-hero {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--line);
}

.profile-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
  gap: 36px;
  align-items: center;
  max-width: 100%;
}

.profile-hero h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 12px 0 20px;
}

.profile-hero-copy {
  max-width: 680px;
}

.profile-bio {
  max-width: 580px;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.profile-bio strong {
  color: var(--ink);
  font-weight: 600;
}

.profile-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  transition: opacity 140ms ease, transform 140ms ease;
}

.profile-link:hover,
.profile-link:focus-visible {
  opacity: 0.85;
  transform: translateY(-1px);
}

.profile-link--secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.profile-link--secondary:hover,
.profile-link--secondary:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  opacity: 1;
}

.profile-hero-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 36%), var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-floating);
}

.profile-hero-photo {
  display: block;
  width: 100%;
  aspect-ratio: 900 / 884;
  object-fit: cover;
  border-radius: 18px;
}

.profile-hero-caption {
  display: grid;
  gap: 2px;
  padding: 2px 4px 4px;
}

.profile-hero-caption strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.profile-hero-caption span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* About section */
.about-section {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 40px;
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.about-section .section-heading {
  margin-bottom: 0;
}

.about-body {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.about-body p {
  margin: 0 0 18px;
}

.about-body p:last-child {
  margin-bottom: 0;
}

.about-body strong {
  color: var(--ink);
  font-weight: 600;
}

/* Expertise section */
.expertise-section {
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.expertise-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.expertise-card {
  display: grid;
  gap: 8px;
  padding: 22px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.expertise-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--soft);
  border-radius: 8px;
  color: var(--accent-strong);
  margin-bottom: 4px;
}

.expertise-card strong {
  display: block;
  font-size: 0.98rem;
  color: var(--ink);
  font-weight: 600;
}

.expertise-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Home intro (kept for compatibility) */
.home-intro {
  padding: 56px 0 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.home-intro h1 {
  max-width: 720px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.4vw, 2.85rem);
  font-weight: 700;
  line-height: 1.15;
}

.intro-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

/* Feed */
.feed-layout {
  padding: 32px 0 56px;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  line-height: 1.2;
  font-weight: 700;
}

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

.post-card {
  display: grid;
  gap: 10px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  transition: transform 140ms ease;
}

.post-card:first-child {
  padding-top: 8px;
}

.post-card:last-child {
  border-bottom: none;
}

.post-card--featured {
  padding-bottom: 32px;
}

.post-card-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 700;
}

.post-card--featured .post-card-title {
  font-size: 1.85rem;
}

.post-card-title a {
  color: var(--ink);
  transition: color 140ms ease;
}

.post-card-title a:hover,
.post-card-title a:focus-visible {
  color: var(--accent-strong);
}

.post-card-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--soft-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.post-meta span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--soft-muted);
}

.tag-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

/* Topics */
.topic-section {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.topic-grid a {
  display: block;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 140ms ease, transform 140ms ease;
}

.topic-grid a:hover,
.topic-grid a:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.topic-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.98rem;
  color: var(--ink);
}

.topic-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* About */
.about-note {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 40px;
  padding: 56px 0 72px;
  border-top: 1px solid var(--line);
}

.about-note h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  line-height: 1.2;
}

.about-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.about-list li + li {
  margin-top: 12px;
}

code {
  padding: 0.12rem 0.32rem;
  background: var(--code);
  border-radius: 4px;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

/* Gallery */
.gallery-section {
  width: var(--container);
  margin: 0 auto;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.gallery-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.gallery-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-floating);
}

.gallery-card__visual {
  height: 96px;
}

.gallery-card__visual--blue {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.gallery-card__visual--teal {
  background: linear-gradient(135deg, #0f766e 0%, #2dd4bf 100%);
}

.gallery-card__visual--orange {
  background: linear-gradient(135deg, #c2410c 0%, #fb923c 100%);
}

.gallery-card__visual--purple {
  background: linear-gradient(135deg, #6d28d9 0%, #a78bfa 100%);
}

.gallery-card__body {
  padding: 20px;
  display: grid;
  gap: 8px;
}

.gallery-card__period {
  margin: 0;
  color: var(--soft-muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.gallery-card__description {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.gallery-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* Footer */
.site-footer {
  display: grid;
  gap: 20px;
  width: var(--container);
  margin: 0 auto;
  padding: 28px 0 36px;
  color: var(--soft-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 4px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--soft-muted);
  border-radius: 8px;
  transition: color 140ms ease, background 140ms ease;
}

.social-link:hover,
.social-link:focus-visible {
  color: var(--ink);
  background: var(--soft);
}

/* Post page */
.post-shell {
  width: var(--article);
  margin: 0 auto;
  padding: 36px 0 80px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 140ms ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--ink);
}

.post-article {
  background: transparent;
}

.post-header {
  display: grid;
  gap: 14px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.post-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.post-content {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.75;
}

.post-content h1,
.post-content h2,
.post-content h3 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.01em;
}

.post-content h2 {
  margin: 44px 0 14px;
  font-size: 1.55rem;
  line-height: 1.25;
}

.post-content h3 {
  margin: 32px 0 12px;
  font-size: 1.25rem;
  line-height: 1.3;
}

.post-content p {
  margin: 0 0 22px;
}

.post-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.post-content a:hover,
.post-content a:focus-visible {
  text-decoration-thickness: 2px;
}

.post-content ul,
.post-content ol {
  margin: 0 0 24px;
  padding-left: 24px;
}

.post-content li + li {
  margin-top: 8px;
}

.post-content strong {
  color: var(--ink);
}

.post-content blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 18px;
  color: var(--muted);
  border-left: 3px solid var(--line);
  font-style: italic;
}

.post-content pre {
  margin: 0 0 24px;
  padding: 16px 18px;
  background: var(--code);
  border-radius: 8px;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.post-content pre code {
  padding: 0;
  background: transparent;
  font-size: inherit;
}

.post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border-radius: 8px;
}

.post-content hr {
  margin: 36px 0;
  border: none;
  border-top: 1px solid var(--line);
}

.loading-text,
.error-message {
  color: var(--muted);
  line-height: 1.65;
}

.error-message {
  margin: 0;
  padding: 16px 18px;
  background: #fff5f5;
  border: 1px solid #f2c2c2;
  border-radius: 8px;
}

[data-theme="dark"] .error-message {
  background: #2a1818;
  border-color: #5a2a2a;
  color: #f3c2c2;
}

/* Theme toggle (floating) */
.theme-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-floating);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.theme-toggle__icon {
  width: 20px;
  height: 20px;
}

.theme-toggle__icon--moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: block;
}

@media (max-width: 720px) {
  .theme-toggle {
    right: 14px;
    bottom: 14px;
  }
}

/* Responsive */
@media (max-width: 720px) {
  :root {
    --container: min(100% - 24px, 960px);
    --article: min(100% - 24px, 720px);
  }

  .site-header {
    padding: 12px 16px;
  }

  .header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
  }

  .site-nav {
    gap: 14px;
    font-size: 0.88rem;
  }

  .lang-switch {
    gap: 4px;
  }

  .lang-switch__button {
    min-width: 46px;
    height: 28px;
    padding: 0 8px;
    gap: 4px;
  }

  .profile-hero {
    padding: 44px 0 32px;
  }

  .profile-hero-inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .profile-hero h1 {
    font-size: clamp(2rem, 7vw, 2.6rem);
  }

  .profile-bio {
    font-size: 1rem;
  }

  .about-section {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 40px 0;
  }

  .expertise-grid {
    grid-template-columns: 1fr;
  }

  .expertise-section {
    padding: 40px 0;
  }

  .home-intro {
    padding: 36px 0 16px;
  }

  .home-intro h1 {
    font-size: clamp(1.7rem, 6vw, 2.2rem);
  }

  .intro-copy {
    font-size: 1rem;
  }

  .post-card-title {
    font-size: 1.25rem;
  }

  .post-card--featured .post-card-title {
    font-size: 1.5rem;
  }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .about-note {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 40px 0 56px;
  }

  .topic-section,
  .feed-layout {
    padding: 40px 0;
  }

  .gallery-section {
    padding: 40px 0;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .post-shell {
    padding: 24px 0 64px;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-content h2 {
    font-size: 1.35rem;
  }

  .post-content h3 {
    font-size: 1.15rem;
  }
}
