/*
 * HackNews Dark — Phase 5 editorial homepage.
 * Loaded after the shared Phase 2/3 compatibility layers.
 */

.hn-editorial-home {
  display: grid;
  gap: 22px;
}

.hn-editorial-home .hn-home-intro {
  margin: 0;
  padding: 22px 24px;
  border-color: var(--hn-border-strong);
  background:
    radial-gradient(circle at 100% 0, rgba(0, 214, 192, 0.1), transparent 36%),
    linear-gradient(135deg, var(--hn-panel), var(--hn-panel-2));
}

.hn-section-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--hn-accent);
  font-family: var(--wp--preset--font-family--hn-mono, monospace);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hn-category-quicklinks {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hn-border);
  border-radius: var(--hn-radius);
  background: var(--hn-panel);
}

.hn-category-quicklinks-label {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: var(--hn-pill);
  background: var(--hn-accent-dark);
  color: var(--hn-text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hn-category-quicklinks-list {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.hn-category-quicklinks-list a {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--hn-border);
  border-radius: var(--hn-pill);
  color: var(--hn-text-soft);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.hn-category-quicklinks-list a:hover,
.hn-category-quicklinks-list a:focus-visible {
  border-color: var(--hn-accent);
  color: var(--hn-accent);
}

.hn-category-quicklinks-list a span {
  min-width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 5px;
  border-radius: var(--hn-pill);
  background: var(--hn-shell);
  color: var(--hn-muted);
  font-size: 10px;
}

.hn-feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, 0.85fr);
  gap: 18px;
}

.hn-lead-story,
.hn-secondary-story {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hn-border);
  border-radius: var(--hn-radius);
  background: var(--hn-panel);
}

.hn-lead-story {
  min-height: 510px;
  isolation: isolate;
}

.hn-lead-media,
.hn-lead-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hn-lead-media img {
  object-fit: cover;
  transition: transform 0.35s ease;
}

.hn-lead-story:hover .hn-lead-media img {
  transform: scale(1.025);
}

.hn-lead-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(12, 14, 17, 0.04) 18%, rgba(12, 14, 17, 0.92) 100%);
}

.hn-lead-content {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 2;
  padding: clamp(22px, 4vw, 38px);
}

