:root {
  --ink: #171717;
  --muted: #6d6d6d;
  --line: #dedede;
  --paper: #ffffff;
  --soft: #f6f6f4;
  --link: #8b1e2d;
  --shell: 1120px;
  --sidebar: 230px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { width: min(calc(100% - 48px), var(--shell)); margin: 0 auto; }

.banner {
  position: relative;
  height: 290px;
  background-color: #3d454b;
  background-image: url('/assets/Thinkin.png');
  background-position: center 46%;
  background-size: cover;
  overflow: hidden;
}
.banner-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8,12,15,.62) 0%, rgba(8,12,15,.30) 52%, rgba(8,12,15,.08) 100%);
}
.banner-copy { height: 100%; position: relative; display: flex; align-items: flex-end; padding-bottom: 42px; }
.identity { margin-left: calc(var(--sidebar) + 54px); color: white; text-shadow: 0 1px 10px rgba(0,0,0,.25); }
.identity h1 {
  margin: 0 0 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 5vw, 4.4rem);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.035em;
}
.identity p { margin: 0; font-size: 1.04rem; opacity: .96; }

.nav-band { height: 76px; background: white; border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.025); }
.nav-inner { position: relative; height: 100%; display: flex; align-items: center; }
.portrait-wrap {
  position: absolute;
  left: 0;
  bottom: 18px;
  width: 198px;
  height: 198px;
  border-radius: 50%;
  background: white;
  padding: 7px;
  box-shadow: 0 2px 18px rgba(0,0,0,.17);
}
.portrait {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: #e8e8e4;
}
nav { margin-left: calc(var(--sidebar) + 54px); display: flex; align-items: stretch; height: 100%; gap: 35px; }
nav a {
  display: flex;
  align-items: center;
  position: relative;
  color: #333;
  font-weight: 600;
  font-size: .91rem;
  letter-spacing: .025em;
  text-transform: uppercase;
}
nav a:hover { text-decoration: none; color: var(--link); }
nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--link);
}

.page-grid {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 54px;
}
.sidebar { padding-right: 27px; border-right: 1px solid var(--line); }
.sidebar-spacer { height: 30px; }
.side-block { padding: 24px 0 26px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.side-block h2 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.side-block a, .side-block span { font-size: .9rem; }
.side-block span { color: var(--muted); }

.content { min-width: 0; }
.home-section { padding: 58px 0 62px; border-bottom: 1px solid var(--line); }
.first-section { padding-top: 46px; }
.home-section > h2, .section-heading h2 {
  margin: 0 0 25px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.05rem;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -.025em;
}
.home-section p { max-width: 770px; }
.intro { font-family: Georgia, "Times New Roman", serif; font-size: 1.2rem; line-height: 1.62; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.section-heading > a { font-size: .9rem; white-space: nowrap; }

.publication {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.publication h3 { margin: 0 0 5px; font-size: 1.02rem; line-height: 1.4; }
.publication p { margin: 2px 0; font-size: .92rem; }
.pub-year { color: var(--muted); font-size: .85rem; padding-top: 2px; }
.meta { color: var(--muted); font-size: .84rem !important; }

.recent-list { border-top: 1px solid var(--line); }
.recent-item { display: grid; grid-template-columns: 105px minmax(0,1fr); gap: 20px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.recent-item time { color: var(--muted); font-size: .84rem; }
.recent-item p { margin: 0; font-size: .94rem; }
.footer { padding: 30px 0 50px; color: var(--muted); font-size: .79rem; }

/* Markdown / blog pages */
.article-shell { width: min(calc(100% - 48px), 760px); margin: 60px auto 90px; }
.article-shell h1 { font-family: Georgia, "Times New Roman", serif; font-size: 2.8rem; line-height: 1.1; font-weight: 500; letter-spacing: -.03em; }
.article-shell h2, .article-shell h3 { margin-top: 2.1em; }
.article-shell p, .article-shell li { font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; }
.article-shell pre { overflow-x: auto; padding: 16px; background: var(--soft); border: 1px solid var(--line); }
.article-shell code { background: var(--soft); padding: 1px 4px; border-radius: 3px; }
.article-shell pre code { background: none; padding: 0; }
.article-shell blockquote { margin-left: 0; padding-left: 20px; border-left: 3px solid var(--line); color: #555; }
.article-shell img { max-width: 100%; height: auto; }
.article-shell hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.article-meta { color: var(--muted); font-size: .86rem; margin-top: -20px; margin-bottom: 34px; }
.blog-list { list-style: none; padding: 0; }
.blog-list li { padding: 18px 0; border-top: 1px solid var(--line); }
.blog-list time { color: var(--muted); font-size: .82rem; }

@media (max-width: 760px) {
  .shell { width: min(calc(100% - 30px), var(--shell)); }
  .banner { height: 245px; }
  .banner-copy { align-items: flex-start; padding-top: 40px; }
  .identity { margin-left: 0; }
  .identity h1 { font-size: 2.7rem; }
  .identity p { max-width: 280px; }
  .nav-band { height: 92px; }
  .portrait-wrap { width: 128px; height: 128px; bottom: 18px; }
  nav { margin-left: 150px; gap: 18px; }
  nav a { font-size: .8rem; }
  .page-grid { grid-template-columns: 1fr; gap: 0; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .sidebar-spacer { display: none; }
  .side-block { border-bottom: 0; padding: 28px 0; }
  .first-section { padding-top: 42px; }
  .home-section { padding: 46px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0; }
  .publication { grid-template-columns: 48px minmax(0,1fr); gap: 12px; }
  .recent-item { grid-template-columns: 80px minmax(0,1fr); gap: 12px; }
}

@media (max-width: 470px) {
  .portrait-wrap { width: 105px; height: 105px; }
  nav { margin-left: 122px; gap: 14px; }
  .sidebar { grid-template-columns: 1fr; gap: 0; }
  .side-block + .side-block { padding-top: 0; }
}

.pub-title {
  font-style: italic;
}

.me {
  font-weight: 600;
}

/* Final homepage spacing / banner fixes */

/* Keep the full banner title on one line on normal desktop screens */
.identity h1 {
  white-space: nowrap;
  font-size: clamp(2.5rem, 4.2vw, 3.75rem);
}

/* Tighten the transition from About me → Publications */
#about {
  padding-bottom: 40px;
}

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

#publications {
  padding-top: 40px;
}

/* Preserve sensible wrapping on small screens */
@media (max-width: 760px) {
  .identity h1 {
    white-space: normal;
    font-size: 2.5rem;
  }
}
