/* ==========================================================================
   Spundle — Components (BEM)
   Reusable pieces shared by the homepage and the style guide.
   ========================================================================== */

/* ---- Button -------------------------------------------------------------- */
.btn {
  --btn-bg: var(--color-plum);
  --btn-fg: var(--color-white);
  --btn-border: var(--color-plum);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;                 /* WCAG 2.5.8 target size */
  padding: 10px 35px;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: var(--fw-regular);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: var(--btn-fg);
  background-color: var(--btn-bg);
  border: var(--border-width) solid var(--btn-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease),
              background-color var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
}

.btn:hover {
  --btn-bg: transparent;
  --btn-fg: var(--color-plum);
}

.btn:active {
  --btn-bg: var(--color-plum-dark);
  --btn-fg: var(--color-white);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: progress;
}

.btn--outline {
  --btn-bg: transparent;
  --btn-fg: var(--color-black);
  --btn-border: var(--color-black);
}

.btn--outline:hover {
  --btn-bg: var(--color-black);
  --btn-fg: var(--color-white);
}

.btn--inverse {
  --btn-bg: var(--color-white);
  --btn-fg: var(--color-plum);
  --btn-border: var(--color-white);
}

.btn--inverse:hover {
  --btn-bg: transparent;
  --btn-fg: var(--color-white);
}

.btn--block {
  width: 100%;
  max-width: 217px;
  margin-inline: auto;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ---- Title with highlight mark -------------------------------------------
   Wrap the highlighted word in <span class="title__mark">. The bar scales with
   font size, so it never drifts like the old absolute-positioned version.  */
.title {
  position: relative;
  z-index: var(--z-raised);
  margin-bottom: var(--space-2);
}

.title--xl {
  font-size: var(--fs-display);
}

.title--hero {
  font-size: var(--fs-h1);
}

.title--lg {
  font-size: var(--fs-h2);
}

.title__mark {
  --mark-color: var(--color-cream);

  background-image: linear-gradient(var(--mark-color), var(--mark-color));
  background-repeat: no-repeat;
  background-size: 100% 0.24em;
  background-position: 0 88%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.title__mark--lilac {
  --mark-color: var(--color-lilac);
}

.title__line {
  display: block;
}

/* ---- Lead / body text ---------------------------------------------------- */
.lead {
  font-size: var(--fs-lead);
  font-weight: var(--fw-light);
  line-height: var(--lh-relaxed);
}

.text-small {
  font-size: var(--fs-small);
  font-weight: var(--fw-light);
  line-height: var(--lh-relaxed);
}

/* ---- Feature card -------------------------------------------------------- */
.feature-card {
  padding-block: var(--space-4);
}

.feature-card__icon {
  position: relative;
  padding-bottom: var(--space-7);
}

.feature-card__icon::before {
  content: "";
  position: absolute;
  top: var(--space-3);
  left: calc(var(--space-3) * -1);
  width: var(--icon-circle);
  height: var(--icon-circle);
  background-color: var(--color-mist);
  border-radius: var(--radius-round);
}

.feature-card__icon img {
  position: relative;
  z-index: 1;
  width: 57px;
  height: 57px;
}

.feature-card__title {
  margin-bottom: var(--space-2);
  font-size: var(--fs-h3);
}

/* ---- Video thumbnail ----------------------------------------------------- */
.video-thumb {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  background: var(--color-black);
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-base) var(--ease), opacity var(--duration-base) var(--ease);
}

.video-thumb:hover img:not(.play-icon) {
  transform: scale(1.03);
  opacity: 0.9;
}

.video-thumb .play-icon,
.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--play-size);
  height: var(--play-size);
  translate: -50% -50%;
  pointer-events: none;
}

.video-thumb:focus-visible {
  outline-offset: 4px;
}

/* ---- Carousel (scroll-snap, no library) -------------------------------- */
.carousel {
  position: relative;
}

.carousel__controls {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.carousel__btn {
  display: grid;
  place-items: center;
  width: var(--carousel-btn);
  height: var(--carousel-btn);
  color: var(--color-plum);
  background-color: var(--color-mist);
  border-radius: var(--radius-round);
  transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.carousel__btn:hover:not(:disabled) {
  color: var(--color-white);
  background-color: var(--color-plum);
}

.carousel__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.carousel__btn svg {
  width: 18px;
  height: 18px;
}

/* Full-bleed track that still lines up with the container edge.
   --bleed = distance from the viewport edge to the container edge. */
.carousel__viewport {
  --bleed: max(var(--gutter), (100vw - var(--container)) / 2);

  display: flex;
  margin-inline: calc(var(--bleed) * -1);
  padding-inline: var(--bleed);
  scroll-padding-inline: var(--bleed);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  list-style: none;
}

.carousel__viewport::-webkit-scrollbar {
  display: none;
}

.carousel__viewport.is-dragging {
  scroll-snap-type: none;
  cursor: grabbing;
  user-select: none;
}

.carousel__viewport.is-dragging a {
  pointer-events: none;
}

.carousel__slide {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

/* ---- Timeline item ------------------------------------------------------- */
.timeline-item {
  --item-gap: var(--space-10);
  --media-w: 500px;
  --media-h: 290px;

  padding-right: var(--item-gap);
}

.timeline-item:last-child .timeline-item__line {
  visibility: hidden;
}

.timeline-item__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.timeline-item__media {
  position: relative;
  display: block;
  width: var(--media-w);
  height: var(--media-h);
  overflow: hidden;
  background: var(--color-mist);
}

.timeline-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-base) var(--ease);
}

.timeline-item__link:hover .timeline-item__media img:not(.timeline-item__play) {
  transform: scale(1.03);
}

.timeline-item__media .timeline-item__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  translate: -50% -50%;
}

