/* vtw-founder-story.css */
/* VendTheWeb Section Library — vendtheweb.com */
/* Version: 1.0.0 */

/* ── Variable resolution ─────────────────────────────── */
.vtw-founder-story {
  --_bg:           var(--vtw-section-bg,     var(--vtw-brand-bg,     #faf9f7));
  --_text:         var(--vtw-section-text,   var(--vtw-brand-text,   #1a1a1a));
  --_accent:       var(--vtw-section-accent, var(--vtw-brand-accent, #5c6b3a));
  --_accent-text:  var(--vtw-section-accent-text, var(--vtw-brand-accent-text, #ffffff));
  --_surface:      var(--vtw-section-surface,     var(--vtw-brand-surface, #f0ede8));
  --_border:       var(--vtw-section-border,      var(--vtw-brand-border,  #e8e3dc));
  --_heading-font: var(--vtw-section-heading-font,
                   var(--vtw-brand-heading-font, Georgia, serif));
  --_body-font:    var(--vtw-section-body-font,
                   var(--vtw-brand-body-font, 'Assistant', Georgia, serif));
  --_gap:          var(--vtw-brand-element-gap, 24px);
  --_radius:       var(--vtw-brand-radius-md, 8px);
  --_max-width:    var(--vtw-brand-container-width, 1280px);
  --_speed:        var(--vtw-brand-speed, 260ms);
}

/* ── Base layout ─────────────────────────────────────── */
.vtw-founder-story {
  background-color: var(--_bg);
  color: var(--_text);
  padding-top: var(--_pad-y-start, 80px);
  padding-bottom: var(--_pad-y-end, 80px);
  min-height: var(--_min-height, 0);
  font-family: var(--_body-font);
}

.vtw-founder-story__inner {
  margin-inline: auto;
  padding-inline: clamp(24px, 4vw, 48px);
}

.vtw-founder-story__inner--contained {
  max-width: var(--_max-width);
}

.vtw-founder-story__inner--full {
  max-width: none;
  padding-inline: clamp(24px, 6vw, 80px);
}

/* ── Grid ────────────────────────────────────────────── */
.vtw-founder-story__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 5vw, 72px);
  align-items: center;
}

@media (min-width: 769px) {
  .vtw-founder-story[data-column-ratio="narrow"]   .vtw-founder-story__grid { grid-template-columns: 35fr 65fr; }
  .vtw-founder-story[data-column-ratio="balanced"] .vtw-founder-story__grid { grid-template-columns: 45fr 55fr; }
  .vtw-founder-story[data-column-ratio="wide"]     .vtw-founder-story__grid { grid-template-columns: 55fr 45fr; }

  .vtw-founder-story[data-layout="image-right"] .vtw-founder-story__media   { order: 2; }
  .vtw-founder-story[data-layout="image-right"] .vtw-founder-story__content { order: 1; }
}

/* ── Media column ────────────────────────────────────── */
.vtw-founder-story__media {
  position: relative;
  /* min-width: 0 is the grid-item fix: without it, a 1fr column can expand
     to fit the media's explicit max-width (560px) even when the viewport is
     narrower than that, pushing content past the section's inline padding.
     See learnings.md 2026-04 "grid item max-width overflow" for the full story. */
  min-width: 0;
  max-width: min(100%, 560px);
  width: 100%;
  justify-self: center;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  .vtw-founder-story[data-layout="image-left"]  .vtw-founder-story__media { justify-self: start; }
  .vtw-founder-story[data-layout="image-right"] .vtw-founder-story__media { justify-self: end; }
}

.vtw-founder-story__media-stack {
  position: relative;
  aspect-ratio: 4 / 5;
}

.vtw-founder-story__frame {
  position: absolute;
  inset: 0;
  background-color: var(--_surface);
  border: 1px solid var(--_border);
  border-radius: var(--_radius);
  transform: translate(0, 0);
  transition: transform var(--_speed) cubic-bezier(0.25, 0.1, 0.25, 1);
  pointer-events: none;
  z-index: 0;
}

.vtw-founder-story[data-portrait-offset="true"] .vtw-founder-story__frame {
  transform: translate(16px, 18px);
}

.vtw-founder-story[data-portrait-offset="true"][data-layout="image-right"] .vtw-founder-story__frame {
  transform: translate(-16px, 18px);
}

.vtw-founder-story__portrait {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--_radius);
  z-index: 1;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--_text) 8%, transparent);
}

.vtw-founder-story__portrait--placeholder {
  display: grid;
  place-items: center;
  background-color: var(--_surface);
  border: 1px solid var(--_border);
  color: var(--_accent);
  opacity: 0.6;
}

.vtw-founder-story__portrait--placeholder svg {
  width: 48%;
  height: 48%;
}

.vtw-founder-story__secondary {
  position: absolute;
  right: -20px;
  bottom: -32px;
  width: 40%;
  max-width: 180px;
  margin: 0;
  padding: 8px;
  background-color: var(--_bg);
  border: 1px solid var(--_border);
  border-radius: var(--_radius);
  box-shadow: 0 12px 32px -18px color-mix(in srgb, var(--_text) 40%, transparent);
  z-index: 2;
  transform: rotate(2deg);
}

.vtw-founder-story[data-layout="image-right"] .vtw-founder-story__secondary {
  right: auto;
  left: -20px;
  transform: rotate(-2deg);
}

.vtw-founder-story__secondary-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: calc(var(--_radius) - 2px);
}

/* ── Content column ──────────────────────────────────── */
.vtw-founder-story__content {
  min-width: 0;
}

/* ── Text alignment cascade ─────────────────────────────
   Desktop (≥ 769px): data-text-align controls the whole content column.
   Mobile (≤ 768px):  data-text-align-mobile overrides.

   Unlike text-align: which only governs inline content, block-level children
   with their own max-width (e.g. __story at 58ch, __quote at 60ch) must also
   switch their margin-inline auto/0 pair so the constrained boxes themselves
   shift. See learnings.md 2026-04 "text-align doesn't center max-width
   children". */
@media (min-width: 769px) {
  .vtw-founder-story[data-text-align="center"] .vtw-founder-story__content {
    text-align: center;
  }
  .vtw-founder-story[data-text-align="center"] .vtw-founder-story__story,
  .vtw-founder-story[data-text-align="center"] .vtw-founder-story__quote {
    margin-inline: auto;
  }
  .vtw-founder-story[data-text-align="center"] .vtw-founder-story__quote {
    padding-left: 0;
    border-left: 0;
    border-top: 2px solid var(--_accent);
    padding-top: 16px;
  }
  .vtw-founder-story[data-text-align="center"] .vtw-founder-story__label {
    border-bottom-color: var(--_accent);
  }
  .vtw-founder-story[data-text-align="center"] .vtw-founder-story__signature {
    margin-left: auto;
    margin-right: auto;
  }

  .vtw-founder-story[data-text-align="right"] .vtw-founder-story__content {
    text-align: right;
  }
  .vtw-founder-story[data-text-align="right"] .vtw-founder-story__story,
  .vtw-founder-story[data-text-align="right"] .vtw-founder-story__quote {
    margin-inline-start: auto;
    margin-inline-end: 0;
  }
  .vtw-founder-story[data-text-align="right"] .vtw-founder-story__quote {
    padding-left: 0;
    padding-right: 24px;
    border-left: 0;
    border-right: 3px solid var(--_accent);
  }
  .vtw-founder-story[data-text-align="right"] .vtw-founder-story__signature {
    margin-left: auto;
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .vtw-founder-story[data-text-align-mobile="center"] .vtw-founder-story__content {
    text-align: center;
  }
  .vtw-founder-story[data-text-align-mobile="center"] .vtw-founder-story__story,
  .vtw-founder-story[data-text-align-mobile="center"] .vtw-founder-story__quote {
    margin-inline: auto;
  }
  .vtw-founder-story[data-text-align-mobile="center"] .vtw-founder-story__quote {
    padding-left: 0;
    border-left: 0;
    border-top: 2px solid var(--_accent);
    padding-top: 14px;
  }
  .vtw-founder-story[data-text-align-mobile="center"] .vtw-founder-story__signature {
    margin-left: auto;
    margin-right: auto;
  }

  .vtw-founder-story[data-text-align-mobile="right"] .vtw-founder-story__content {
    text-align: right;
  }
  .vtw-founder-story[data-text-align-mobile="right"] .vtw-founder-story__story,
  .vtw-founder-story[data-text-align-mobile="right"] .vtw-founder-story__quote {
    margin-inline-start: auto;
    margin-inline-end: 0;
  }
  .vtw-founder-story[data-text-align-mobile="right"] .vtw-founder-story__quote {
    padding-left: 0;
    padding-right: 18px;
    border-left: 0;
    border-right: 3px solid var(--_accent);
  }
  .vtw-founder-story[data-text-align-mobile="right"] .vtw-founder-story__signature {
    margin-left: auto;
    margin-right: 0;
  }
}

.vtw-founder-story__label {
  display: inline-block;
  font-family: var(--_body-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--_text);
  padding-bottom: 10px;
  margin: 0 0 24px;
  border-bottom: 1.5px solid var(--_accent);
}

.vtw-founder-story__location {
  font-family: var(--_body-font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--_accent);
  margin: 0 0 10px;
}

.vtw-founder-story__name {
  font-family: var(--_heading-font);
  font-size: clamp(28px, 3.8vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--_text);
  margin: 0 0 10px;
}

.vtw-founder-story__role {
  font-family: var(--_body-font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--_text);
  opacity: 0.72;
  margin: 0 0 6px;
}

.vtw-founder-story__years {
  font-family: var(--_body-font);
  font-size: 14px;
  font-style: italic;
  color: var(--_text);
  opacity: 0.6;
  margin: 0 0 28px;
}

/* ── Stats row ───────────────────────────────────────── */
.vtw-founder-story__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 20px 32px;
  list-style: none;
  padding: 24px 0;
  margin: 0 0 32px;
  border-top: 1px solid var(--_border);
  border-bottom: 1px solid var(--_border);
}

.vtw-founder-story__stat {
  min-width: 0;
}

.vtw-founder-story__stat-value {
  font-family: var(--_heading-font);
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 700;
  line-height: 1;
  color: var(--_accent);
  margin: 0 0 6px;
}

.vtw-founder-story__stat-label {
  font-family: var(--_body-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--_text);
  opacity: 0.72;
  line-height: 1.4;
  margin: 0;
}

/* ── Story prose ─────────────────────────────────────── */
.vtw-founder-story__story {
  font-family: var(--_body-font);
  font-size: 17px;
  line-height: 1.75;
  color: var(--_text);
  max-width: 58ch;
}

.vtw-founder-story__story p {
  margin: 0 0 18px;
}

.vtw-founder-story__story > *:last-child {
  margin-bottom: 0;
}

.vtw-founder-story__story a {
  color: var(--_accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

/* ── Quote pull-out ──────────────────────────────────── */
.vtw-founder-story__quote {
  position: relative;
  padding: 4px 0 4px 24px;
  margin: 32px 0;
  max-width: 60ch;
  border-left: 3px solid var(--_accent);
}

.vtw-founder-story__quote p {
  font-family: var(--_heading-font);
  font-style: italic;
  font-size: clamp(20px, 2.1vw, 26px);
  line-height: 1.4;
  color: var(--_text);
  margin: 0;
}

/* ── Signature ───────────────────────────────────────── */
.vtw-founder-story__signature {
  display: block;
  max-width: 180px;
  width: auto;
  height: auto;
  margin: 32px 0 8px;
  opacity: 0.88;
  mix-blend-mode: multiply;
}

/* ── CTA ─────────────────────────────────────────────── */
.vtw-founder-story__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 14px 28px;
  background-color: var(--_accent);
  color: var(--_accent-text);
  font-family: var(--_body-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: var(--vtw-brand-button-radius, var(--_radius));
  transition: transform var(--_speed) ease, box-shadow var(--_speed) ease;
}

.vtw-founder-story__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--_accent) 60%, transparent);
}

.vtw-founder-story__cta:focus-visible {
  outline: 2px solid var(--_accent);
  outline-offset: 3px;
}

.vtw-founder-story__cta-arrow {
  width: 18px;
  height: 18px;
  transition: transform var(--_speed) ease;
}

.vtw-founder-story__cta:hover .vtw-founder-story__cta-arrow {
  transform: translateX(4px);
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  /* Inner padding uses clamp() at the top of this file — no override needed. */

  .vtw-founder-story__grid {
    gap: 40px;
  }

  .vtw-founder-story__media {
    max-width: min(100%, 440px);
  }

  /* The offset frame visually extends beyond the media column by ~13px on
     mobile. Without a margin matching the offset, that extension can hit the
     viewport edge and create horizontal overflow on 360-375px phones.
     An inline margin equal to the offset keeps the frame within the section
     padding on both sides. */
  .vtw-founder-story[data-portrait-offset="true"] .vtw-founder-story__media-stack {
    margin-inline-end: 16px;
  }
  .vtw-founder-story[data-portrait-offset="true"][data-layout="image-right"] .vtw-founder-story__media-stack {
    margin-inline-end: 0;
    margin-inline-start: 16px;
  }

  .vtw-founder-story[data-portrait-offset="true"] .vtw-founder-story__frame {
    transform: translate(12px, 14px);
  }

  .vtw-founder-story[data-portrait-offset="true"][data-layout="image-right"] .vtw-founder-story__frame {
    transform: translate(-12px, 14px);
  }

  .vtw-founder-story__secondary,
  .vtw-founder-story[data-layout="image-right"] .vtw-founder-story__secondary {
    right: -12px;
    left: auto;
    bottom: -24px;
    width: 38%;
    transform: rotate(2deg);
  }

  .vtw-founder-story__story {
    font-size: 16px;
    line-height: 1.7;
  }

  .vtw-founder-story__quote {
    margin: 24px 0;
    padding-left: 18px;
  }

  .vtw-founder-story__stats {
    gap: 16px 24px;
    padding: 18px 0;
    margin-bottom: 24px;
  }

  .vtw-founder-story__cta {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .vtw-founder-story__name {
    font-size: clamp(24px, 7vw, 32px);
  }
}

/* ── Scroll-entry reveal ─────────────────────────────── */
/*
  No-JS default: content is fully visible with no animation. When
  vtw-founder-story.js runs, it adds `.vtw-animate-ready` to the section which
  activates the initial-hidden state; `.vtw-is-visible` then triggers the
  staggered fade-up via IntersectionObserver. If IntersectionObserver is
  unavailable, JS reveals immediately. JS never branches on prefers-reduced-
  motion — CSS handles that below. See learnings.md 2026-04 "Brave's
  fingerprinting shields" for why.
*/
.vtw-founder-story[data-animate="true"].vtw-animate-ready .vtw-founder-story__media,
.vtw-founder-story[data-animate="true"].vtw-animate-ready .vtw-founder-story__content > * {
  opacity: 0;
  transform: translateY(16px);
}

.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__media,
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > * {
  animation: vtw-founder-story-rise 600ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__media                      { animation-delay:  80ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(1)   { animation-delay: 140ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(2)   { animation-delay: 200ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(3)   { animation-delay: 260ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(4)   { animation-delay: 320ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(5)   { animation-delay: 380ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(6)   { animation-delay: 440ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(7)   { animation-delay: 500ms; }
.vtw-founder-story[data-animate="true"].vtw-animate-ready.vtw-is-visible .vtw-founder-story__content > *:nth-child(n+8) { animation-delay: 560ms; }

@keyframes vtw-founder-story-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Motion reduction ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vtw-founder-story *,
  .vtw-founder-story *::before,
  .vtw-founder-story *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }

  .vtw-founder-story[data-animate="true"].vtw-animate-ready .vtw-founder-story__media,
  .vtw-founder-story[data-animate="true"].vtw-animate-ready .vtw-founder-story__content > * {
    opacity: 1;
    transform: none;
  }
}