.hn-story-taxonomy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.hn-story-taxonomy span,
.hn-story-taxonomy a,
.hn-story-category {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(0, 214, 192, 0.44);
  border-radius: var(--hn-pill);
  background: rgba(16, 18, 21, 0.72);
  color: var(--hn-accent);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hn-story-taxonomy span {
  border-color: var(--hn-accent-dark);
  background: var(--hn-accent-dark);
  color: var(--hn-text);
}

.hn-lead-content h2,
.hn-secondary-content h3,
.hn-rail-content h3 {
  margin: 0;
}

.hn-lead-content h2 a {
  color: var(--hn-text);
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}

.hn-lead-content h2 a:hover,
.hn-lead-content h2 a:focus-visible {
  color: var(--hn-accent);
}

.hn-lead-content p {
  max-width: 720px;
  margin: 13px 0 0;
  color: var(--hn-text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.hn-story-meta,
.card-date-meta,
.article-date-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
  color: var(--hn-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.hn-story-meta {
  margin-top: 13px;
  color: var(--hn-text-soft);
}

.hn-date-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hn-date-updated {
  color: var(--hn-accent);
}

.hn-date-label {
  font-weight: 800;
}

.hn-secondary-stack {
  min-width: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hn-secondary-story {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
}

.hn-secondary-media {
  min-height: 100%;
  overflow: hidden;
  background: var(--hn-shell);
}

.hn-secondary-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.hn-secondary-story:hover .hn-secondary-media img {
  transform: scale(1.035);
}

.hn-secondary-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 17px;
}

.hn-secondary-content .hn-story-category {
  margin-bottom: 10px;
  background: transparent;
}

.hn-secondary-content h3 a {
  display: -webkit-box;
  color: var(--hn-text);
  font-size: clamp(15px, 1.45vw, 19px);
  font-weight: 850;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.hn-secondary-content h3 a:hover,
.hn-secondary-content h3 a:focus-visible {
  color: var(--hn-accent);
}

.hn-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
  padding-inline: 4px;
}

.hn-section-heading h2 {
  margin: 0;
  color: var(--hn-text);
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.18;
}

.hn-section-heading > a {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding-inline: 14px;
  border: 1px solid var(--hn-border);
  border-radius: var(--hn-pill);
  color: var(--hn-text-soft);
  font-size: 12px;
  font-weight: 800;
}

.hn-section-heading > a:hover,
.hn-section-heading > a:focus-visible {
  border-color: var(--hn-accent);
  color: var(--hn-accent);
}

.hn-latest-news .cards-grid {
  padding: 18px;
}

.card-date-meta {
  min-height: 17px;
  margin-bottom: 9px;
}

.card-date-meta .hn-date-published .hn-date-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.card-date-meta .hn-date-updated .hn-date-label {
  padding: 2px 6px;
  border-radius: var(--hn-pill);
  background: rgba(0, 214, 192, 0.09);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-footer-meta {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 13px;
  padding-top: 10px;
  border-top: 1px solid var(--hn-border);
  color: var(--hn-muted);
  font-size: 11.5px;
}

.card-footer-meta a,
.card-footer-meta span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-footer-meta a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-date-meta {
  margin-top: 10px;
}

.hn-home-utility-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hn-home-slot {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hn-border);
  border-radius: var(--hn-radius);
  background: var(--hn-panel);
}

.hn-slot-header {
  padding: 9px 14px;
  border-bottom: 1px solid var(--hn-border);
  color: var(--hn-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hn-home-ad .hn-slot-header {
  color: var(--hn-muted);
  text-align: center;
}

.hn-slot-content {
  padding: 17px;
}

.hn-slot-widget-title {
  margin: 0 0 10px;
  color: var(--hn-text);
  font-size: 18px;
}

.hn-slot-widget input:not([type="checkbox"]):not([type="radio"]),
.hn-slot-widget select,
.hn-slot-widget textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hn-border);
  border-radius: var(--hn-radius-sm);
  background: var(--hn-shell);
  color: var(--hn-text);
}

.hn-slot-widget button,
.hn-slot-widget input[type="submit"] {
  min-height: 44px;
  padding-inline: 18px;
  border: 0;
  border-radius: var(--hn-pill);
  background: var(--hn-accent-dark);
  color: var(--hn-text);
  font-weight: 850;
  cursor: pointer;
}

.hn-editorial-widget .widget-header {
  padding: 0;
}

.hn-editorial-widget .widget-header .widget-title {
  width: 100%;
  padding: 14px 15px;
  border: 0;
}

.hn-user-sidebar .hn-editorial-widget > .hn-rail-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 4px 14px;
}

.hn-rail-story {
  min-width: 0;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--hn-border);
}

.hn-rail-list > .hn-rail-story:last-child,
.hn-popular-row:last-child .hn-rail-story {
  border-bottom: 0;
}

.hn-rail-media {
  width: 66px;
  height: 58px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--hn-shell);
}

.hn-rail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hn-rail-content {
  min-width: 0;
}

.hn-rail-content h3 a {
  display: -webkit-box;
  color: var(--hn-text-soft);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.hn-rail-content h3 a:hover,
.hn-rail-content h3 a:focus-visible {
  color: var(--hn-accent);
}

.hn-rail-content > span {
  display: block;
  margin-top: 4px;
  color: var(--hn-muted);
  font-size: 10.5px;
}

.hn-popular-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.hn-popular-rank {
  color: var(--hn-accent);
  font-family: var(--wp--preset--font-family--hn-mono, monospace);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.hn-popular-row .hn-rail-story {
  grid-template-columns: minmax(0, 1fr);
}

.hn-popular-row .hn-rail-media {
  display: none;
}

body.hn-home-layout-compact .hn-feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.hn-home-layout-compact .hn-secondary-stack {
  display: contents;
}

body.hn-home-layout-compact .hn-lead-story,
body.hn-home-layout-compact .hn-secondary-story {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.hn-home-layout-compact .hn-lead-media,
body.hn-home-layout-compact .hn-lead-media img,
body.hn-home-layout-compact .hn-lead-content {
  position: static;
}

body.hn-home-layout-compact .hn-lead-media,
body.hn-home-layout-compact .hn-secondary-media {
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
}

body.hn-home-layout-compact .hn-lead-media img {
  width: 100%;
  height: 100%;
}

body.hn-home-layout-compact .hn-lead-shade,
body.hn-home-layout-compact .hn-lead-content p {
  display: none;
}

body.hn-home-layout-compact .hn-lead-content,
body.hn-home-layout-compact .hn-secondary-content {
  flex: 1 1 auto;
  padding: 17px;
}

body.hn-home-layout-compact .hn-lead-content h2 a,
body.hn-home-layout-compact .hn-secondary-content h3 a {
  color: var(--hn-text);
  font-size: 16px;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

body.hn-home-layout-compact .hn-lead-content .hn-story-meta {
  color: var(--hn-muted);
}

@media (max-width: 760px) {
  .hn-feature-grid,
  body.hn-home-layout-compact .hn-feature-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body.hn-home-layout-compact .hn-secondary-stack {
    display: grid;
  }

  .hn-lead-story {
    min-height: 460px;
  }

  .hn-secondary-story {
    grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.2fr);
    min-height: 190px;
  }

  .hn-home-utility-slots {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .hn-editorial-home {
    gap: 17px;
  }

  .hn-editorial-home .hn-home-intro {
    padding: 19px;
  }

  .hn-category-quicklinks {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .hn-category-quicklinks-label {
    align-self: flex-start;
  }

  .hn-lead-story {
    min-height: 430px;
  }

  .hn-lead-content {
    padding: 20px;
  }

  .hn-lead-content h2 a {
    font-size: 27px;
  }

  .hn-lead-content p {
    display: none;
  }

  .hn-secondary-story {
    grid-template-columns: 1fr;
  }

  .hn-secondary-media {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .hn-section-heading {
    align-items: flex-start;
  }

  .hn-section-heading > a {
    display: none;
  }

  .hn-latest-news .cards-grid {
    padding: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hn-lead-media img,
  .hn-secondary-media img {
    transition: none;
  }
}
