@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.home {
  --card-line: var(--divider);
  --card-line-strong: rgba(35,35,38,0.24);

  width: 100%;
  max-width: 100%;
  /* overflow must stay visible — rail "+" marks extend past the section edge */
  color: var(--text-main);
}

html[data-theme="dark"] .home {
  --card-line-strong: rgba(236,236,238,0.26);
}

/* Text cards share the library card look: outline, mono tags, fill on hover. */

.home-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  transition: border-color .25s ease;
}

.home-card:hover {
  border-color: var(--card-line-strong);
}

.home-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-card__mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.home-card__mark--letter {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
}

.home-card__tag {
  min-width: 0;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-card__title {
  margin: 18px 0 8px;
  font-size: var(--fs-card-title);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 600;
}

.home-card__text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.5;
  text-wrap: pretty;
}

.home-card__bottom {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-card__arrow {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}

.home-card__arrow svg {
  transition: transform .3s var(--ease-out);
}

.home-card:hover .home-card__arrow {
  background: var(--text-main);
  border-color: var(--text-main);
  color: var(--bg-page);
}

.home-card:hover .home-card__arrow svg {
  transform: translate(1px, -1px);
}

.home-section {
  padding: 72px var(--gutter);
  scroll-margin-top: var(--header-h);
}

.home-section__head {
  margin-bottom: 32px;
}

.home-section__meta {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.02em;
}

.home-section__meta span {
  color: var(--green-text);
}

.home-section__title {
  margin: 0 0 12px;
  font-size: clamp(36px, 4vw, var(--fs-page-title));
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 600;
}

.home-section__text {
  max-width: 680px;
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-lead);
  line-height: 1.55;
  text-wrap: pretty;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-size: var(--fs-small);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--divider-strong);
  padding-bottom: 2px;
  transition: border-color .2s ease, color .2s ease;
}

button.home-link {
  padding: 0 0 2px;
  border-width: 0 0 1px;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.home-link:hover {
  border-color: currentColor;
}

/* Cases */

.home-cases {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 24px;
}

.home-case {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-case__media {
  position: relative;
  aspect-ratio: 4 / 3;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-inset);
}

.home-case__media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .6s var(--ease-out);
}

.home-case:hover .home-case__media img {
  transform: scale(1.03);
}

.home-case__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  background: rgba(18, 18, 20, 0.72);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
}

.home-case__type {
  margin: 0 0 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.02em;
}

.home-case__type span::before {
  content: "·";
  margin-right: 10px;
}

.home-case__title {
  margin: 0 0 8px;
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.home-case__text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.55;
  text-wrap: pretty;
}

.home-case__links {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

/* Services — list rows, not a wall of cards */

.home-services__group + .home-services__group {
  margin-top: 48px;
}

.home-services__title {
  margin: 0 0 8px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.home-services__title span {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.home-services__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--divider);
}

.home-service {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 16px 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--divider);
  align-items: start;
}

