/* components.css — reusable patterns: page intro, project entries,
   thumbnails, metadata, expandable prose, writing list, back-to-top.
   No page-specific rules; no breakpoints (see responsive.css). */

main {
  padding-top: 3.5rem;
}

/* Profile: small avatar beside the name, nothing more. */
.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
}

.profile h1 {
  margin: 0;
}

.profile img {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--border);
  flex-shrink: 0;
}

/* Small mono kicker above page titles (year, section label). */
.kicker {
  font-family: var(--mono);
  font-size: var(--small);
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.lede {
  color: var(--muted);
  max-width: 34rem;
}

/* "Now" block on the homepage: three quiet rows. */
.now {
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
}

.now li {
  display: flex;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}

.now li:last-child {
  border-bottom: 1px solid var(--border);
}

.now-key {
  font-family: var(--mono);
  font-size: var(--small);
  color: var(--muted);
  min-width: 7.5rem;
  padding-top: 0.3rem;
}

/* Project entry: image, then title row, description, metadata.
   Deliberately no card border, no shadow, no container. */
.project {
  margin: 3rem 0 0;
}

.project-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}

.project-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0 0.25rem;
}

.project-title-row h2,
.project-title-row h3 {
  margin: 0;
  font-size: 1.25rem;
  transition: color var(--hover-ms) var(--ease);
}

.project-link:hover .project-title-row h2,
.project-link:hover .project-title-row h3 {
  text-decoration: underline;
  text-decoration-color: var(--fg);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* Scroll reveals: subtle, one-way, staggered within groups.
   The hidden state only applies when JS runs (html.js), so all
   content stays visible with JS disabled or if IO is missing. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.js [data-reveal].revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.project-desc {
  margin: 0 0 0.5rem;
  color: var(--fg);
}

.project-meta {
  font-family: var(--mono);
  font-size: var(--small);
  color: var(--muted);
  margin: 0;
}

/* Year group on the projects index. */
.year-group {
  margin-top: 3rem;
}

.year-group > h2 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0;
  color: var(--muted);
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Inline expandable prose: a footnote you discover, not a widget. */
.expand {
  display: inline;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: var(--muted);
  text-underline-offset: 3px;
}

.expand:hover {
  text-decoration-color: var(--fg);
}

.expand .arrow {
  font-style: normal;
  color: var(--muted);
}

.expand[aria-expanded="true"] .arrow {
  transform: rotate(90deg);
}

.expandable-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: grid-template-rows 320ms var(--ease),
    opacity 280ms var(--ease),
    visibility 0s linear 320ms,
    margin 320ms var(--ease),
    padding 320ms var(--ease);
}

/* Author styles beat the UA [hidden] rule once display is set. */
.expandable-panel[hidden] {
  display: none;
}

.expandable-panel.open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  margin: 0.75rem 0 1.25rem;
  padding: 1rem 1.25rem;
  transition: grid-template-rows 320ms var(--ease),
    opacity 320ms var(--ease),
    visibility 0s,
    margin 320ms var(--ease),
    padding 320ms var(--ease);
}

.expandable-inner {
  overflow: hidden;
  min-height: 0;
}

.expandable-panel p:last-child {
  margin-bottom: 0;
}

/* Writing index: chronological list, titles only. */
.note-list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.note-list li {
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
}

.note-list li:last-child {
  border-bottom: 1px solid var(--border);
}

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

.note-row time {
  font-family: var(--mono);
  font-size: var(--small);
  color: var(--muted);
  white-space: nowrap;
}

.note-status {
  font-family: var(--mono);
  font-size: var(--small);
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.6rem;
  white-space: nowrap;
}

/* Project detail page furniture. */
.detail-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 2rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  margin-top: 3rem;
  font-size: var(--meta);
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Back-to-top: hidden until scrolled, quiet when visible. */
.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity var(--hover-ms) var(--ease),
    transform var(--hover-ms) var(--ease),
    visibility var(--hover-ms),
    color var(--hover-ms) var(--ease);
}

.to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--fg);
}
