/* ==========================================================================
   Verso Home Page Styles
   ========================================================================== */

.hero {
  padding-block: clamp(2.8rem, 6vw, 5rem) clamp(3rem, 6vw, 5.2rem);
  overflow-x: clip;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2.5rem, 5.5vw, 4.75rem);
  align-items: center;
}

@media (max-width: 880px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-7);
  }
}

.hero__title {
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}

.hero__accent {
  position: relative;
  isolation: isolate;
  font-style: italic;
  color: var(--accent);
}

/* Highlighter stroke, swept once after the title has landed (heroEnter) */
.hero__accent::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 46% -0.05em 11% -0.08em;
  border-radius: 0.14em 0.07em 0.12em 0.06em;
  background: var(--highlight);
  transform: rotate(-1.2deg);
  animation: highlightSweep var(--dur-slow) var(--ease-out) calc(var(--dur-slow) + 60ms) backwards;
}

@keyframes highlightSweep {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__accent::before {
    animation: none;
  }
}

.hero__lead {
  font-size: var(--text-md);
  color: var(--ink-secondary);
  max-width: 46ch;
  margin-bottom: var(--space-6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-3);
}

.hero__meta {
  margin-bottom: var(--space-5);
}

.hero__beta {
  max-width: 48ch;
}

/* Frameless Floating Screenshot Deck */
.deck-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.deck {
  position: relative;
  width: min(350px, 84vw);
  height: clamp(380px, 48vw, 450px);
  display: grid;
  place-items: center;
  touch-action: pan-y pinch-zoom; /* sideways drags move the front sheet */
}

.deck-sheet {
  position: absolute;
  width: min(286px, 72vw);
  aspect-ratio: 948 / 1260;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--sheet-border);
  background: var(--sheet-bg);
  overflow: hidden;
  cursor: pointer;
  transform-origin: 50% 80%;
  transition:
    transform var(--dur-slow) var(--ease-spring),
    box-shadow var(--dur-base) var(--ease-out),
    opacity var(--dur-base) var(--ease-out),
    filter var(--dur-base) var(--ease-out);
  will-change: transform;
}

.deck-sheet img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.deck-sheet[data-pos="0"] {
  z-index: 3;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  box-shadow: var(--sheet-shadow);
  cursor: zoom-in;
}

.deck-sheet[data-pos="0"]:hover {
  transform: translate3d(0, -4px, 0) rotate(0deg) scale(1.01);
}

.deck-sheet[data-pos="1"] {
  z-index: 2;
  transform: translate3d(42px, 12px, 0) rotate(6.5deg) scale(0.92);
  box-shadow: var(--sheet-shadow-back);
  opacity: 0.92;
  filter: brightness(0.97);
}

.deck-sheet[data-pos="1"]:hover {
  transform: translate3d(52px, 6px, 0) rotate(8deg) scale(0.94);
  opacity: 1;
}

.deck-sheet[data-pos="2"] {
  z-index: 1;
  transform: translate3d(-40px, 18px, 0) rotate(-6.5deg) scale(0.90);
  box-shadow: var(--sheet-shadow-back);
  opacity: 0.86;
  filter: brightness(0.95);
}

.deck-sheet[data-pos="2"]:hover {
  transform: translate3d(-50px, 10px, 0) rotate(-8deg) scale(0.92);
  opacity: 1;
}

/* The others wait out of sight behind the fan */
.deck-sheet[data-pos="rest"] {
  z-index: 0;
  transform: translate3d(0, 18px, 0) scale(0.86);
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
}

/* Squared up beneath the front sheet during a dictionary lookup */
.deck-sheet[data-pos="under"] {
  z-index: 2;
  transition-timing-function: var(--ease-out); /* a spring would peek out again */
}

/* Follows the finger (see initDeck) */
.deck-sheet.is-dragging {
  transition: none;
}

/* The sheets behind start squared up with the front one and fan out once.
   Selected by data-sheet, which never changes, so switching can't replay it. */
@media (prefers-reduced-motion: no-preference) {
  .deck-sheet:not([data-sheet="0"]) {
    animation: deckFan var(--dur-slow) var(--ease-spring) 480ms backwards;
  }

  .deck-sheet:last-child {
    animation-delay: 540ms;
  }
}

@keyframes deckFan {
  from {
    transform: none;
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .deck {
    width: 100%;
    height: 375px;
  }
  .deck-sheet {
    width: min(252px, 68vw);
  }
  .deck-sheet[data-pos="1"] {
    transform: translate3d(26px, 10px, 0) rotate(5.5deg) scale(0.92);
  }
  .deck-sheet[data-pos="2"] {
    transform: translate3d(-26px, 14px, 0) rotate(-5.5deg) scale(0.90);
  }
  .deck-wrap .segmented__btn {
    padding-inline: 0.7rem; /* all four screenshots fit between the page margins */
  }
}

/* Its screenshot is in the lightbox; the lightbox image returns here on closing */
.deck-sheet.is-lifted {
  visibility: hidden;
}

/* Dictionary lookup: the Reading page, with the selection and the card cut out
   of the Lookup screenshot (see lookUp in initDeck). Both screenshots are
   948 x 1260 and the card starts at y 580. */
.deck-lookup,
.deck-lookup img {
  position: absolute;
  inset: 0;
}

.deck-lookup__card {
  clip-path: inset(46% 0 0);
}

.deck-sheet__zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: rgba(20, 23, 34, 0.72);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--dur-fast), transform var(--dur-base) var(--ease-spring);
  pointer-events: none;
}

