/* Homepage only: stacking portfolio cards, the window zoom, the services cards and the FAQ slide-in. */

/* Stacking cards: each project is one wide browser window. As you scroll, the next one slides over the one before. */
.deck { display: flex; flex-direction: column; align-items: center; gap: 24px; margin-top: 40px; }
/* Read aloud, not shown. */
.deck-title, .deck .project-body h3 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The width also follows the screen height, so a whole card fits on screen. */
.deck-slot { box-sizing: border-box; width: min(100%, 1040px, max(520px, calc((100svh - 290px) * 1.6))); }
.deck .project { height: 100%; border-radius: 14px; }
html.fx .deck .project:hover { transform: none; }

.deck .project-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-content: center; column-gap: 32px; padding: 18px 24px 20px; border-top: 1px solid var(--line); }
.deck .project-body > * { grid-column: 1; }
.deck .project-meta { margin-bottom: 8px; }
.deck .project-body p { margin: 0; font-size: 15.5px; }
.deck .tags { display: none; }
.deck .project-body > .project-links { grid-column: 2; grid-row: 1 / span 2; align-self: center; gap: 12px; margin: 0; padding: 0; border: 0; }
.deck .project-links a { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 44px; padding: 0 20px; border: 1px solid var(--btn-border); border-radius: 8px; white-space: nowrap; }
.deck .project-links a:first-child { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }

/* The quote panel is the last card. */
.deck .cta-panel { box-sizing: border-box; height: 100%; border-radius: 14px; }

/* Added by deck.js when a whole card fits on the screen. Without it the cards are a normal list. */
.deck.is-stacked { gap: 16vh; }
.deck.is-stacked .deck-slot { position: sticky; top: calc(var(--top) + var(--i) * 14px); margin-bottom: calc((var(--n) - 1 - var(--i)) * 14px); transform-origin: 50% 0; border-radius: 14px; box-shadow: 0 -14px 36px -14px rgba(0, 0, 0, 0.55); }
/* Extra scrolling room, so the last card stays in place for a moment before the page moves on. */
.deck.is-stacked::after { content: ""; flex: none; height: 60svh; }
/* The shade over a card that is covered. */
.deck.is-stacked .deck-slot::after { content: ""; position: absolute; inset: 0; border-radius: 14px; background: var(--bg); opacity: var(--shade, 0); pointer-events: none; }
/* A card must stay solid while it passes over another, so the page's fade-in is switched off here. */
.deck.is-stacked .project { opacity: 1 !important; transform: none !important; }

@media (max-width: 760px) {
  .deck { margin-top: 28px; }
  .deck-slot { width: 100%; }
  .deck .project-body { display: flex; justify-content: center; padding: 14px 16px 16px; }
  .deck .project-body p { font-size: 15px; }
  .deck .project-body > .project-links { align-self: stretch; margin-top: 0; padding-top: 18px; }
  /* Descriptions stop at four lines, so the cards are close to the same height. */
  .deck.is-stacked .project-body > p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .deck .project-links a { flex: 1; }
  .deck .cta-panel { gap: 14px; padding: 24px 20px; }
  .deck .cta-panel img { max-width: 190px; }
  .deck .cta-panel h3 { font-size: 26px; }
}

/* FAQ scroll effect, switched on by lib/faq-slide.js: the questions slide in from the right, one after another, while the
   heading and help card come from the left. The look of the FAQ is unchanged. */
.faq .rise { opacity: 0; translate: 140px 0; }
.faq :is(.faq-head, .faq-help).rise { translate: -140px 0; }
.faq .rise.is-in, .faq .rise:focus-within { opacity: 1; translate: 0 0; transition: opacity 0.55s ease var(--wait, 0s), translate 0.65s cubic-bezier(0.22, 1, 0.36, 1) var(--wait, 0s), border-color 0.25s ease; }
@media (max-width: 760px) {
  .faq .rise { translate: 90px 0; }
  .faq :is(.faq-head, .faq-help).rise { translate: -90px 0; }
  .faq .rise.is-in, .faq .rise:focus-within { translate: 0 0; }
}

