/* Atmos Sales Cards — phone portrait only.
   Styled to the Atmos International brand guidelines (Feb 2024) and to what
   atmosi.com actually ships:
     teal + grey are primary, yellow is secondary and reserved for CTAs
     Montserrat, headings at 600, body line-height 1.6
     square corners — the site sets border-radius:0 on buttons
     no text-transform and no letter-spacing anywhere
     a 2px teal bar as the signature divider (.bar on atmosi.com) */

/* Montserrat is a variable font, so one file covers every weight.
   SIL OFL 1.1, bundled so the site still renders its brand type offline. */
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* brand */
  --teal: #438F8E;         /* atmosi.com teal (print spec is #46918F) */
  --teal-dark: #35726F;
  --teal-40: #C6DDDD;      /* tints from the brand tint scale */
  --teal-20: #D9E9E8;
  --yellow: #DCAC0A;       /* secondary — CTAs only */
  --yellow-dark: #B78E08;
  --grey: #6F7174;
  --ink: #132222;          /* atmosi.com body colour */

  /* surfaces */
  --paper: #FFFFFF;
  --wash: #F4F4F4;
  --wash-2: #F0F1F1;
  --line: #E2E3E3;
  --line-strong: #B3B4B5;

  --tap: 44px;
  --topbar-h: 52px;
  --deckbar-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* One phone-portrait column. Wider screens get the same column, centred. */
  --col: 430px;

  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* Several components set display in a class, which would otherwise beat the
   UA rule for [hidden] and leave "hidden" elements on screen. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--wash-2);
  height: 100%;
}

body {
  margin: 0 auto;
  max-width: var(--col);
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  overscroll-behavior: none;
}

/* The deck owns the viewport height, so the page itself must not scroll. */
body.deck-active { overflow: hidden; height: 100%; }

h1, h2 { font-family: var(--font); font-weight: 600; line-height: 1.3; margin: 0; }

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* The signature 2px teal rule. */
.bar { display: block; height: 2px; background: var(--teal); }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) 14px 0;
  background: var(--paper);
  border-bottom: 2px solid var(--teal);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-right: auto;
  font-size: 14px;
  color: var(--grey);
}
.topbar__brand b { color: var(--ink); font-weight: 600; }
.topbar__brand img { flex: none; height: 22px; width: auto; }
.topbar__brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 2px solid var(--teal);
  background: var(--paper);
  color: var(--teal);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 200ms, color 200ms;
}
.topbar__icon svg { width: 18px; height: 18px; }
.topbar__icon:active { background: var(--teal); color: #fff; }

/* ---------- home ---------- */

.home__pad { padding: 16px 14px calc(28px + var(--safe-b)); }

.search { position: relative; margin-bottom: 16px; }

.search__icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--grey);
  pointer-events: none;
}

#search {
  width: 100%;
  height: var(--tap);
  padding: 0 40px;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming the page on focus */
  -webkit-appearance: none;
  border-radius: 0;
}
#search::placeholder { color: var(--grey); }
#search:focus { outline: none; border-color: var(--teal); }
#search::-webkit-search-cancel-button { display: none; }

.search__clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--grey);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* the cube face */
.cube { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  aspect-ratio: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent, var(--teal));
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background 140ms ease, border-color 140ms ease;
}
.tile:active { background: var(--wash); }

.tile__icon, .tile__glyph {
  width: 30px;
  height: 30px;
  margin-bottom: auto;
  object-fit: cover;
  background: var(--wash-2);
}
.tile__glyph {
  display: grid;
  place-items: center;
  background: var(--accent, var(--teal));
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
.tile__glyph[data-len="3"] { font-size: 10px; }
.tile__glyph[data-len="4"] { font-size: 8.5px; }

.tile__name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.tile__hint {
  min-height: 1.3em;
  font-size: 10px;
  line-height: 1.3;
  color: var(--grey);
}
.tile--todo .tile__hint { color: var(--yellow-dark); font-weight: 600; }

.cube__empty { text-align: center; color: var(--grey); padding: 26px 0; }
.stamp { margin: 18px 0 0; text-align: center; font-size: 11.5px; color: var(--grey); }

/* ---------- deck ---------- */

.deck {
  display: flex;
  height: calc(100vh - var(--topbar-h) - var(--safe-t) - var(--deckbar-h) - var(--safe-b));
  height: calc(100dvh - var(--topbar-h) - var(--safe-t) - var(--deckbar-h) - var(--safe-b));
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  background: var(--wash-2);
}
.deck::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  padding: 12px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

/* the reference card itself */
.rcard {
  height: 100%;
  perspective: 1400px;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
/* The objections card has no second face, so it should not look tappable. */
.rcard--static { cursor: default; }

.rcard__inner {
  position: relative;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
}
.rcard.is-flipped .rcard__inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 15px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent, var(--teal));
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.face--back { transform: rotateY(180deg); }

.face__head { display: flex; align-items: center; gap: 11px; flex: none; }
.face__icon, .face__glyph {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: cover;
  background: var(--wash-2);
}
.face__glyph {
  display: grid;
  place-items: center;
  background: var(--accent, var(--teal));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.face__glyph[data-len="3"] { font-size: 12.5px; }
.face__glyph[data-len="4"] { font-size: 11px; }
.face__titles { min-width: 0; }
.face__titles h2 { font-size: 19px; }
.face__titles p { margin: 2px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--grey); }

.badge {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 8px;
  background: var(--teal-20);
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
}
.badge--todo { background: #FBF1D3; color: #8A6B05; }

/* Scrolls only if an app's copy runs long — the layout is sized so it
   normally does not need to. */
.face__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 13px;
}
.face__body::-webkit-scrollbar { display: none; }

/* Spread the sections evenly down the card rather than pooling the leftover
   height in one dead gap. Each section is a .grp so a heading never separates
   from its own content. No effect once the content fills the height. */
.face--front .face__body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.face--front .face__body > :last-child { margin-bottom: 0; }
.grp > :last-child { margin-bottom: 0; }

.lead {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
}

/* Section label sitting on the brand's 2px teal rule. Sentence case, because
   atmosi.com uses no text-transform. */
.rule {
  margin: 0 0 9px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--teal);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--teal-dark);
}