.timeline-item__track {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: calc(var(--item-gap) * -1);
}

.timeline-item__line {
  flex: 1;
  height: var(--line-weight);
  margin-block: var(--space-5);
  background-color: var(--color-lilac);
}

.timeline-item__dot {
  position: absolute;
  left: 0;
  width: 30px;
  height: 30px;
  background-color: var(--color-lilac);
  border: var(--line-weight) solid var(--color-lilac);
  border-radius: var(--radius-round);
  transition: background-color var(--duration-fast) var(--ease);
}

.timeline-item__link:hover .timeline-item__dot,
.timeline-item__link:focus-visible .timeline-item__dot {
  background-color: var(--color-plum);
}

.timeline-item__year {
  font-size: var(--fs-h3-lg);
  line-height: var(--lh-tight);
}

.timeline-item__label {
  margin-top: var(--space-1);
  font-size: var(--fs-small);
  font-weight: var(--fw-light);
  color: var(--color-text-muted);
}

/* ---- Logo row ------------------------------------------------------------ */
.logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 45px;
}

.logo-row img {
  width: 200px;
  max-height: 68px;
  object-fit: contain;
}

/* ---- Form ---------------------------------------------------------------- */
.form {
  display: grid;
  gap: var(--space-4);
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  color: var(--color-text-strong);
}

.field__input {
  width: 100%;
  height: var(--input-height);
  padding: 0 var(--space-3);
  font-size: var(--fs-small);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}

.field__input::placeholder {
  color: var(--color-placeholder);
}

.field__input:hover {
  border-color: var(--color-text-muted);
}

.field__input:focus {
  outline: none;
  border-color: var(--color-plum);
  box-shadow: 0 0 0 3px rgb(86 59 86 / 0.25);
}

.field__input:user-invalid {
  border-color: var(--color-error);
}

.field__hint {
  font-size: var(--fs-micro);
  color: var(--color-text-muted);
}

.form__honeypot {
  position: absolute;
  left: -9999px;
}

.form__actions {
  display: flex;
  justify-content: center;
  padding-top: var(--space-2);
}

.form-status {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  font-size: var(--fs-small);
  border-radius: var(--radius-md);
}

.form-status:empty {
  display: none;
}

.form-status--success {
  color: var(--color-text);
  background-color: var(--color-white);
  border: var(--border-width) solid var(--color-subtle);
}

.form-status--success strong {
  display: block;
  font-size: 18px;
  font-weight: var(--fw-medium);
}

.form-status--error {
  color: var(--color-error);
  background-color: #fbecec;
}

.form-status__icon {
  flex: 0 0 auto;
  width: 35px;
}

/* ---- Card (waitlist form wrapper) --------------------------------------- */
.card {
  padding: var(--space-6) 140px var(--space-8);
  background-color: var(--color-surface);
  border-radius: var(--radius-sm);
}

.card__header {
  margin-bottom: var(--space-5);
  text-align: center;
  color: var(--color-text-muted);
}

.card__title {
  margin-bottom: var(--space-2);
  font-size: var(--fs-h4);
  color: var(--color-text-strong);
}

.card__text {
  font-size: var(--fs-caption);
  line-height: var(--lh-relaxed);
}

/* ---- Close button -------------------------------------------------------- */
.close-btn {
  display: grid;
  place-items: center;
  width: var(--close-size);
  height: var(--close-size);
  color: var(--color-black);
  background-color: var(--color-white);
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-float);
  transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.close-btn:hover {
  color: var(--color-white);
  background-color: var(--color-plum);
}

.close-btn svg {
  width: 14px;
  height: 14px;
}

/* ---- Modal (native <dialog>) -------------------------------------------- */
.modal {
  width: min(100% - (var(--gutter) * 2), 949px);
  max-width: none;
  max-height: none;
  padding: 0;
  margin: auto;
  overflow: visible;
  color: var(--color-text);
  background: var(--color-white);
  border: 0;
  box-shadow: var(--shadow-modal);
}

.modal::backdrop {
  background-color: var(--color-overlay);
}

.modal[open] {
  animation: modal-in var(--duration-base) var(--ease-out);
}

