:root {
  --bg: #f4f3ef;
  --bg-elevated: #fffefb;
  --text: #1a2430;
  --muted: #5a6675;
  --accent: #1f4f8a;
  --accent-dark: #153863;
  --stroke: #cfd6e0;
  --shadow: 0 10px 24px rgba(23, 39, 58, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(31, 79, 138, 0.11), transparent 31%),
    radial-gradient(circle at 84% 18%, rgba(16, 31, 48, 0.08), transparent 33%),
    repeating-linear-gradient(125deg, rgba(19, 36, 47, 0.012), rgba(19, 36, 47, 0.012) 2px, transparent 2px, transparent 24px),
    var(--bg);
  line-height: 1.65;
}

main p {
  text-align: justify;
  text-justify: inter-word;
}

main .eyebrow,
main .muted,
main .blog-tags,
main .blog-head-row p,
main .article-meta-row p,
main figcaption,
main .small-note {
  text-align: left;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(245, 242, 234, 0.88);
  border-bottom: 1px solid var(--stroke);
  z-index: 20;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.site-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(19, 36, 47, 0.08);
  transform: translateY(-1px);
}

.site-nav a.active {
  background: #e9eef6;
  color: var(--accent-dark);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--stroke);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.lang-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 88px;
  height: 34px;
  padding: 3px;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #fffdf9;
  box-shadow: inset 0 1px 1px rgba(26, 36, 48, 0.05);
  font-size: 0.82rem;
  font-weight: 700;
}

.lang-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc((100% - 6px) / 2);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: #e9eef6;
  box-shadow: 0 1px 3px rgba(26, 36, 48, 0.15);
  transition: left 0.25s ease;
}

.lang-switch.lang-en .lang-switch-thumb {
  left: calc(50%);
}

.lang-switch .lang-option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-decoration: none;
  color: var(--muted);
  height: 100%;
  line-height: 1;
  border-radius: 6px;
}

.lang-switch .lang-option.active {
  color: var(--accent-dark);
}

.lang-switch span {
  display: none;
}

.hero {
  padding: 5rem 0 3rem;
}

.home-compact {
  padding: 1.4rem;
}

.home-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: center;
}

.profile-block {
  text-align: center;
}

.profile-photo {
  width: 170px;
  height: 170px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.profile-name {
  margin-top: 0.7rem;
  margin-bottom: 0;
  font-size: 1.4rem;
}

.home-links {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.home-overview {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.home-overview.single-panel {
  grid-template-columns: 1fr;
}

.overview-panel h2 {
  margin-bottom: 0.7rem;
  font-size: 1.3rem;
}

.overview-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.45rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.8rem;
  align-items: start;
}

.eyebrow {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-size: 0.78rem;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: "Fraunces", serif;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin: 0.6rem 0 1.1rem;
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 65ch;
}

.hero-card,
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow);
}

.hero-card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.small-note,
.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.cta-row {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #3869a3);
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(24, 64, 113, 0.28);
}

.btn-outline {
  border: 1px solid var(--stroke);
  color: var(--text);
  background: #fffdf9;
}

.section {
  padding: 2.2rem 0 3.2rem;
}

.two-col,
.cv-layout,
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.projects-split {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 1rem;
  align-items: start;
}

.projects-column {
  display: grid;
  gap: 0.9rem;
}

.projects-scroll {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.3rem;
  display: grid;
  gap: 0.9rem;
}

.projects-column h2 {
  margin-bottom: 0.1rem;
}

.projects-divider {
  width: 1px;
  background: var(--stroke);
  min-height: 100%;
}

.project-row {
  border-left: 5px solid #d6e2f2;
}

.project-links {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-mini {
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
}

.resource-unavailable {
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--stroke);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.88rem;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  border: 1px solid #9aacbf;
  font-size: 0.82rem;
  font-weight: 700;
  color: #34495f;
  background: #eff4fa;
}

.status-live {
  border-color: #7b9ec5;
  color: #173c66;
  background: #e6f0fb;
}

.project-row.is-hidden {
  display: none;
}

