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

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #202020;
  --link-blue: #2f39ff;
  --serif: Georgia, "Times New Roman", Times, "Apple SD Gothic Neo", serif;
  --sans: Arial, Helvetica, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --page-w: 1120px;
}

html { font-size: 16px; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.5;
}

a { color: inherit; }

nav {
  width: min(var(--page-w), calc(100% - 8rem));
  margin: 42px auto 0;
  padding: 0 6rem 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  text-align: center;
}

nav a {
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

nav a:hover,
nav a.active {
  text-decoration: underline;
  text-underline-offset: 5px;
}

nav a:hover { color: var(--link-blue); }

main {
  width: min(var(--page-w), calc(100% - 8rem));
  margin: 0 auto;
  padding: 0 0 66px;
}

.page { display: none; }
.page.active { display: block; }

.name-header {
  text-align: center;
  padding: 115px 0 0;
}

.home-name {
  font-family: var(--sans);
  font-size: clamp(4.7rem, 8.2vw, 7.3rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.92;
}

.phonetic {
  margin-top: 0.55rem;
  font-family: var(--sans);
  font-size: clamp(1.65rem, 2.8vw, 2.3rem);
  font-weight: 800;
  line-height: 1;
}

.home-collage {
  position: relative;
  width: min(860px, 100%);
  height: 420px;
  margin: 54px auto 66px;
}

.thought-link,
.academics-link {
  position: absolute;
  display: block;
  color: var(--text);
  text-decoration: none;
}

.thought-link {
  left: 5%;
  top: 0%;
  width: 225px;
  height: 164px;
  z-index: 2;
}

.thought-link img,
.academics-link img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.thought-link span {
  position: absolute;
  left: 19px;
  top: 54px;
  font-family: var(--serif);
  font-size: 1.92rem;
  line-height: 1;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.thought-link:hover span,
.academics-link:hover span {
  color: var(--link-blue);
}

.cat-drawing {
  position: absolute;
  left: 286px;
  top: 0;
  width: 314px;
  height: auto;
  z-index: 1;
}

.academics-link {
  right: 5px;
  top: 222px;
  width: 315px;
  height: 181px;
  z-index: 3;
}

.academics-link span {
  position: absolute;
  left: 82px;
  top: 82px;
  font-family: var(--serif);
  font-size: 2.05rem;
  line-height: 1;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  white-space: nowrap;
}

.link-row {
  position: absolute;
  left: 50%;
  top: 316px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  width: 270px;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  color: var(--link-blue);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.15;
  text-align: center;
}

.link-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  color: var(--link-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.link-row a:hover { color: #0000cc; }

.link-row svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
  flex: 0 0 auto;
}

.intro-text {
  width: min(1060px, 100%);
  margin: 0 auto;
  color: #222222;
  font-family: var(--mono);
  font-size: 1.02rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.48;
  text-align: center;
}

.intro-text p + p { margin-top: 1.7rem; }

.intro-emphasis {
  color: var(--text);
  font-family: var(--serif);
  font-style: italic;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.intro-emphasis:hover { color: var(--link-blue); }

.section {
  width: min(1000px, 100%);
  margin: 3rem auto 0;
}

.section:first-of-type { margin-top: 4.5rem; }

.section,
.section-label,
.entry-list,
.entry-main,
.entry-sub {
  font-family: "Source Serif 4", Georgia, "Times New Roman", Times, "Apple SD Gothic Neo", serif;
  font-optical-sizing: auto;
}

.section-label {
  margin-bottom: 0.55rem;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.15;
}

.entry-list {
  list-style: none;
  padding-left: 1.35rem;
}

.entry-list li + li { margin-top: 0.12rem; }

.entry-main {
  font-size: 1.22rem;
  font-weight: 400;
  line-height: 1.22;
}

.entry-sub {
  margin-top: 0.2rem;
  margin-left: 1.25rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.25;
}

.entry-year { display: none; }

.placeholder-page {
  min-height: 58vh;
  padding-top: 160px;
  text-align: center;
}

.placeholder-page p {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 400;
}

footer {
  width: min(var(--page-w), calc(100% - 8rem));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 20px 0 54px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 400;
  text-align: center;
}

/* Projects tab retained for older links. */
.projects-intro {
  padding-top: 100px;
  margin-bottom: 2.8rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 0.95rem;
  font-style: italic;
}

.project-group + .project-group {
  margin-top: 2.8rem;
  padding-top: 2.4rem;
  border-top: 1px solid #e8e8e8;
}

.project-group-label {
  margin-bottom: 1.3rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-item {
  padding: 1rem 0;
  border-bottom: 1px solid #e8e8e8;
}

.project-item:last-child { border-bottom: none; }

.project-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.project-title,
.project-desc {
  font-family: var(--serif);
}

.project-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.project-title a {
  text-decoration: none;
  border-bottom: 1px solid #bbbbbb;
}

.project-year,
.tag {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.project-desc {
  margin-top: 0.35rem;
  color: #444444;
  font-size: 0.96rem;
  line-height: 1.55;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.tag {
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  padding: 0.1rem 0.42rem;
}

/* Project detail pages. */
.detail-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 88px 2rem 100px;
}

.back-link {
  display: inline-flex;
  gap: 0.35rem;
  margin-bottom: 2.4rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.detail-date,
.detail-h2,
.bookmark-url {
  color: var(--muted);
  font-family: var(--mono);
}

.detail-date { font-size: 0.68rem; }

.detail-title {
  margin-bottom: 2rem;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.2;
}

.detail-divider {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 1.8rem 0;
}

.detail-h2 {
  margin: 1.8rem 0 0.8rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-p {
  margin-bottom: 0.9rem;
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.72;
}

.detail-img {
  display: block;
  width: 100%;
  max-width: 600px;
  margin: 1.2rem auto;
  border-radius: 2px;
}

.bookmark {
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
  text-decoration: none;
}

.bookmark-title {
  margin-bottom: 0.15rem;
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 700;
}

.bookmark-url { font-size: 0.65rem; }

.video-wrapper {
  position: relative;
  height: 0;
  margin: 1.2rem 0;
  overflow: hidden;
  padding-bottom: 56.25%;
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

@media (max-width: 760px) {
  nav,
  main,
  footer {
    width: min(100% - 2rem, var(--page-w));
  }

  nav {
    margin-top: 24px;
    padding: 0 0 14px;
    gap: 0.35rem;
  }

  nav a { font-size: clamp(0.78rem, 3.3vw, 1rem); }

  .name-header { padding-top: 70px; }

  .home-name { font-size: clamp(3.2rem, 16vw, 5rem); }
  .phonetic { font-size: clamp(1.15rem, 5vw, 1.7rem); }

  .home-collage {
    width: min(420px, 100%);
    height: 470px;
    margin: 36px auto 46px;
  }

  .thought-link {
    left: 18px;
    top: 18px;
    width: 164px;
  }

  .thought-link span {
    left: 13px;
    top: 39px;
    font-size: 1.42rem;
  }

  .cat-drawing {
    left: 50%;
    top: 10%;
    width: 258px;
    transform: translateX(-50%);
  }

  .academics-link {
    left: 50%;
    right: auto;
    top: 255px;
    width: 236px;
    transform: translateX(-50%);
  }

  .academics-link span {
    left: 60px;
    top: 61px;
    font-size: 1.52rem;
  }

  .link-row {
    top: 400px;
    width: 230px;
    font-size: 0.72rem;
  }

  .intro-text {
    font-size: 0.86rem;
    line-height: 1.55;
  }

  .section,
  .section:first-of-type {
    margin-top: 2.6rem;
  }

  .section-label { font-size: 1.35rem; }
  .entry-list { padding-left: 0.85rem; }
  .entry-main { font-size: 1.04rem; }
  .entry-sub { font-size: 0.88rem; }

  .project-header { flex-direction: column; gap: 0.12rem; }
}

@media (max-width: 390px) {
  .home-collage { height: 440px; }
  .thought-link { width: 150px; }
  .thought-link span { font-size: 1.28rem; }
  .cat-drawing { width: 235px; }
  .academics-link { top: 235px; width: 218px; }
  .academics-link span {
    left: 55px;
    top: 56px;
    font-size: 1.42rem;
  }

  .link-row { top: 348px; }
}