.points { margin: 0 0 14px; padding: 0; list-style: none; }
.points li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 7px;
  font-size: 13.5px;
  line-height: 1.4;
}
.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 2px;
  background: var(--accent, var(--teal));
}

.quote {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-left: 3px solid var(--accent, var(--teal));
  background: var(--wash);
  font-size: 13px;
  line-height: 1.4;
  color: #33403F;
}

.plain { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--grey); }

.qa { margin-bottom: 12px; }
.qa__q { margin: 0 0 3px; font-size: 13px; font-weight: 600; }
.qa__a {
  margin: 0;
  padding-left: 12px;
  border-left: 2px solid var(--teal-40);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--grey);
}

.face__foot { flex: none; margin-top: 16px; }

/* Yellow is the brand's CTA colour. Square, 2px border, exactly like .btn on
   atmosi.com. */
.ds {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: var(--tap);
  border: 2px solid var(--yellow);
  background: var(--yellow);
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 300ms, background 300ms, border 300ms;
}
.ds:active { background: var(--paper); color: var(--yellow-dark); }
.ds svg { width: 17px; height: 17px; }
.ds--missing {
  background: var(--paper);
  border: 2px dashed var(--line-strong);
  color: var(--grey);
  font-size: 13px;
}

.flip-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--grey);
}
.flip-hint svg { width: 13px; height: 13px; }

.note-todo {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--yellow);
  background: #FDF8E7;
  font-size: 12px;
  line-height: 1.45;
  color: #6B5504;
}

/* deck bar */
.deckbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--deckbar-h) + var(--safe-b));
  padding: 0 14px var(--safe-b);
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.deckbar__grid, .deckbar__share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 2px solid var(--teal);
  background: var(--paper);
  color: var(--teal);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 200ms, color 200ms;
}
.deckbar__grid svg, .deckbar__share svg { width: 18px; height: 18px; }
.deckbar__grid:active, .deckbar__share:active { background: var(--teal); color: #fff; }

.dots { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; }
.dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  background: var(--line);
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}
.dot[aria-selected="true"] { background: var(--teal); transform: scaleY(1.6); }

/* ---------- install sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(19, 34, 34, 0.55); }
.sheet__panel {
  position: relative;
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px 20px calc(18px + var(--safe-b));
  background: var(--paper);
  border-top: 4px solid var(--teal);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.18);
  text-align: center;
  animation: rise 0.24s ease;
  max-height: 90dvh;
  overflow-y: auto;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.sheet__icon { margin-bottom: 12px; }
.sheet__panel h2 { margin: 0 0 6px; font-size: 18.5px; }
.sheet__lede { margin: 0 0 14px; font-size: 13.5px; color: var(--grey); }
.sheet__foot { margin: 4px 0 14px; font-size: 11.5px; color: var(--grey); }

.steps { margin: 0 0 12px; padding-left: 20px; text-align: left; }
.steps li { margin-bottom: 8px; font-size: 13.5px; line-height: 1.5; }
.steps b { font-weight: 600; }

/* The iOS Share glyph, drawn inline so the instruction is unmistakable. */
.ios-share {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  vertical-align: -5px;
  margin: 0 2px;
  background: var(--teal-20);
  color: var(--teal-dark);
}
.ios-share svg { width: 12px; height: 12px; stroke-width: 2.2; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--tap);
  padding: 0 20px;
  border: 2px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 300ms, background 300ms;
}
.btn--block { width: 100%; }
.btn:active { background: var(--paper); color: var(--teal); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 80;
  padding: 10px 18px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Only the first trigger quote by default; taller phones have room for the
   second. Dropping it beats letting the front scroll.
   Sibling combinators, not nth-of-type — the quotes share <p> with the lead
   and the section rules, so counting by type would count those too. */
.face--front .quote ~ .quote { display: none; }
@media (min-height: 800px) {
  .face--front .quote ~ .quote { display: block; }
}

/* Short phones: tighten the card so both faces still fit without scrolling. */
@media (max-height: 700px) {
  .face { padding: 13px 13px 10px; }
  .face__icon, .face__glyph { width: 38px; height: 38px; }
  .face__titles h2 { font-size: 17px; }
  .lead { font-size: 14.5px; margin-bottom: 11px; }
  .points li { font-size: 12.5px; margin-bottom: 6px; }
  .quote { font-size: 12px; padding: 8px 10px; }
  .face__body { margin-top: 9px; }
  .face__foot { margin-top: 10px; }
  .flip-hint { margin-top: 6px; }
  .rule { margin-bottom: 6px; padding-bottom: 4px; }
  /* The back carries every objection, so it needs the most tightening.
     Montserrat runs taller than a system stack, which is what pushed this
     over on a 667px-tall phone. */
  .qa { margin-bottom: 6px; }
  .qa__q { font-size: 11.5px; }
  .qa__a, .plain { font-size: 11.5px; line-height: 1.32; }
  /* The back's subtitle is decorative — the header already names the app. */
  .face--back .face__titles p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .rcard__inner { transition: none !important; }
}