.blog-tools {
  margin-bottom: 0.9rem;
}

.keyword-title {
  margin: 0 0 0.45rem;
}

.keyword-filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.keyword-btn {
  border: 1px solid var(--stroke);
  background: #fffdf9;
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.keyword-btn.active {
  background: #e9eef6;
  color: var(--accent-dark);
  border-color: #b9cde5;
}

.blog-scroll-wrap {
  max-height: 72vh;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.blog-list {
  display: grid;
  gap: 0.9rem;
}

.blog-post-card {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 0.95rem;
  align-items: start;
}

.blog-post-card.is-hidden {
  display: none;
}

.blog-thumb {
  width: 100%;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--stroke);
}

.blog-post-body h2 {
  margin-bottom: 0.45rem;
}

.blog-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.blog-head-row p {
  margin: 0;
}

.blog-tags {
  font-size: 0.82rem;
  color: #3f5370;
}

.article-wrap {
  width: min(860px, 92vw);
  margin: 0 auto;
}

.article-wrap .panel {
  padding: 1.35rem 1.5rem;
}

.article-prose p {
  text-align: justify;
  text-justify: inter-word;
}

.article-prose p.lead {
  text-align: left;
}

.article-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.article-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.article-tag {
  font-size: 0.8rem;
  border: 1px solid #b9cde5;
  color: #27476f;
  background: #edf3fb;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

.article-figure {
  margin: 1rem 0;
}

.article-figure img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

.article-figure figcaption {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.article-callout {
  margin: 1rem 0;
  border-left: 4px solid #88a8cf;
  background: #f3f7fc;
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
}

.article-quote {
  margin: 1rem 0;
  padding: 0.8rem 0.9rem;
  border-left: 4px solid #9ab4d4;
  color: #23364a;
  background: #f8fbff;
  border-radius: 10px;
}

.article-grid-2 {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.article-note {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: #fff;
}

.article-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.article-table th,
.article-table td {
  border: 1px solid var(--stroke);
  padding: 0.55rem 0.6rem;
  text-align: left;
}

.article-table th {
  background: #eef4fb;
}

.article-checklist {
  margin: 1rem 0;
  padding-left: 1.15rem;
}

.article-checklist li + li {
  margin-top: 0.35rem;
}

.text-link {
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
  text-decoration: underline;
}

.page-intro {
  margin-bottom: 1.3rem;
}

.timeline-item + .timeline-item {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--stroke);
}

.tag-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.7rem 0 0;
}

.tag-list li {
  border: 1px solid var(--stroke);
  background: #fcfaf4;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
}

.contact-form {
  display: grid;
  gap: 0.7rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0.72rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: #fffefb;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid #c4d8ef;
  outline-offset: 1px;
}

.site-footer {
  border-top: 1px solid var(--stroke);
  background: rgba(255, 253, 248, 0.9);
}

.footer-wrap {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-wrap p {
  margin: 0;
}

.footer-wrap a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: riseIn 0.7s ease forwards;
}

.reveal:nth-child(2) {
  animation-delay: 0.12s;
}

.reveal:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes riseIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .home-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .projects-split {
    grid-template-columns: 1fr;
  }

  .projects-divider {
    display: none;
  }

  .projects-scroll {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .home-overview {
    grid-template-columns: 1fr;
  }

  .blog-scroll-wrap {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

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

  .blog-thumb {
    height: 180px;
  }

  .article-grid-2 {
    grid-template-columns: 1fr;
  }

  .hero-grid,
  .cards-grid,
  .two-col,
  .cv-layout,
  .contact-layout {
    grid-template-columns: 1fr;
  }

  .site-nav {
    position: absolute;
    top: 72px;
    right: 4vw;
    left: 4vw;
    display: none;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 0.65rem;
    box-shadow: var(--shadow);
  }

  .lang-switch {
    margin-left: auto;
  }

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

  .menu-toggle {
    display: inline-flex;
  }

  .footer-wrap {
    flex-direction: column;
    justify-content: center;
    padding: 0.7rem 0;
  }
}