.modal[open]::backdrop {
  animation: fade-in var(--duration-base) var(--ease-out);
}

.modal__close {
  position: absolute;
  top: calc(var(--space-3) * -1);
  right: calc(var(--space-3) * -1);
  z-index: 2;
}

.modal__body {
  max-height: calc(100vh - 80px);
  overflow: auto;
}

.modal--video {
  width: min(100% - (var(--gutter) * 2), 800px);
  background: var(--color-black);
}

.modal--video video,
.modal--video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100vh - 80px);
  border: 0;
  background: var(--color-black);
}

.modal--lightbox {
  width: min(100% - (var(--gutter) * 2), 1000px);
  background: transparent;
  box-shadow: none;
}

.modal--lightbox .modal__media img {
  width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
}

.modal--lightbox .modal__media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: var(--color-black);
}

.modal__caption {
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  text-align: center;
  color: var(--color-white);
}

.modal__nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}

.modal__nav--prev {
  left: calc(var(--carousel-btn) * -1 - var(--space-3));
}

.modal__nav--next {
  right: calc(var(--carousel-btn) * -1 - var(--space-3));
}

/* Content modal: copy on the left, image on the right */
.modal--content {
  display: grid;
}

.modal__grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
}

.modal__content {
  padding: 36px;
}

.modal__title {
  margin-bottom: var(--space-1);
  font-family: var(--font-serif);
  font-size: var(--fs-h2-modal);
}

.modal__subtitle {
  margin-bottom: 25px;
  font-family: var(--font-serif);
  font-size: var(--fs-h3);
}

.modal__text {
  margin-bottom: 35px;
  font-size: 15px;
  font-weight: var(--fw-light);
}

.modal__image {
  min-height: 339px;
  background-position: center;
  background-size: cover;
}

/* Small choice modal */
.modal--sm {
  width: min(100% - (var(--gutter) * 2), 335px);
}

.modal--sm .modal__content {
  padding: 45px var(--space-4);
  text-align: center;
}

.modal--sm .modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  line-height: var(--lh-tight);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Notice bar ---------------------------------------------------------- */
.notice-bar {
  padding-block: var(--space-3);
  font-size: var(--fs-body);
  text-align: center;
  color: var(--color-white);
  background-color: var(--color-plum);
}

.notice-bar__link {
  margin-left: var(--space-4);
  color: var(--color-white);
  text-decoration: none;
  border-bottom: 2px solid currentColor;
}

.notice-bar__link:hover {
  color: var(--color-lilac);
}

.notice-bar :focus-visible {
  outline-color: var(--color-white);
}

/* ---- Watermark ----------------------------------------------------------- */
.watermark {
  font-family: var(--font-display);
  font-size: var(--fs-watermark);
  line-height: 1;
  color: var(--color-white);
  writing-mode: vertical-rl;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* ---- Site header --------------------------------------------------------- */
.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: var(--z-header);
  padding-block: var(--header-pad);
}

.site-header__brand {
  display: inline-block;
}

.site-header__brand img {
  width: 163px;
}

/* ---- Site footer --------------------------------------------------------- */
.site-footer {
  padding-block: var(--space-6);
  color: var(--color-white);
  background-color: var(--color-plum);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.site-footer__legal {
  font-family: var(--font-meta);
  font-size: var(--fs-micro);
  font-weight: var(--fw-light);
}

.site-footer :focus-visible {
  outline-color: var(--color-white);
}

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 991px) {
  .card {
    padding-inline: var(--space-8);
  }

  .feature-card__icon {
    margin-left: var(--space-2);
  }

  .logo-row {
    gap: 16px;
  }

  .modal__grid {
    grid-template-columns: 1fr;
  }

  .modal__image {
    min-height: 184px;
    order: -1;
  }

  .modal__nav--prev { left: var(--space-2); }
  .modal__nav--next { right: var(--space-2); }
}

@media (max-width: 767px) {
  .timeline-item {
    --item-gap: var(--space-8);
    --media-w: 300px;
    --media-h: 175px;
  }

  .logo-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding-inline: 24px;
  }

  .logo-row img {
    width: 100%;
  }

  .card {
    padding-inline: var(--space-6);
  }

  .site-header__brand img {
    width: 120px;
  }

  .notice-bar {
    font-size: var(--fs-caption);
  }

  .notice-bar__link {
    margin-left: var(--space-3);
  }
}

@media (max-width: 479px) {
  .timeline-item {
    --media-w: 250px;
    --media-h: 145px;
  }

  .logo-row {
    gap: 8px;
    padding-inline: 18px;
  }

  .logo-row img {
    max-height: 43px;
  }

  .form__row {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .card {
    padding: var(--space-5) var(--space-4) var(--space-6);
  }

  .site-footer {
    padding-block: var(--space-4);
  }

  .site-footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .modal__content {
    padding: var(--space-6) var(--space-4) var(--space-4);
  }

  .btn {
    padding-inline: var(--space-4);
  }
}
