:root {
  --ink: #263744;
  --muted-ink: #68777c;
  --accent: #147d92;
  --accent-dark: #0b6072;
  --warm-accent: #d98c50;
  --hairline: rgba(38, 55, 68, 0.12);
  --surface: #fff;
  --soft-surface: #f1f4f2;
  --body-font: "DM Sans", "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display-font: "Newsreader", Georgia, "Times New Roman", serif;
  --serif-font: "Newsreader", Georgia, "Times New Roman", serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #fafaf7;
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 17px;
  letter-spacing: -0.012em;
}

p {
  line-height: 1.72;
  margin: 0 0 1.35rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ink);
  font-family: var(--display-font);
  font-weight: 700;
  letter-spacing: -0.026em;
}

h2 {
  margin: 2.3rem 0 0.9rem;
}

h3 {
  margin: 2rem 0 0.8rem;
}

a {
  text-decoration-color: rgba(20, 125, 146, 0.35);
  text-underline-offset: 0.15em;
}

blockquote {
  background: rgba(20, 125, 146, 0.055);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  color: #52636b;
  font-family: var(--serif-font);
  margin: 1.8rem 0;
  padding: 0.9rem 1.2rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Compact navigation */

.navbar-custom,
.navbar-custom.top-nav-regular,
.navbar-custom.top-nav-short {
  background: rgba(250, 250, 247, 0.96);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 4px 22px rgba(38, 55, 68, 0.045);
  padding-bottom: 0 !important;
  padding-top: 0 !important;
}

.navbar-custom .navbar-brand {
  font-family: var(--display-font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  padding-bottom: 16px;
  padding-top: 16px;
}

.navbar-custom .navbar-brand::after {
  background: var(--warm-accent);
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 6px;
  margin-left: 5px;
  width: 6px;
}

.navbar-custom .navbar-nav .nav-item {
  font-family: var(--body-font);
  font-size: 12px;
  letter-spacing: 0.11em;
}

.navbar-custom .navbar-nav .nav-link {
  padding-bottom: 18px;
  padding-top: 18px;
}

.navbar-custom .nav-item.dropdown:hover,
.navbar-custom .nav-item.dropdown.show {
  background: rgba(20, 125, 146, 0.055);
}

.navbar-custom .nav-item.dropdown .dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 16px 38px rgba(38, 55, 68, 0.12);
  min-width: 230px;
  overflow: hidden;
  padding: 7px;
  width: auto;
}

.navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  padding: 10px 13px;
  text-align: left;
  white-space: nowrap;
}

.navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item:hover,
.navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item:focus {
  background: rgba(20, 125, 146, 0.08);
  color: var(--accent-dark);
}

.navbar-custom .avatar-container {
  display: none !important;
}

/* Deliberate vertical rhythm */

.intro-header {
  margin: 106px 0 40px;
}

.intro-header .page-heading h1,
.intro-header .post-heading h1 {
  color: var(--ink);
  font-size: clamp(42px, 5.4vw, 68px);
  letter-spacing: -0.042em;
  line-height: 1;
  margin: 0;
}

.intro-header .page-heading .page-subheading,
.intro-header .post-heading .post-subheading {
  color: var(--muted-ink);
  font-family: var(--body-font);
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.45;
  margin-top: 16px;
}

.intro-header hr.small {
  border-color: var(--warm-accent);
  border-width: 3px;
  margin: 22px auto 16px;
  max-width: 56px;
}

.page-content {
  line-height: 1.72;
}

.page-content > :first-child {
  margin-top: 0;
}

.page-content > :last-child {
  margin-bottom: 0;
}

/* Home */

.home-page .intro-header {
  background:
    radial-gradient(circle at 80% 22%, rgba(20, 125, 146, 0.1), transparent 28%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.82), rgba(241, 244, 242, 0.52));
  border-bottom: 1px solid rgba(38, 55, 68, 0.06);
  margin: 57px 0 34px;
  overflow: hidden;
  padding: 30px 0 28px;
}

.home-hero-container {
  max-width: 1140px;
}

.home-hero-row {
  align-items: center;
  margin-left: auto;
  margin-right: auto;
  min-height: 268px;
  width: calc(83.333333% + 25px);
}

.home-hero-copy .page-heading {
  text-align: left;
}

.home-hero-copy .page-heading h1 {
  font-size: clamp(56px, 6.2vw, 78px);
  letter-spacing: -0.052em;
  line-height: 0.98;
}

.home-hero-copy .page-heading hr.small {
  margin-left: 0;
}

