/* ==========================================================================
   Home page — Hero (full-screen) + scroll-revealed sections
   ========================================================================== */

/* === Scroll-reveal base === */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

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

/* === Hero ===
   Eat the top padding inserted by .site-main, occupy the rest of the viewport.
   Layout: flex column so hero-inner sits near the top, optional pinned block
   below it, and the scroll cue gets pushed to the bottom with margin-top: auto. */
.home-hero {
  position: relative;
  margin-top: -2rem;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1.5rem 2.5rem;
  overflow: hidden;
}

.home-hero-inner {
  width: 100%;
  max-width: var(--container-width, 850px);
  margin-top: clamp(3.5rem, 9vh, 7rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Round portrait at the very top */
.hero-avatar {
  width: clamp(77px, 9.6vw, 102px);
  height: clamp(77px, 9.6vw, 102px);
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px var(--neon-glow), 0 18px 36px -18px var(--neon-glow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.hero-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* small all-caps mono line above the name */
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.6rem;
  text-transform: lowercase;
}

/* Name — readable display weight, no longer the wall-of-text gradient */
.hero-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.7rem;
  color: var(--text);
}

/* Tagline under the name */
.hero-tagline {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  line-height: 1.65;
  color: var(--mid);
  max-width: 560px;
  margin: 0 0 1.6rem;
}

/* Action row — mono chips with a sliding arrow */
.hero-actions {
  display: flex;
  gap: 0.6rem 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-action {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--text);
  padding: 0.55em 1em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-1) 65%, transparent);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.hero-action:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow: 0 0 0 1px var(--neon-glow), 0 10px 28px -10px var(--neon-glow);
  transform: translateY(-2px);
}

.hero-action-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}
.hero-action:hover .hero-action-arrow {
  transform: translateX(3px);
}

/* Scroll cue at the bottom of the hero — margin-top: auto pushes it down */
.hero-scroll-cue {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--mid);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.5rem 1rem 0.2rem;
  transition: color 0.2s ease;
}

.hero-scroll-cue:hover { color: var(--accent); }

.hero-scroll-line {
  width: 1px;
  height: 42px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  position: relative;
  overflow: hidden;
}

.hero-scroll-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--accent-2), transparent);
  animation: scroll-cue 1.8s ease-in-out infinite;
}

@keyframes scroll-cue {
  0%   { transform: translateY(-100%); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}

/* ==========================================================================
   Pinned posts block — reused by home (inside .home-hero) and archive list.
   Hidden entirely when no posts have `pinned: true` (the partial omits the
   whole <section> when the list is empty).
   ========================================================================== */
.pinned-block {
  width: 100%;
  max-width: var(--container-width, 850px);
  margin: 3.5rem auto 0;
}

.pinned-block-head {
  margin-bottom: 0.6rem;
}

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

/* Sword icon shown before the pinned post title */
.post-item-pin {
  display: inline-flex;
  align-items: center;
  margin-right: 0.5em;
  color: var(--accent);
  transform: translateY(1px);
  filter: drop-shadow(0 0 6px var(--neon-glow));
  transition: filter 0.3s ease, color 0.3s ease;
}

.post-item-pin .icon-sword {
  display: block;
}

/* Archive: pinned block sits between list-header and tag filter / year stream */
.archive .pinned-block {
  margin-top: 0;
  margin-bottom: 2rem;
}

/* Pinned-list row layout: date / title / meta */
.pinned-list .post-item-link {
  grid-template-columns: 92px 1fr auto;
}

@media (max-width: 720px) {
  .pinned-list .post-item-link {
    grid-template-columns: 72px 1fr;
  }
  .pinned-list .post-item-meta { display: none; }
}

/* ==========================================================================
   Recent posts (second screen)
   ========================================================================== */
.home-recent {
  padding: 5rem 0 3rem;
  scroll-margin-top: 80px;
}

.section-head {
  margin-bottom: 2rem;
}

.section-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
}

/* Post list (also reused by archive — see post.css for tweaks) */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.6rem;
}

.post-item {
  border-bottom: 1px dashed var(--line);
  transition: border-color 0.3s ease;
}

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

.post-item-link {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  align-items: baseline;
  gap: 1.2rem;
  padding: 0.95rem 0.5rem 0.95rem 0;
  color: var(--text);
  font-family: var(--font-body);
  transition:
    color 0.2s ease,
    padding 0.2s ease,
    background-color 0.2s ease;
}

/* Middle column: title with optional tags stacked beneath it (left-aligned) */
.post-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

/* Tags as a left-aligned second row beneath the title (shared by all lists) */
.post-item-tags {
  display: flex;
  flex-wrap: wrap;
  align-self: flex-start;
  gap: 0.35rem;
}

/* Right-aligned meta cluster (views / arrow) — pinned to the right edge */
.post-item-meta {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 0.7rem;
}

.post-item-link:hover {
  padding-left: 0.8rem;
  background: linear-gradient(90deg,
              color-mix(in srgb, var(--accent) 6%, transparent) 0%,
              transparent 70%);
}

.post-item-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--mid);
  letter-spacing: 0.04em;
}

.post-item-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.post-item-link:hover .post-item-title { color: var(--accent); }

/* Tag chips light up on row hover — shared across home / pinned / archive lists */
.post-item-link:hover .chip {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
}

.post-item-arrow {
  font-family: var(--font-mono);
  color: var(--mid);
  transition: transform 0.2s ease, color 0.2s ease;
  opacity: 0;
}

.post-item-link:hover .post-item-arrow {
  opacity: 1;
  color: var(--accent);
  transform: translateX(4px);
}

.section-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--mid);
  padding: 0.35em 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.section-more:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   Small screens
   ========================================================================== */
@media (max-width: 640px) {
  .home-hero { padding: 3rem 1.2rem 2rem; }
  .home-hero-inner { padding: 0; }
  .post-item-link {
    grid-template-columns: 84px 1fr;
    gap: 0.9rem;
    padding: 0.85rem 0;
  }
  .post-item-meta { display: none; }
}

/* Terminal cursor blink — used by the 404 page */
@keyframes terminal-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-scroll-line::after { animation: none; opacity: 0.6; }
  .error-term-cursor { animation: none; opacity: 1; }
  [data-reveal] { transition: none; opacity: 1; transform: none; }
}