/* The homepage window flies into the portfolio cards (lib/zoom.js). */
/* A column, so the space under the window never merges with the dots' margin and the page keeps its length. */
.hero-visual { position: relative; z-index: 5; display: flex; flex-direction: column; }

/* The services cards below are centred on the screen, which already leaves room after the last portfolio card. */
main section#portfolios:has(.deck.is-stacked) { padding-bottom: 0; }

/* The heading stays above the cards while they stack. */
#portfolios .section-head { position: sticky; top: 12px; margin-bottom: 0; }
#portfolios .deck { margin-top: 24px; }
#portfolios .deck-slot { z-index: 1; container-type: inline-size; width: min(100%, 1040px); }
/* Wide cards: on a shorter screen the screenshot shows less of its lower part, so a whole card still fits. */
@media (min-width: 761px) {
  #portfolios .project-media .shot { aspect-ratio: auto; height: min(62.5cqw, max(260px, calc(100svh - 300px))); }
}
#portfolios .cta-panel { gap: 14px; padding-block: 24px; }
#portfolios .cta-panel img { max-width: min(260px, 28svh); }
@media (max-width: 760px) {
  #portfolios .cta-panel img { max-width: 190px; }
}

/* Services: one card at a time as you scroll. Without the scroll effect they are the usual grid. */
.offers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.offers :is(.app-offer, .before) { grid-column: 1 / -1; margin-top: 0; }
@media (max-width: 900px) { .offers { grid-template-columns: minmax(0, 1fr); } }

.story.is-on[data-story="all"] { height: calc((var(--count) * 55svh) + 100svh); }
#services .story.is-on .story-stage { gap: 20px; }
#services .story.is-on .section-title { margin: 0; text-align: center; }
#services .story.is-on .story-box { box-sizing: border-box; width: min(100%, 900px); margin-inline: auto; padding: 0; background: transparent; border: 0; }
#services .story.is-on .story-bars { width: min(100%, 320px); align-self: center; }

/* On a large screen a package card is wide: name and button on the left, what is included on the right. */
@media (min-width: 761px) {
  #services .story.is-on .package { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; column-gap: 40px; row-gap: 20px; padding: 40px; }
  #services .story.is-on .package > * { grid-column: 1; }
  #services .story.is-on .package .includes { grid-column: 2; grid-row: 1 / -1; justify-content: center; gap: 14px; padding: 0 0 0 40px; font-size: 18px; border-top: 0; border-left: 1px solid var(--line); }
  #services .story.is-on .package .facts { align-self: end; }
  #services .story.is-on .package h3 { font-size: 30px; }
  /* The app card follows the same two halves. */
  #services .story.is-on .app-offer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 40px; row-gap: 24px; align-items: start; padding: 40px; }
  #services .story.is-on .app-offer > :first-child { grid-column: 1; grid-row: 1; }
  #services .story.is-on .app-offer > :nth-child(2) { grid-column: 2; grid-row: 1 / -1; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding-left: 40px; border-left: 1px solid var(--line); font-size: 18px; }
  #services .story.is-on .app-offer-action { grid-column: 1; grid-row: 2; }
  #services .story.is-on .app-offer h3 { font-size: 30px; }
}
@media (max-width: 760px) {
  #services .story.is-on .package { gap: 14px; padding: 22px; }
  #services .story.is-on .app-offer { align-content: center; gap: 16px; padding: 22px; }
}

/* Before you start is the last card, looking like the others. */
#services .story.is-on .before { justify-content: center; gap: 28px; padding: 40px; background: var(--card); }
#services .story.is-on .before h3 { margin-bottom: 18px; font-size: 30px; }
#services .story.is-on .before ul { gap: 12px; font-size: 18px; }
@media (max-width: 760px) {
  #services .story.is-on .before { padding: 22px; }
  #services .story.is-on .before h3 { font-size: 24px; }
  #services .story.is-on .before ul { font-size: 16px; }
}

/* The pinned cards sit in the middle of the screen, so the section needs less space of its own. */
main section#services:has(.story.is-on) { padding-bottom: 0; }
