/*
 * al-folio baseline homepage enhancement
 *
 * The whole site should look like upstream al-folio by default. This single
 * homepage-only layer widens the native about-page shell and adds lightweight
 * content modules inside the original .post / article / clearfix flow. It does
 * not restyle Blog, Projects, Repositories, CV, or secondary pages.
 */

:root {
  --hao-alfolio-shell-max: 72rem;
  --hao-alfolio-gutter: clamp(1rem, 4vw, 2rem);
  --hao-alfolio-shell: min(calc(100% - var(--hao-alfolio-gutter) - var(--hao-alfolio-gutter)), var(--hao-alfolio-shell-max));
  --hao-home-ink: var(--global-text-color, #111827);
  --hao-home-muted: var(--global-text-color-light, #6b7280);
  --hao-home-accent: var(--global-theme-color, #b80fb8);
  --hao-home-line: var(--global-divider-color, #e5e7eb);
  --hao-home-card-bg: var(--global-bg-color, #ffffff);
  --hao-home-soft: color-mix(in srgb, var(--hao-home-accent) 5%, var(--global-bg-color, #ffffff));
}

html:has(.hao-home--alfolio),
body:has(.hao-home--alfolio) {
  overflow-x: clip;
}

/* Shared al-folio shell: navbar and homepage content use the same edge. */
body:has(.hao-home--alfolio) main > .container,
body:has(.hao-home--alfolio) .navbar > .container {
  box-sizing: border-box !important;
  width: var(--hao-alfolio-shell) !important;
  max-width: var(--hao-alfolio-shell-max) !important;
  margin-right: auto !important;
  margin-left: auto !important;
}

body:has(.hao-home--alfolio) .post,
body:has(.hao-home--alfolio) article,
body:has(.hao-home--alfolio) article > .clearfix,
.hao-home--alfolio,
.hao-home-intro,
.hao-home-index,
.hao-home-section,
.hao-home-contact {
  width: 100%;
  max-width: none;
}

body:has(.hao-home--alfolio) .post {
  max-width: none;
}

/* Keep the native al-folio about-page surface visible. */
body:has(.hao-home--alfolio) .post > header,
body:has(.hao-home--alfolio) .post-header,
body:has(.hao-home--alfolio) .post-title,
body:has(.hao-home--alfolio) .post-description,
body:has(.hao-home--alfolio) .profile {
  display: revert !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body:has(.hao-home--alfolio) .post-header {
  margin-bottom: 1.75rem;
}

body:has(.hao-home--alfolio) .desc {
  max-width: 42rem;
}

/* Homepage brand: same semantic class stack as the upstream al-folio header. */
body:has(.hao-home--alfolio) .hao-home-navbar-brand {
  display: inline-block !important;
  text-decoration: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body:has(.hao-home--alfolio) .hao-home-navbar-brand::before,
body:has(.hao-home--alfolio) .hao-home-navbar-brand::after {
  content: none !important;
}

.hao-home--alfolio {
  clear: both;
  margin-top: 1.25rem;
}

.hao-home--alfolio *,
.hao-home--alfolio *::before,
.hao-home--alfolio *::after {
  box-sizing: border-box;
}

.hao-home-intro {
  display: grid;
  grid-template-columns: minmax(11rem, 0.28fr) minmax(0, 1fr);
  gap: clamp(1.2rem, 3.4vw, 2.6rem);
  align-items: start;
  margin: 0 0 2.25rem;
}

.hao-home-intro .hao-home-eyebrow {
  grid-column: 1;
}

.hao-home-intro h2,
.hao-home-intro p:not(.hao-home-eyebrow),
.hao-home-intro .hao-home-actions {
  grid-column: 2;
}

.hao-home-eyebrow,
.hao-home-card-label {
  margin: 0 0 0.45rem;
  color: var(--hao-home-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
}

.hao-home-intro h2 {
  max-width: 16em;
  margin: 0;
  color: var(--hao-home-ink);
  font-size: clamp(1.85rem, 3.6vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.hao-home-intro p:not(.hao-home-eyebrow) {
  max-width: 48rem;
  margin: 0.9rem 0 0;
  color: var(--hao-home-muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.hao-home-actions,
.hao-home-links,
.hao-home-contact-links,
.hao-home-archive-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.hao-home-actions {
  margin-top: 1.15rem;
}

.hao-home-button,
.hao-home-contact-links a,
.hao-home-archive-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  border: 1px solid var(--hao-home-line);
  border-radius: 999px;
  padding: 0.58rem 0.82rem;
  background: var(--hao-home-card-bg);
  color: var(--hao-home-ink) !important;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none !important;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.hao-home-button:hover,
.hao-home-button:focus-visible,
.hao-home-contact-links a:hover,
.hao-home-contact-links a:focus-visible,
.hao-home-archive-links a:hover,
.hao-home-archive-links a:focus-visible {
  border-color: color-mix(in srgb, var(--hao-home-accent) 45%, var(--hao-home-line));
  background: var(--hao-home-soft);
  color: var(--hao-home-accent) !important;
}

.hao-home-button--primary {
  border-color: color-mix(in srgb, var(--hao-home-accent) 55%, var(--hao-home-line));
  background: var(--hao-home-soft);
  color: var(--hao-home-accent) !important;
}

.hao-home-index {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  align-items: center;
  margin: 2rem 0 0;
  padding: 0.85rem 0;
  border-top: 1px solid var(--hao-home-line);
  border-bottom: 1px solid var(--hao-home-line);
}

.hao-home-index a {
  color: var(--hao-home-muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.hao-home-index a:hover,
.hao-home-index a:focus-visible {
  color: var(--hao-home-accent);
  text-decoration: none;
}

.hao-home-section,
.hao-home-contact {
  clear: both;
  display: grid;
  grid-template-columns: minmax(11rem, 0.28fr) minmax(0, 1fr);
  gap: clamp(1.2rem, 3.4vw, 2.6rem);
  padding: clamp(2rem, 4.5vw, 3.4rem) 0;
  border-bottom: 1px solid var(--hao-home-line);
  scroll-margin-top: 5rem;
}

.hao-home-section > :last-child,
.hao-home-contact > :last-child {
  min-width: 0;
}

.hao-home-section-header h2,
.hao-home-contact h2 {
  margin: 0;
  color: var(--hao-home-ink);
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.hao-home-section-header p:not(.hao-home-eyebrow) {
  margin: 0.72rem 0 0;
  color: var(--hao-home-muted);
  font-size: 0.94rem;
  line-height: 1.62;
}

.hao-home-card-grid,
.hao-home-system-grid,
.hao-home-knowledge-grid,
.hao-home-timeline {
  width: 100%;
  display: grid;
  gap: 0.9rem;
}

.hao-home-card-grid,
.hao-home-system-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hao-home-card,
.hao-home-record,
.hao-home-note,
.hao-home-timeline-item,
.hao-home-knowledge-panel {
  border: 1px solid var(--hao-home-line);
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--hao-home-card-bg);
}

.hao-home-card:hover,
.hao-home-record:hover,
.hao-home-note:hover,
.hao-home-timeline-item:hover,
.hao-home-knowledge-panel:hover {
  border-color: color-mix(in srgb, var(--hao-home-accent) 35%, var(--hao-home-line));
}

.hao-home-card-topline {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  color: var(--hao-home-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.hao-home-card-topline span,
.hao-home-card-topline strong {
  font-weight: 650;
}

.hao-home-card h3,
.hao-home-card h4,
.hao-home-record h4,
.hao-home-note h4,
.hao-home-timeline-item h3,
.hao-home-knowledge-panel h3 {
  margin: 0;
  color: var(--hao-home-ink);
  font-size: 1.03rem;
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hao-home-card p,
.hao-home-record p,
.hao-home-note p,
.hao-home-timeline-item p,
.hao-home-knowledge-panel > p {
  margin: 0.55rem 0 0;
  color: var(--hao-home-muted);
  font-size: 0.92rem;
  line-height: 1.58;
}

.hao-home-kind {
  color: var(--hao-home-accent) !important;
  font-size: 0.78rem !important;
  font-weight: 650;
}

.hao-home-text-link {
  display: inline-flex;
  margin-top: 0.75rem;
  color: var(--hao-home-accent) !important;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none !important;
}

.hao-home-text-link:hover,
.hao-home-text-link:focus-visible {
  text-decoration: underline !important;
}

.hao-home-system-group + .hao-home-system-group,
.hao-home-record + .hao-home-record,
.hao-home-note + .hao-home-note {
  margin-top: 0.9rem;
}

.hao-home-system-group-intro {
  margin-bottom: 0.8rem;
}

.hao-home-system-group-intro h3 {
  margin: 0;
  color: var(--hao-home-ink);
  font-size: 1.15rem;
  font-weight: 540;
  letter-spacing: -0.025em;
}

.hao-home-system-group-intro p:not(.hao-home-card-label) {
  margin: 0.45rem 0 0;
  color: var(--hao-home-muted);
  font-size: 0.92rem;
  line-height: 1.58;
}

.hao-home-knowledge-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.hao-home-panel-heading {
  margin-bottom: 0.85rem;
}

.hao-home-contact {
  border-bottom: 0;
}

.hao-home-contact-links {
  align-content: start;
}

@media (max-width: 992px) {
  :root {
    --hao-alfolio-shell-max: 64rem;
    --hao-alfolio-gutter: clamp(0.9rem, 3.5vw, 1.5rem);
  }

  .hao-home-intro,
  .hao-home-section,
  .hao-home-contact {
    grid-template-columns: 1fr;
  }

  .hao-home-intro .hao-home-eyebrow,
  .hao-home-intro h2,
  .hao-home-intro p:not(.hao-home-eyebrow),
  .hao-home-intro .hao-home-actions {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  body:has(.hao-home--alfolio) main > .container,
  body:has(.hao-home--alfolio) .navbar > .container {
    width: min(calc(100% - 1.25rem), 64rem) !important;
  }

  .hao-home-card-grid,
  .hao-home-system-grid,
  .hao-home-knowledge-grid,
  .hao-home-timeline {
    grid-template-columns: 1fr;
  }

  .hao-home-intro h2 {
    font-size: clamp(1.7rem, 8vw, 2.45rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hao-home--alfolio *,
  .hao-home--alfolio *::before,
  .hao-home--alfolio *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