.deck-sheet[data-pos="0"]:hover .deck-sheet__zoom-hint,
.deck-sheet[data-pos="0"]:focus-visible .deck-sheet__zoom-hint {
  opacity: 1;
  transform: scale(1);
}

@media (hover: none) {
  .deck-sheet[data-pos="0"] .deck-sheet__zoom-hint {
    opacity: 0.85;
    transform: scale(1);
  }
}

.deck-caption {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-align: center;
  max-width: 38ch;
  min-height: 3.25em; /* two lines, so a longer caption doesn't move the deck */
  transition: opacity var(--dur-fast);
}

/* Highlights Section (Home Below the Fold) */
.highlights {
  padding-block: clamp(2.5rem, 5vw, 4rem) var(--space-6);
}

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

.section-heading h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.section-heading p {
  color: var(--ink-secondary);
  max-width: 56ch;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease-spring), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-fast);
}

/* Staggered scroll-in uses keyframes so hover elevation stays crisp with zero delay */
.feature-card.reveal {
  transform: translateY(0);
}

.feature-card.reveal.is-visible {
  animation: featureReveal var(--dur-slow) var(--ease-out) var(--delay, 0ms) backwards;
}

@keyframes featureReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

.feature-card__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
}

/* Icons act out their meaning once per hover. `is-acting` stays until the
   pointer has left and everything has finished (see initFeatureIcons). */
.feature-card__icon svg {
  overflow: visible;
}

/* Text size steps down, then up */
.is-acting .icon-type {
  transform-origin: 12px 21px;
  animation: iconType 720ms var(--ease-out);
}

@keyframes iconType {
  30% { transform: scale(0.68); }
  68% { transform: scale(1.14); }
}

/* Pen writes its line */
.is-acting .icon-pen {
  transform-origin: 3px 21px;
  animation: iconPen 760ms ease-in-out;
}

@keyframes iconPen {
  20% { transform: translate(-1px, 0) rotate(-5deg); }
  70% { transform: translate(4px, 0) rotate(4deg); }
}

.is-acting .icon-pen-line {
  stroke-dasharray: 1;
  animation: iconPenLine 460ms ease-in-out 150ms backwards;
}

@keyframes iconPenLine {
  from { stroke-dashoffset: 1; }
}

/* Wi-Fi signal goes out, then lights from the dot outwards */
.is-acting .icon-signal {
  animation:
    iconDim 120ms ease-out forwards,
    iconLight 260ms ease-out var(--delay, 0ms) forwards;
}

@keyframes iconDim {
  to { opacity: 0.18; }
}

@keyframes iconLight {
  from { opacity: 0.18; }
  to { opacity: 1; }
}

/* Folder front tips open. The one-piece folder stands in while closed, as
   overlapping strokes look heavier. */
.icon-folder-closed {
  transition: visibility 0s var(--dur-base);
}

.icon-folder-open {
  visibility: hidden;
  transition: visibility 0s var(--dur-base);
}

.is-acting .icon-folder-closed {
  visibility: hidden;
  transition: none;
}

.is-acting .icon-folder-open {
  visibility: visible;
  transition: none;
}

.icon-folder-front {
  transform-origin: 2px 20px;
  transition: transform var(--dur-base) var(--ease-spring);
}

.is-acting .icon-folder-front {
  transform: skewX(-17deg) scaleY(0.82);
}

.icon-folder-edge {
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.is-acting .icon-folder-edge {
  opacity: 1;
}

.feature-card h3 {
  font-size: 1.08rem;
  margin-bottom: var(--space-2);
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: 1.58;
}

/* Honest Scope Note */
.scope-strip {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

@media (max-width: 720px) {
  .scope-strip {
    grid-template-columns: 1fr;
  }
}

.scope-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.scope-card h3 {
  font-size: 1rem;
  margin-bottom: var(--space-2);
}

.scope-card p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.scope-card a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Closing CTA Band */
.home-cta {
  margin-top: var(--space-7);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5) var(--space-6);
}

.home-cta__copy {
  max-width: 44ch;
}

.home-cta__copy h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.home-cta__copy p {
  font-size: var(--text-sm);
  color: var(--ink-secondary);
}

.home-cta__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-3);
}

.home-cta__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
}

.home-cta__links .btn-link {
  padding: 0.3rem 0.25rem;
  font-size: var(--text-sm);
}

@media (max-width: 820px) {
  .home-cta {
    flex-direction: column;
    align-items: flex-start;
  }
  .home-cta__actions {
    align-items: flex-start;
  }
}
