/* ==========================================================================
   Homepage Styles (v3) -- Rails layout, shots grid, sidebar
   Built-in markata-go theme. Uses CSS custom properties from variables.css.
   Loaded automatically when template: home.html is used.
   ========================================================================== */

/* ── Override page-wrapper constraints for homepage ── */
.page-home .page-wrapper {
  max-width: 100%;
  padding: 0;
}

/* Override main element constraint (theme sets max-width: --page-width = 1200px) */
.page-home main {
  max-width: 100%;
  padding-left: 0;
  padding-right: 0;
}

/* ── Width container ── */

.home-width {
  max-width: var(--grid-max-width, 1400px);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ── Hero ── */

.home-hero {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: var(--space-16, 5rem) 0 var(--space-12, 3.5rem);
  position: relative;
  z-index: 10;
}

.home-hero__inner {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.home-hero__avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid var(--color-primary, #bd93f9);
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--color-primary) 15%, transparent),
    0 8px 32px color-mix(in srgb, var(--color-bg, #000) 25%, transparent);
  object-fit: cover;
  flex-shrink: 0;
}

.home-hero__name {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.05;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

/* Accent on last name -- solid theme primary, no jarring gradient */
.home-hero__accent {
  color: var(--color-primary);
}

.home-hero__tagline {
  font-size: var(--text-xl, 1.25rem);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 var(--space-5);
  max-width: 55ch;
}

.home-hero__links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.home-hero__pill {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.home-hero__pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

/* ── Intro cards (about, now, etc.) ── */

.home-section {
  position: relative;
  z-index: 10;
  padding: var(--space-6) 0;
}

.home-section.home-intro-grid {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: var(--space-12) 0;
  background: color-mix(in srgb, var(--color-surface) 35%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--color-border) 35%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 35%, transparent);
}

.home-section.home-intro-grid .home-width {
  width: 100%;
}

.home-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.home-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.home-card h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
}

.home-card h2 a {
  color: inherit;
  text-decoration: none;
}

.home-card h2 a:hover {
  color: var(--color-primary);
}

.home-card p {
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
}

.home-card ul {
  color: var(--color-text-muted);
  line-height: 1.7;
  margin: 0 0 var(--space-3);
  padding-left: var(--space-5);
  font-size: var(--text-base);
}

.home-card li {
  margin-bottom: var(--space-1);
}

.home-card .home-updated {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  opacity: 0.7;
  margin-top: var(--space-4);
}

/* ── Feed sections area ── */

.home-feeds {
  position: relative;
  z-index: 10;
  padding: var(--space-10) 0 var(--space-12);
}

.home-feeds-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
  align-items: start;
  margin-top: var(--space-8);
}

.home-feeds-grid__col {
  min-width: 0;
}

/* ── Section headings ── */

.page-home .post-content h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin: var(--space-8) 0 var(--space-5);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.page-home .post-content h2:first-child {
  margin-top: var(--space-2);
}

.page-home .post-content h2 a {
  color: inherit;
  text-decoration: none;
}

.page-home .post-content h2 a:hover {
  color: var(--color-primary);
}

/* Hide heading anchors on homepage */
.page-home .post-content h2 .anchor,
.page-home .post-content h2 .heading-anchor {
  display: none;
}

/* ── "See more" links ── */

.page-home .home-see-more {
  display: inline-block;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.page-home .home-see-more:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* ── Feed card grids ── */

.page-home .feed .posts,
.page-home .feed .posts-list {
  max-width: 100%;
}

/* ── Cards ── */

.page-home .card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.page-home .card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--color-bg, #000) 12%, transparent);
}

/* ==========================================================================
   SHOTS GALLERY -- Instagram-style 3-column square grid
   ========================================================================== */

.home-shots-section {
  margin-bottom: var(--space-8);
}

.page-home .home-shots-section h2 {
  margin-bottom: var(--space-4);
}

.home-shots-section .feed .posts-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  grid-auto-flow: dense;
}

/* Reset .post-content media margins inside shots grid */
.home-shots-section .photo-figure img,
.home-shots-section .photo-figure video {
  margin: 0;
}

/* Photo figures in the shots grid */
.home-shots-section .photo-figure {
  background: var(--color-surface);
  overflow: hidden;
  margin: 0;
  aspect-ratio: 1 / 1;
  position: relative;
  border-radius: var(--radius-lg, 0.75rem);
  border: none;
}

