/* Hero */
.hero-top {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.hero-id {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  padding: 28px 24px;
  border-right: 1px solid var(--line);
}

.avatar {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg-soft);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-name h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
}

.asterisk {
  display: inline-block;
  margin-left: 6px;
  font-size: 14px;
  color: var(--muted);
  vertical-align: 0.55em;
}

.hero-role {
  margin-top: 4px;
  font: 12px/1.6 var(--font-mono);
  color: var(--muted);
}

.wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 28px 24px 12px;
}

.wordmark img {
  width: 100%;
  height: auto;
}

.wordmark figcaption {
  align-self: flex-end;
  margin-top: 4px;
  font: 10px var(--font-mono);
  color: var(--faint);
}

/* Social + meta */
.social-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
}

.icon-btn {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--bg-soft);
  color: var(--ink);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.email-widget {
  display: flex;
  align-items: center;
  min-width: 0;
}

.email-reveal {
  max-width: 0;
  margin-left: 0;
  overflow: hidden;
  font: 12px var(--font-mono);
  color: var(--ink);
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  transition: max-width 240ms ease, margin-left 240ms ease, opacity 200ms ease;
}

.email-widget.is-open .email-reveal {
  max-width: min(220px, 46vw);
  margin-left: 10px;
  opacity: 1;
}

.email-reveal.is-empty {
  color: var(--faint);
}

.email-reveal[href] {
  border-bottom: 1px solid var(--line-strong);
}

.meta-grid {
  border-top: 1px solid var(--line);
}

.meta-cell {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 24px;
  font: 12px var(--font-mono);
}

.meta-key {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.meta-value {
  color: var(--ink);
}

.meta-note {
  color: var(--faint);
}

/* GitHub contributions */
.contrib {
  padding: 18px 24px 20px;
  border-top: 1px solid var(--line);
}

.contrib-scroll {
  overflow-x: auto;
  scrollbar-width: none;
}

.contrib-scroll::-webkit-scrollbar {
  display: none;
}

.contrib-months {
  display: flex;
  justify-content: space-between;
  min-width: 740px;
  margin-bottom: 8px;
  font: 10px var(--font-mono);
  color: var(--faint);
}

.contrib-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px;
  justify-content: space-between;
  min-width: 740px;
  gap: 2px;
  padding-bottom: 2px;
}

.contrib-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--level-0);
}

.level-1 {
  background: var(--level-1);
}

.level-2 {
  background: var(--level-2);
}

.level-3 {
  background: var(--level-3);
}

.level-4 {
  background: var(--level-4);
}

.figure-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font: 11px var(--font-mono);
  color: var(--muted);
}

.figure-caption a {
  border-bottom: 1px dotted var(--line-strong);
}

.contrib-legend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  color: var(--faint);
}

.contrib-legend .contrib-cell {
  display: inline-block;
  width: 10px;
  height: 10px;
}

/* About */
.about {
  padding: 28px 32px 36px;
}

.about-greeting {
  margin-bottom: 16px;
  font-size: 30px;
  line-height: 1.2;
  color: var(--ink);
  transform: rotate(-1deg);
}

.about-copy p {
  max-width: 650px;
  font-size: 15px;
  line-height: 1.9;
}

.about-copy p + p {
  margin-top: 12px;
}

.reading-link {
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.reading-link:hover,
.reading-link:focus-visible {
  text-decoration-color: currentColor;
}

/* Section heading */
.section-head {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 26px 32px 14px;
}

.section-head h2 {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.section-count {
  margin-top: 4px;
  font: 11px var(--font-mono);
  color: var(--faint);
}

.section-link {
  align-self: center;
  margin-inline-start: auto;
  font-size: 13px;
}

/* Stack */
.stack-row {
  display: grid;
  grid-template-columns: 40px 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 13px 32px;
  border-top: 1px solid var(--line);
}

.stack-index {
  font: 10px var(--font-mono);
  color: var(--faint);
}

.stack-label {
  font-size: 13px;
  color: var(--muted);
}

.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  font: 11px var(--font-mono);
  color: var(--ink);
}

.stack-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

/* Projects */
.project-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px 32px;
  border-top: 1px solid var(--line);
  transition: background-color var(--transition);
}

.project-row:hover {
  background: var(--bg-soft);
}

.project-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
}

.project-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  opacity: 0.8;
  transition: filter 420ms ease, opacity 420ms ease;
}

.project-row:hover .project-icon img {
  filter: grayscale(0);
  opacity: 1;
}

.project-icon .mark {
  font: 500 10px var(--font-mono);
  color: var(--muted);
}

.project-body,
.project-head,
.project-desc,
.project-tech {
  display: block;
}

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.project-name {
  font-size: 15px;
  font-weight: 500;
}

.project-subtitle {
  font: 10px var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--faint);
  text-transform: uppercase;
}

.project-desc {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.project-tech {
  margin-top: 6px;
  font: 10px var(--font-mono);
  color: var(--faint);
}

.project-actions {
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.project-link {
  font: 11px var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
}

.project-link:hover,
.project-link:focus-visible {
  color: var(--ink);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.footer-cell {
  min-height: 62px;
  padding: 12px 16px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.footer-cell:nth-child(4n) {
  border-right: 0;
}

.footer-label {
  display: block;
  margin-bottom: 3px;
  font: 9px var(--font-mono);
  letter-spacing: 0.1em;
  color: var(--faint);
}

.footer-value {
  font: 11px var(--font-mono);
  color: var(--ink);
}

.footer-value[href] {
  border-bottom: 1px dotted var(--line-strong);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.footer-bottom img {
  width: 20px;
  height: 20px;
}

.footer-bottom a {
  font: 11px var(--font-mono);
  color: var(--muted);
}

@media (max-width: 760px) {
  .hero-top {
    grid-template-columns: 1fr;
  }

  .wordmark {
    order: -1;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--line);
  }

  .hero-id {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    border-right: 0;
  }

  .avatar {
    flex: 0 0 auto;
    width: 112px;
    aspect-ratio: 1;
    border-radius: 50%;
  }

  .hero-name h1 {
    font-size: 22px;
  }

  .social-row,
  .meta-cell,
  .contrib,
  .about,
  .section-head,
  .stack-row,
  .project-row,
  .footer-bottom {
    padding-right: 16px;
    padding-left: 16px;
  }

  .contrib-months {
    font-size: 9px;
  }

  .about-copy p {
    font-size: 14px;
  }

  .stack-row {
    grid-template-columns: 28px 72px minmax(0, 1fr);
    gap: 8px;
  }

  .project-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .project-icon {
    width: 34px;
    height: 34px;
  }

  .project-actions {
    grid-column: 2;
    justify-self: start;
    margin-top: 2px;
  }

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

  .footer-cell:nth-child(4n) {
    border-right: 1px solid var(--line);
  }

  .footer-cell:nth-child(2n) {
    border-right: 0;
  }
}
