:root {
  --paper: #ebe7dd;
  --ink: #1c1b17;
  --muted: #5f5847;
  --line: #b8b09b;
  --accent: #9a3324;
}

html[data-theme="dark"] {
  --paper: #121110;
  --ink: #f2ede0;
  --muted: #b0a891;
  --line: #4a453a;
  --accent: #e37a4c;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  line-height: 1.7;
  transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle {
  position: fixed;
  top: 28px;
  right: 28px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

.theme-toggle .moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .moon {
  display: block;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 96px 24px 120px;
}

.back {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 48px;
}

.back:hover {
  color: var(--accent);
}

.avatar {
  width: 56px;
  height: 56px;
  margin-bottom: 40px;
  border-radius: 50%;
  display: block;
}

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(1.6rem, 4vw, 2rem);
  margin: 0 0 36px;
}

p {
  margin: 0 0 22px;
  max-width: 58ch;
}

.lede {
  font-size: 1.05rem;
  color: var(--ink);
}

a {
  color: var(--ink);
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

a.nav-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  font-weight: 700;
}

nav.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 36px 0 8px;
}

nav.links a {
  font-size: 0.95rem;
}

.tag {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 32px;
}

.writing-year {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  color: var(--muted);
  margin: 28px 0 10px;
}

.writing-year:first-child {
  margin-top: 0;
}

.writing-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.writing-list a {
  font-size: 0.95rem;
}

.project {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.project-text {
  min-width: 0;
}

.project > .project-text > a.title,
.project a.title {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 500;
}

.project p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-links {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.82rem;
}

.status-badge {
  display: inline-block;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.flyer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.flyer {
  border: 1px dashed var(--line);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.flyer img {
  width: 100%;
  height: auto;
  display: block;
}

.project-media {
  width: 100%;
}

.project-media .media-slot {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
}

.media-slot video {
  width: 80%;
  height: 80%;
  object-fit: cover;
}

@media (max-width: 480px) {
  .project-media .media-slot {
    aspect-ratio: 4 / 3;
  }
}

.identity-list {
  border-top: 1px solid var(--line);
}

.identity {
  border-bottom: 1px solid var(--line);
}

.identity-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  background: none;
  border: none;
  color: var(--ink);
  font-family: 'Space Mono', monospace;
  text-align: left;
  cursor: pointer;
}



.identity-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.identity-name {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
}

.identity-note {
  font-size: 0.85rem;
  color: var(--muted);
}

.identity-plus {
  flex-shrink: 0;
  font-size: 1.3rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.identity.open .identity-plus {
  transform: rotate(45deg);
  color: var(--accent);
}

.identity-panel {
  padding: 0 0 28px 74px;
}

.identity-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.identity-detail {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-box {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line);
  overflow: hidden;
}

.detail-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  .identity-detail-grid {
    grid-template-columns: 1fr;
  }
  .identity-panel {
    padding-left: 0;
  }
}

.library-loading {
  color: var(--muted);
  font-size: 0.9rem;
}

.reads {
  list-style: none;
  padding: 0;
  margin: 0;
}

.reads li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.reads li:last-child {
  border-bottom: none;
}

.reads .who {
  color: var(--muted);
  white-space: nowrap;
}

.prompt {
  margin-top: 6px;
}

.prompt label {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.prompt input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  color: var(--ink);
  padding: 6px 0 10px;
}

.prompt input:focus {
  border-bottom-color: var(--accent);
}

.prompt .count {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 8px;
}

.prompt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.prompt-row input {
  border-bottom: none;
  flex: 1;
}

.send-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
}

.send-btn:hover {
  color: var(--accent);
}

.section-tag {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 72px 0 18px;
}

footer {
  margin-top: 80px;
  font-size: 0.85rem;
  color: var(--muted);
}

footer a {
  color: var(--muted);
}

body.home h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

body.home .lede {
  font-size: 0.92rem;
}

body.home .prompt label {
  font-size: 0.85rem;
}

body.home .prompt input {
  font-size: 1.05rem;
}

body.home footer {
  font-size: 0.78rem;
}

@media (max-width: 480px) {
  .wrap {
    padding: 64px 20px 90px;
  }
  .section-tag {
    margin: 56px 0 16px;
  }
}