.home-shots-section .photo-figure > a {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.home-shots-section .photo-figure img,
.home-shots-section .photo-figure video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.home-shots-section .photo-figure:hover img,
.home-shots-section .photo-figure:hover video {
  transform: scale(1.05);
  filter: brightness(0.7);
}

/* Caption overlay -- hidden by default, shown on hover */
.home-shots-section .photo-figure figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  color: #fff;
  line-height: 1.4;
  background: linear-gradient(transparent, color-mix(in srgb, var(--color-bg, #000) 70%, transparent));
  opacity: 0;
  transition: opacity 0.3s ease;
  /* Limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-shots-section .photo-figure:hover figcaption {
  opacity: 1;
}

/* card_classes wrapper divs: fill grid cell, clip corners */
.home-shots-section .posts-list > div {
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-lg, 0.75rem);
}

.home-shots-section .posts-list > div > .photo-figure {
  height: 100%;
  width: 100%;
  border-radius: 0;
}

/* ==========================================================================
   MAIN + SIDEBAR RAIL LAYOUT
   ========================================================================== */

.home-main-rail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-8);
  align-items: start;
}

/* Main content column */
.home-main-content {
  min-width: 0; /* prevent grid blowout */
}

.home-main-content .feed .posts-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

/* Shots grid overrides the single-column main-content default */
.home-main-content .home-shots-section .feed .posts-list {
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

/* Blog article cards in main column -- stacked, full width */
.home-main-content .card-article {
  border-left: 3px solid var(--color-primary);
}

/* TIL link cards in main column -- compact grid */
.home-main-content > *:last-child .feed .posts-list {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* ==========================================================================
   SIDEBAR RAIL
   ========================================================================== */

.home-sidebar {
  position: sticky;
  top: var(--space-4);
}

.home-sidebar-section {
  margin-bottom: var(--space-6);
}

.page-home .home-sidebar-section h2 {
  font-size: var(--text-base);
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--color-border);
}

/* Sidebar feeds: single column, compact */
.home-sidebar .feed .posts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.home-sidebar .card {
  padding: var(--space-3);
  font-size: var(--text-sm);
}

.home-sidebar .card-note {
  max-width: 100%;
}

.home-sidebar .card-note .card-body {
  font-size: var(--text-sm);
}

.home-sidebar .card-note .card-text {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.home-sidebar .card-meta {
  font-size: 0.75rem;
}

/* ==========================================================================
   REDUCE CLUTTER -- hide post chrome on homepage
   ========================================================================== */

.page-home .post-header,
.page-home .post-graph-container,
.page-home .guide-navigation,
.page-home .share-container,
.page-home .article-progress {
  display: none;
}

/* Transparent backgrounds */
.page-home .post-content {
  background: transparent;
  box-shadow: none;
}

.page-home .home-feeds {
  background: transparent;
  box-shadow: none;
}

/* Override theme main.css rules that give .feed/.div.feed card-like styling.
   On the homepage, inline feeds should be transparent containers, not cards.
   Also override the content-width max-width that constrains feeds to 65ch.
   Use .page-home .post-content .feed for sufficient specificity over theme rules. */
.page-home .post-content .feed,
.page-home .post-content section.feed,
.page-home .post-content div.feed {
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  border: none;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.page-home .layout-content--landing {
  padding: 0;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  .home-main-rail {
    grid-template-columns: 1fr 280px;
    gap: var(--space-6);
  }
}

@media (max-width: 768px) {
  .home-hero {
    min-height: auto;
    padding: var(--space-10, 3rem) 0 var(--space-6);
  }

  .home-section.home-intro-grid {
    min-height: auto;
    padding: var(--space-8) 0;
  }

  .home-hero__inner {
    flex-direction: column;
    text-align: center;
  }

  .home-hero__avatar {
    width: 120px;
    height: 120px;
  }

  .home-hero__name {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .home-hero__tagline {
    max-width: 100%;
    font-size: var(--text-lg);
  }

  .home-hero__links {
    justify-content: center;
  }

  .home-two-col {
    grid-template-columns: 1fr;
  }

  .home-feeds-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  /* Sidebar moves below main content on mobile */
  .home-main-rail {
    grid-template-columns: 1fr;
  }

  .home-sidebar {
    position: static;
  }

  .home-shots-section .feed .posts-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .page-home .post-content h2 {
    font-size: var(--text-lg);
    margin-top: var(--space-8);
  }
}

/* ── Ultra-wide / 4K scaling ── */

@media (min-width: 1600px) {
  .home-width {
    max-width: 1600px;
  }

  .home-main-rail {
    grid-template-columns: 1fr 360px;
  }
}

@media (min-width: 2200px) {
  .home-width {
    max-width: 2000px;
  }

  .home-main-rail {
    grid-template-columns: 1fr 400px;
  }

  .home-hero__avatar {
    width: 200px;
    height: 200px;
  }
}

@media (min-width: 3200px) {
  .home-width {
    max-width: 2800px;
  }

  .home-main-rail {
    grid-template-columns: 1fr 480px;
    gap: var(--space-10, 3rem);
  }

  .home-hero__avatar {
    width: 240px;
    height: 240px;
  }

  .home-hero__name {
    font-size: 5rem;
  }

  .home-hero__tagline {
    font-size: var(--text-2xl, 1.5rem);
  }
}

@media (max-width: 480px) {
  .home-card {
    padding: var(--space-4);
  }

  .home-shots-section .feed .posts-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
