/*
 * Homepage: label printer hero + recent posts carousel.
 * Kept outside the Tailwind build so it can change without rebuilding app.css.
 * Page colors come from the theme's variables (Settings > Design); the printer
 * and labels bring their own colors because they depict real objects.
 */

:root {
  --jsd-accent: var(--ghost-accent-color, #cc5803);
  --jsd-gutter: 1.25rem;
  --jsd-max: var(--container-width, 1200px);
  --jsd-label-paper: #fbfbf7;
  --jsd-label-ink: #151515;
}

/* ---------- Hero ---------- */

.jsd-hero {
  max-width: var(--jsd-max);
  margin: 0 auto;
  padding: 1.5rem var(--jsd-gutter) 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
}

@media (min-width: 900px) {
  .jsd-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 2rem;
    padding-top: 2.5rem;
    min-height: min(78vh, 640px);
  }
}

.jsd-hero__copy {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 36rem;
  min-width: 0;
  /* The headline sizes itself against this column's width */
  container-type: inline-size;
}

/*
 * Sized to the column, not the window, so the site title fits on one line
 * even in a wide font: "JohnSchneider.dev" in Space Mono is about 10.2em
 * wide, and 9cqi x 10.2 is roughly 92% of the column. Longer headlines wrap
 * between words; a single word too long for the column breaks only as a
 * last resort.
 */
.jsd-hero__headline {
  margin: 0;
  font-weight: 700;
  font-size: clamp(1.75rem, 9cqi, 4.25rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: manual;
  color: var(--color-typography);
}

.jsd-hero__sub {
  margin: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  max-width: 32rem;
  text-wrap: pretty;
  color: var(--color-typography-tone);
}

.jsd-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.jsd-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.15rem;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-typography);
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.jsd-button:hover {
  border-color: var(--color-typography-tone);
}

.jsd-button--primary {
  border-color: var(--jsd-accent);
  background: var(--jsd-accent);
  color: #fff;
}

.jsd-button--primary:hover {
  border-color: var(--jsd-accent);
  background: color-mix(in srgb, var(--jsd-accent) 85%, black);
}

.jsd-button:focus-visible,
.jsd-recent__all:focus-visible {
  outline: 2px solid var(--jsd-accent);
  outline-offset: 3px;
}

/* ---------- Printer stage ---------- */

.jsd-printer {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.jsd-printer__canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 560px;
}

@media (max-width: 899px) {
  .jsd-printer__canvas {
    aspect-ratio: 5 / 4;
  }
}

.jsd-printer:not(.is-3d) .jsd-printer__canvas {
  display: none;
}

.jsd-printer__caption {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-typography-tone);
}

.jsd-printer__caption span {
  color: var(--color-typography);
  font-weight: 600;
}

/* Topic links stay available to screen readers and keyboard users */
.jsd-printer__topics {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.jsd-printer__topics:focus-within {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  margin-top: 0.75rem;
}

.jsd-printer__topics ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.jsd-printer__topics a {
  color: var(--jsd-accent);
}

/* Flat label used when WebGL isn't available */
.jsd-printer__fallback {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
}

.jsd-printer__fallback[hidden] {
  display: none;
}

.jsd-label {
  width: min(100%, 420px);
  aspect-ratio: 4 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 1.25rem;
  background: var(--jsd-label-paper);
  color: var(--jsd-label-ink);
  outline: 2px solid var(--jsd-label-ink);
  outline-offset: -8px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.25);
  font-family: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
}

.jsd-label span {
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  line-height: 1.1;
}

.jsd-label small {
  font-weight: 500;
  font-size: 0.85rem;
}

/* ---------- Recent posts ---------- */

.jsd-recent {
  max-width: var(--jsd-max);
  margin: 1.5rem auto 3.5rem;
  padding: 0 var(--jsd-gutter);
}

.jsd-recent__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.jsd-recent__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-typography);
}

.jsd-recent__all {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--jsd-accent);
  text-decoration: none;
  white-space: nowrap;
}

.jsd-recent__all:hover {
  text-decoration: underline;
}

.jsd-recent__track {
  display: flex;
  gap: 1.75rem;
  overflow-x: auto;
  /* Room for the hover lift so it isn't clipped */
  padding: 24px 0.25rem 28px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.jsd-recent__empty {
  color: var(--color-typography-tone);
}

.jsd-card {
  flex: 0 0 82%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  scroll-snap-align: start;
  transition: transform 0.4s ease-out;
}

@media (min-width: 768px) {
  .jsd-card {
    flex-basis: 320px;
  }
}

.jsd-card:focus-visible {
  outline: 2px solid var(--jsd-accent);
  outline-offset: 6px;
  border-radius: 4px;
}

.jsd-card__image {
  width: 100%;
  aspect-ratio: 16 / 10;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 1rem;
  background-color: var(--color-background-tone);
  transition: box-shadow 0.3s ease;
}

.jsd-card__image--empty {
  border: 1px solid var(--color-border);
}

.jsd-card:hover .jsd-card__image {
  box-shadow: 0 14px 28px rgb(0 0 0 / 0.3);
}

.jsd-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-typography-tone);
}

.jsd-card__tag {
  color: var(--jsd-accent);
  font-weight: 600;
}

.jsd-card__title {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-typography);
}

.jsd-card:hover .jsd-card__title {
  text-decoration: underline;
  text-decoration-color: var(--jsd-accent);
  text-underline-offset: 3px;
}

.jsd-card__excerpt {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--color-typography-content);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .jsd-recent__track {
    scroll-behavior: auto;
  }

  .jsd-card,
  .jsd-card__image,
  .jsd-button {
    transition: none;
  }
}