.home-hero-copy .page-heading .page-subheading {
  font-size: clamp(17px, 1.7vw, 21px);
  max-width: 540px;
}

.home-hero-visual {
  display: flex;
  justify-content: flex-end;
}

.home-portrait-frame {
  aspect-ratio: 4 / 5;
  background: var(--surface);
  border: 7px solid var(--surface);
  border-radius: 17px;
  box-shadow: 0 18px 46px rgba(38, 55, 68, 0.17);
  max-width: 214px;
  position: relative;
  transform: rotate(1.25deg);
  width: 100%;
}

.home-portrait-frame::before {
  background: var(--warm-accent);
  border-radius: 15px;
  content: "";
  height: 72%;
  left: -17px;
  position: absolute;
  top: -17px;
  width: 72%;
  z-index: -1;
}

.home-portrait-frame img {
  border-radius: 11px;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.home-intro-copy {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(38, 55, 68, 0.055);
  display: grid;
  gap: 38px;
  grid-template-columns: minmax(0, 1.75fr) minmax(240px, 0.75fr);
  margin-bottom: 50px;
  padding: 30px 32px;
}

.home-intro-main p {
  font-size: 17px;
  line-height: 1.72;
  margin: 0;
}

.home-intro-aside {
  border-left: 1px solid var(--hairline);
  padding-left: 30px;
}

.home-intro-label,
.section-eyebrow,
.research-meta {
  color: var(--accent-dark);
  display: block;
  font-family: var(--body-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-intro-label {
  margin-bottom: 10px;
}

.home-intro-aside p {
  color: var(--muted-ink);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 0;
}

.home-intro-aside blockquote {
  background: transparent;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 16px;
  margin: 18px 0 0;
  padding: 16px 0 0;
}

.section-heading {
  align-items: flex-end;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.section-heading h2 {
  font-size: 32px;
  margin: 0;
}

.section-eyebrow {
  order: 2;
  padding-bottom: 3px;
}

.research-list {
  display: grid;
  gap: 16px;
}

.research-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(38, 55, 68, 0.1);
  border-radius: 16px;
  box-shadow: 0 8px 26px rgba(38, 55, 68, 0.045);
  display: grid;
  gap: 28px;
  grid-template-areas: "copy visual";
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  overflow: hidden;
  padding: 28px 30px;
}

.research-card:nth-child(even) {
  grid-template-areas: "visual copy";
  grid-template-columns: minmax(330px, 0.95fr) minmax(0, 1.05fr);
}

.research-card-copy {
  grid-area: copy;
}

.research-meta {
  margin: 0 0 9px;
}

.research-card h3 {
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.25;
  margin: 0 0 9px;
}

.research-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.research-card h3 a:hover,
.research-card h3 a:focus {
  color: var(--accent-dark);
}

.research-summary {
  color: #455861;
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 10px;
}

.research-venue,
.research-authors {
  color: var(--muted-ink);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 7px;
}

.research-authors strong {
  color: var(--ink);
}

.research-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.research-links a {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(38, 55, 68, 0.14);
  border-radius: 11px;
  box-shadow: 0 4px 12px rgba(38, 55, 68, 0.055);
  display: inline-flex;
  height: 40px;
  justify-content: center;
  padding: 0;
  position: relative;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  width: 40px;
}

.research-links a:hover,
.research-links a:focus {
  border-color: rgba(20, 125, 146, 0.42);
  box-shadow: 0 8px 18px rgba(38, 55, 68, 0.12);
  transform: translateY(-2px);
}

.research-links a::after {
  background: var(--ink);
  border-radius: 6px;
  bottom: calc(100% + 7px);
  color: #fff;
  content: attr(data-label);
  font-family: var(--body-font);
  font-size: 10px;
  font-weight: 600;
  left: 50%;
  opacity: 0;
  padding: 4px 7px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, 3px);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: nowrap;
  z-index: 2;
}

.research-links a:hover::after,
.research-links a:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.research-links img {
  box-shadow: none;
  height: 21px;
  width: 21px;
}

.research-visual {
  grid-area: visual;
  margin: 0;
  text-align: center;
}

.research-visual img {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(38, 55, 68, 0.08);
  height: auto;
  max-width: 100%;
}

.research-visual-compact img {
  max-height: 310px;
  max-width: 330px;
  object-fit: contain;
  width: 100%;
}

.research-visual-wide img {
  width: 100%;
}

.research-visual-pair {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

/* Shared gallery language */

.visual-gallery,
.pixel-gallery {
  margin: 0 auto;
  max-width: 1180px;
}

.gallery-intro {
  color: var(--muted-ink);
  margin: 0 auto 24px;
  max-width: 1180px;
}

.cv-download {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
  text-align: right;
}

.visual-gallery figure {
  background: var(--surface);
  border: 1px solid rgba(38, 55, 68, 0.08);
  border-radius: 13px;
  break-inside: avoid;
  box-shadow: 0 8px 24px rgba(38, 55, 68, 0.065);
  display: inline-block;
  margin: 0 0 18px;
  overflow: hidden;
  width: 100%;
}

.visual-gallery figure img {
  display: block;
  height: auto;
  transition: transform 260ms ease;
  width: 100%;
}

.visual-gallery figure:hover img {
  transform: scale(1.018);
}

.travel-gallery {
  column-count: 3;
  column-gap: 18px;
}

.travel-gallery figcaption {
  color: var(--muted-ink);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.025em;
  padding: 11px 13px 12px;
}

.doodle-gallery {
  column-count: 3;
  column-gap: 18px;
}

.doodle-gallery figure:nth-child(5n + 2) {
  transform: rotate(0.35deg);
}

.doodle-gallery figure:nth-child(7n + 1) {
  transform: rotate(-0.3deg);
}

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

.pixel-gallery img {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid rgba(38, 55, 68, 0.08);
  border-radius: 11px;
  box-shadow: 0 7px 20px rgba(38, 55, 68, 0.065);
  height: 100%;
  image-rendering: pixelated;
  object-fit: cover;
  transition: transform 180ms ease, box-shadow 180ms ease;
  width: 100%;
}

.pixel-gallery img:hover {
  box-shadow: 0 14px 28px rgba(38, 55, 68, 0.15);
  transform: translateY(-3px);
}

/* Footer */

footer {
  margin-top: 58px;
  padding: 34px 0;
}

footer .list-inline {
  margin-bottom: 14px;
}

footer .footer-links a {
  font-size: 15px;
}

footer .copyright,
footer .theme-by {
  font-family: var(--body-font);
  font-size: 12px;
}

@media (max-width: 991px) {
  .home-page .intro-header {
    padding: 30px 0 28px;
  }

  .home-hero-row {
    min-height: 245px;
    width: 100%;
  }

  .home-portrait-frame {
    max-width: 196px;
  }

  .home-intro-copy {
    gap: 26px;
    padding: 26px;
  }

  .travel-gallery,
  .doodle-gallery {
    column-count: 2;
  }

  .pixel-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  body {
    font-size: 16px;
  }

  .navbar-custom .navbar-nav .nav-link {
    padding-bottom: 11px;
    padding-top: 11px;
  }

  .navbar-custom .nav-item.dropdown .dropdown-menu {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0 0 7px;
  }

  .intro-header {
    margin: 84px 0 28px;
  }

  .intro-header .page-heading h1,
  .intro-header .post-heading h1 {
    font-size: 38px;
  }

  .home-page .intro-header {
    margin-top: 57px;
    padding: 26px 0 24px;
  }

  .home-hero-row {
    flex-direction: column;
    min-height: 0;
  }

  .home-hero-copy {
    order: 2;
  }

  .home-hero-copy .page-heading {
    text-align: center;
  }

  .home-hero-copy .page-heading h1 {
    font-size: 44px;
    margin-top: 16px;
  }

  .home-hero-copy .page-heading hr.small {
    margin-left: auto;
  }

  .home-hero-visual {
    justify-content: center;
    order: 1;
  }

  .home-portrait-frame {
    border-width: 6px;
    max-width: 144px;
  }

  .home-portrait-frame::before {
    left: -12px;
    top: -12px;
  }

  .home-intro-copy {
    display: block;
    margin-bottom: 36px;
    padding: 22px;
  }

  .home-intro-aside {
    border-left: 0;
    border-top: 1px solid var(--hairline);
    margin-top: 20px;
    padding-left: 0;
    padding-top: 18px;
  }

  .section-heading h2 {
    font-size: 27px;
  }

  .research-card,
  .research-card:nth-child(even) {
    gap: 20px;
    grid-template-areas:
      "copy"
      "visual";
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .research-card h3 {
    font-size: 19px;
  }

  .research-visual-compact img {
    max-height: none;
    max-width: 100%;
  }

  .travel-gallery,
  .doodle-gallery {
    column-count: 1;
  }

  .pixel-gallery {
    gap: 9px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .pixel-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
