:root {
  --shell-width: 980px;
  --bg: #f7f3eb;
  --paper: #fffcf6;
  --text: #1f2329;
  --muted: #5f6570;
  --line: #dfd7c9;
  --accent: #8b5d3a;
  --accent-soft: #f1e2d2;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 100% 0, #efe6d8 0, transparent 32rem),
    linear-gradient(180deg, #f8f4ed 0%, var(--bg) 100%);
  line-height: 1.65;
}

.page-shell {
  width: min(var(--shell-width), calc(100% - 2rem));
  margin: 2rem auto 3rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(32, 27, 20, 0.06);
  overflow: hidden;
}

.site-header {
  padding: 1.1rem 1.3rem 1.4rem;
  background: linear-gradient(180deg, #fcf8f0 0%, #faf5ed 100%);
  border-bottom: 1px solid var(--line);
}

.page-title {
  margin: 0.1rem 0 0;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin-bottom: 1.1rem;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.9rem;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  border-color: var(--line);
  color: var(--text);
}

.top-nav a.active {
  background: var(--accent-soft);
  border-color: #e0c6aa;
  color: #6c4528;
}

.hero {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1.1rem;
  align-items: start;
}

.hero-image-link img {
  display: block;
  width: 250px;
  height: 250px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #dfd2be;
}

.hero-text h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.55rem, 2.9vw, 2rem);
  line-height: 1.2;
}

.hero-text p {
  margin: 0.35rem 0;
}

.content {
  padding: 1.6rem 1.3rem 2rem;
}

section + section {
  margin-top: 1.7rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0 0 0.65rem;
  font-size: 1.18rem;
  letter-spacing: 0.01em;
}

h3 {
  margin: 1rem 0 0.45rem;
  font-size: 1rem;
  color: #3a3f47;
}

p,
li {
  font-size: 0.98rem;
}

ul {
  margin: 0.2rem 0 0.75rem 1.2rem;
  padding: 0;
}

li + li {
  margin-top: 0.42rem;
}

.publications-section h3 {
  margin-top: 1.2rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px dashed var(--line);
  color: #2f353d;
}

.publications-section ul {
  list-style: none;
  margin: 0.45rem 0 1.05rem;
  padding: 0;
}

.publications-section li {
  position: relative;
  margin: 0.58rem 0;
  padding-left: 1.05rem;
  line-height: 1.55;
}

.publications-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 999px;
  background: #c9a889;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.12em;
}

a:hover,
a:focus-visible {
  color: #6f492d;
}

@media (max-width: 780px) {
  .page-shell {
    width: min(var(--shell-width), calc(100% - 1rem));
    margin-top: 1rem;
  }

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

  .hero-image-link img {
    width: min(250px, 100%);
    height: auto;
  }
}

.content-narrow {
  width: min(var(--shell-width), calc(100% - 2rem));
  margin: 1.2rem auto 2.2rem;
}

.simple-header {
  width: min(var(--shell-width), calc(100% - 2rem));
  margin: 1.3rem auto 0;
  background: linear-gradient(180deg, #fcf8f0 0%, #faf5ed 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  box-shadow: 0 10px 30px rgba(32, 27, 20, 0.05);
}

.simple-header h1 {
  margin: 0.2rem 0 0.6rem;
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

.simple-header .back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

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

.gallery-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-card,
.video-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
}

.photo-card img,
.video-card video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.caption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.45rem;
}

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

.math-header {
  margin-bottom: 0.5rem;
}

.math-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.math-article {
  max-width: 860px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem;
}

.math-article figure {
  margin: 1rem auto;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  text-align: center;
}

.math-article figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.math-article figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.math-article .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
}

.math-article .theorem {
  border-left: 4px solid #b67c4f;
  background: #f7eee2;
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  margin: 0.95rem 0;
}

.math-article code.k {
  background: #f1e2d2;
  border-radius: 0.35em;
  padding: 0.08em 0.35em;
}

.math-article .foot {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1.4rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
}

.math-article .eq-inline {
  font-family: "Times New Roman", Times, serif;
}

.math-article .equation {
  text-align: center;
  font-family: "Times New Roman", Times, serif;
  font-size: 1.08rem;
  margin: 0.55rem 0;
}

.math-article .frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.math-article .frac .num {
  border-bottom: 1px solid #6f6559;
  padding: 0 0.25rem 0.08rem;
}

.math-article .frac .den {
  padding-top: 0.08rem;
}

.snapshot-button {
  border: 1px solid #d5b899;
  background: var(--accent-soft);
  color: #5f3d25;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.snapshot-button:hover,
.snapshot-button:focus-visible {
  background: #ecd4bc;
  color: #4d2f1a;
}

.snapshot-figure {
  margin: 0.8rem 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  padding: 0.55rem;
}

.snapshot-figure img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.snapshot-figure figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.wildlife-intro {
  margin-bottom: 1.1rem;
}

.specs-card,
.random-toggle-card,
.books-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff9f0;
  padding: 0.8rem;
}

.specs-card h3 {
  margin-top: 0;
}

.random-toggle-card {
  margin-top: 0.8rem;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#random-panel {
  margin-top: 0.2rem;
}

.random-toggle-card .snapshot-figure {
  margin-top: 0;
}

.books-note {
  margin: 0;
  color: var(--muted);
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.book-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffefb;
  padding: 0.6rem;
}

.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center;
  background: #f6efe3;
  border: 1px solid #d9d0c3;
  border-radius: 8px;
  display: block;
}

.book-item h3 {
  margin: 0.55rem 0 0.25rem;
  font-size: 0.98rem;
}

.book-author {
  margin: 0 0 0.25rem;
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: 0.92rem;
  color: #6c5946;
}

.book-item p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .gallery-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }
}