.home-service__icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--green-border);
  border-radius: var(--radius-md);
  background: var(--green-soft);
  color: var(--green-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.home-service__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-service:hover .home-service__icon {
  border-color: var(--green-text);
  background: var(--green-text);
  color: var(--bg-card);
}

.home-service__body {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.home-service__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
}

.home-service__row--meta {
  align-items: flex-start;
}

.home-service__title {
  margin: 0;
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.home-service__text {
  margin: 0;
  max-width: 52em;
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.55;
  text-wrap: pretty;
}

.home-service__price {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 6px;
  text-align: right;
  white-space: nowrap;
}

.home-service__amount {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.home-service__unit,
.home-service__term {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.home-service__term {
  flex: 0 0 auto;
  padding-top: 2px;
  text-align: right;
  white-space: nowrap;
}

.home-services__note {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--text-soft);
  font-size: var(--fs-small);
  line-height: 1.5;
}

/* Steps — tiles, separate from the services list */

.home-steps {
  margin-top: 72px;
  padding-top: 56px;
  border-top: 1px solid var(--divider);
}

.home-steps__title {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.home-steps__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.home-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  padding: 22px 22px 24px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: border-color .25s ease;
}

.home-step:hover {
  border-color: var(--card-line-strong);
}

.home-step__num {
  color: var(--green-text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
}

.home-step__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.home-step__title {
  margin: 0;
  font-size: var(--fs-card-title);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.home-step__text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.55;
  text-wrap: pretty;
}

/* Reviews — gallery of thank-you letter scans */

.home-reviews {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 20px;
}

.home-review {
  min-width: 0;
}

.home-review__open {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-review__open:focus-visible {
  outline: 2px solid var(--text-main);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.home-review__frame {
  display: block;
  aspect-ratio: 990 / 1400;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04),
    0 12px 28px rgba(0, 0, 0, 0.08);
  transition: box-shadow .35s var(--ease-out), transform .35s var(--ease-out);
}

.home-review__frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  transition: transform .6s var(--ease-out);
}

.home-review__open:hover .home-review__frame {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04),
    0 18px 36px rgba(0, 0, 0, 0.12);
}

.home-review__open:hover .home-review__frame img {
  transform: scale(1.02);
}

.home-review__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.home-review__company {
  font-size: var(--fs-ui);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.home-review__date {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.02em;
}

.home-letter {
  width: min(1100px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text-main);
  overflow: hidden;
}

.home-letter[open] {
  display: flex;
  flex-direction: column;
}

.home-letter::backdrop {
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(4px);
}

.home-letter__bar {
  flex: none;
  height: 52px;
  padding: 0 8px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider);
  font-weight: 600;
}

.home-letter__close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
}

.home-letter__close:hover {
  background: var(--bg-inset);
}

.home-letter__body {
  overflow-y: auto;
  background: #fff;
}

.home-letter__body img {
  width: 100%;
  height: auto;
  display: block;
}

.home-letter__body img + img {
  margin-top: 2px;
}

.home-letter--fit {
  width: fit-content;
}

.home-letter--fit .home-letter__body {
  overflow: hidden;
}

.home-letter--fit .home-letter__body img {
  width: auto;
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 32px - 54px);
  margin: 0 auto;
}

html.is-letter-open {
  overflow: hidden;
}

/* FAQ */

.home-faq-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 40px;
  align-items: start;
}

.home-faq-layout .home-section__head {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  margin-bottom: 0;
}

.home-faq-layout .home-section__text {
  max-width: 420px;
}

.home-faq {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-faq__item {
  border: 1px solid var(--card-line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: border-color .25s ease;
}

.home-faq__item:hover,
.home-faq__item[open] {
  border-color: var(--card-line-strong);
}

.home-faq__item summary {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.home-faq__item summary::-webkit-details-marker {
  display: none;
}

.home-faq__icon {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
}

.home-faq__icon::before,
.home-faq__icon::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--text-soft);
  transition: transform .25s var(--ease-out);
}

.home-faq__icon::after {
  transform: rotate(90deg);
}

.home-faq__item[open] .home-faq__icon::after {
  transform: rotate(0deg);
}

.home-faq__item summary:hover .home-faq__icon::before,
.home-faq__item summary:hover .home-faq__icon::after {
  background: var(--text-main);
}

.home-faq__item p {
  max-width: 720px;
  margin: 0;
  padding: 0 22px 20px;
  color: var(--text-muted);
  font-size: var(--fs-body);
  line-height: 1.6;
  text-wrap: pretty;
}

@media (max-width: 1023px) {
  .home-faq-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .home-faq-layout .home-section__head {
    position: static;
    margin-bottom: 32px;
  }

  .home-cases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-service__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .home-service__price,
  .home-service__term {
    text-align: left;
    justify-content: flex-start;
  }

  .home-steps__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-reviews {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 16px;
  }
}

@media (max-width: 767px) {
  .home-section {
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .home-section__head {
    margin-bottom: 24px;
  }

  .home-cases {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .home-card {
    padding: 18px;
  }

  .home-service {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px 14px;
    padding: 18px 0;
  }

  .home-service__icon {
    width: 36px;
    height: 36px;
  }

  .home-step {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px 14px;
    padding: 20px 0;
  }

  .home-faq__item summary {
    padding: 16px 18px;
  }

  .home-faq__item p {
    padding: 0 18px 18px;
  }

  .home-steps {
    margin-top: 56px;
    padding-top: 40px;
  }

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

  .home-step {
    padding: 18px 18px 20px;
  }

  .home-reviews {
    gap: 20px 12px;
  }
}
