/* ============================================
   FrontBack Scanner landing page (/frontback-scanner/)
   Extends the "Warm Heirloom Album" system in styles.css.
   Demo components use the fbd- prefix to avoid collisions.
   ============================================ */

/* Handwriting face for photo backs in the demos */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600&display=swap');

:root {
  /* The app's front/back color language: amber fronts (site --accent), cyan backs */
  --fb-back: #35788E;
  --fb-back-light: #E4EFF2;
  --fb-glass-hi: #2B2622;
  --fb-glass-lo: #171310;
  --fb-paper: #FAF6EC;
  --fb-ink: #2E5F74;
}

[data-theme="dark"] {
  --fb-back: #6FC0D4;
  --fb-back-light: #1B2A2F;
  --fb-glass-hi: #241F1B;
  --fb-glass-lo: #100D0B;
  --fb-paper: #F1EADB;
  --fb-ink: #33677D;
}

/* ---------- Hero ---------- */

.fb-hero {
  padding: 4.5rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.fb-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 78% 12%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.fb-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 3rem;
  align-items: center;
  position: relative;
}

.fb-hero__copy h1 {
  font-size: 2.6rem;
  margin-bottom: 1rem;
}

.fb-hero__sub {
  font-size: 1.15rem;
  max-width: 34rem;
}

.fb-hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.6rem 0 1rem;
}

.fb-hero__meta {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0;
  align-items: center;
  margin-bottom: 0;
}

.fb-hero__meta span + span::before {
  content: '·';
  margin: 0 0.55rem;
  color: var(--border);
}

/* App icon panel */
.fb-hero__visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  text-align: center;
}

.fb-hero__icon {
  width: 200px;
  height: 200px;
  filter: drop-shadow(0 18px 34px rgba(61, 43, 31, 0.28));
}

[data-theme="dark"] .fb-hero__icon {
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5));
}

.fb-hero__byline {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.fb-hero__byline a {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.fb-hero__byline a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Section kicker shared on this page */
.fb-kicker {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.fb-section-head {
  max-width: 44rem;
  margin: 0 auto 2.6rem;
  text-align: center;
}

/* ============================================
   Workflow demo — a miniature of the app itself
   State machine driven by [data-stage] on .fbd
   Stages: start → preview → detected → scanfronts → fronts
           → flipping → flipped → scanbacks → done
   ============================================ */

.fbd {
  max-width: 980px;
  margin: 0 auto;
}

/* App window chrome */
.fbd-window {
  background: linear-gradient(180deg, #211d19, #191512);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.fbd-titlebar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.fbd-dots {
  display: flex;
  gap: 0.4rem;
}

.fbd-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4a423b;
}

.fbd-dots span:nth-child(1) { background: #E0655A; }
.fbd-dots span:nth-child(2) { background: #E0B14F; }
.fbd-dots span:nth-child(3) { background: #7CB86A; }

.fbd-wordmark {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: #E8DFD2;
}

.fbd-toolchips {
  margin-left: auto;
  display: flex;
  gap: 0.45rem;
}

/* Real buttons: PREVIEW and SCAN drive the demo just like the big action
   button. Disabled between their turns; the next one pulses as a hint. */
.fbd-toolchip {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #9c8f80;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  padding: 0.24rem 0.65rem;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  cursor: default;
}

.fbd-toolchip:not([disabled]) {
  cursor: pointer;
  color: #E8DFD2;
  border-color: rgba(255, 255, 255, 0.3);
}

.fbd-toolchip:not([disabled]):hover {
  color: #1d1712;
  background: var(--accent);
  border-color: var(--accent);
}

.fbd-toolchip.is-next {
  border-color: var(--accent);
  animation: fbd-chip-pulse 2s ease-out infinite;
}

@keyframes fbd-chip-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(224, 177, 79, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(224, 177, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 177, 79, 0); }
}

/* Toolbar chips light up while their pass runs */
.fbd[data-stage="preview"] .fbd-toolchip--preview,
.fbd[data-stage="scanfronts"] .fbd-toolchip--scan,
.fbd[data-stage="scanbacks"] .fbd-toolchip--scan {
  color: #1d1712;
  background: var(--accent);
  border-color: var(--accent);
}

.fbd-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 0;
}

/* --- Scanner bed --- */

.fbd-bedwrap {
  padding: 1.1rem;
}

.fbd-bed {
  position: relative;
  aspect-ratio: 13 / 9.6;
  border-radius: 10px;
  background:
    radial-gradient(ellipse 120% 90% at 50% -20%, var(--fb-glass-hi), var(--fb-glass-lo));
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

/* Faint ruler ticks along the top, like a flatbed */
.fbd-bed::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background-image: repeating-linear-gradient(
    to right,
    rgba(255, 255, 255, 0.16) 0 1px,
    transparent 1px 9.09%
  );
  opacity: 0.5;
}

/* Scan-light sweep */
.fbd-sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -14%;
  width: 10%;
  background: linear-gradient(
    to right,
    transparent,
    rgba(224, 177, 79, 0.16) 35%,
    rgba(240, 196, 102, 0.85) 50%,
    rgba(224, 177, 79, 0.16) 65%,
    transparent
  );
  filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

.fbd[data-stage="preview"] .fbd-sweep,
.fbd[data-stage="scanfronts"] .fbd-sweep,
.fbd[data-stage="scanbacks"] .fbd-sweep {
  animation: fbd-sweep 1.55s ease-in-out;
}

@keyframes fbd-sweep {
  0%   { opacity: 0; transform: translateX(0); }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(1250%); }
}

/* --- Photos on the glass --- */

.fbd-photo {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  transform: rotate(var(--rot));
  aspect-ratio: 10 / 7;
}

.fbd-photo__flip {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.35, 0, 0.25, 1);
  transition-delay: var(--flipdelay, 0s);
}

/* Photos flip over from the flipping stage onward */
.fbd[data-stage="flipping"] .fbd-photo__flip,
.fbd[data-stage="flipped"] .fbd-photo__flip,
.fbd[data-stage="scanbacks"] .fbd-photo__flip,
.fbd[data-stage="done"] .fbd-photo__flip {
  transform: rotateY(180deg);
}

.fbd-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 2px;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.55);
}

/* Front: the picture inside a white print border */
.fbd-face--front {
  background: #f4f1e8;
  padding: 4.5%;
}

.fbd-face--front i {
  display: block;
  width: 100%;
  height: 100%;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
}

/* Back: aged paper with handwriting */
.fbd-face--back {
  transform: rotateY(180deg);
  background:
    linear-gradient(160deg, var(--fb-paper), #EDE5D2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6%;
}

.fbd-face--back span {
  font-family: 'Caveat', 'Bradley Hand', cursive;
  font-size: clamp(0.7rem, 1.55vw, 1.05rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--fb-ink);
  text-align: center;
  transform: rotate(-2deg);
}

/* --- Misoriented prints: sideways / upside down on the glass --- */

/* Each print's imagery lives in a __lay layer. For the two misoriented
   prints the footprint (box, tag, badge) stays readable and only the
   print itself is turned inside it. */
.fbd-photo__lay {
  position: absolute;
  inset: 0;
}

.fbd-photo--r90 {
  aspect-ratio: 7 / 10;
}

.fbd-photo--r90 .fbd-photo__lay {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 142.857%; /* the print's long side spans the portrait footprint's height */
  aspect-ratio: 10 / 7;
  transform: translate(-50%, -50%) rotate(90deg);
}

.fbd-photo--r180 .fbd-photo__lay {
  transform: rotate(180deg);
}

/* As soon as a print is detected, its corrected file is previewed in place:
   the upright print aspect-fit inside its footprint over a blurred fill,
   the same way the app's bed shows an auto-oriented photo. */
.fbd-photo__fix {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.45s ease;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 2;
}

.fbd-photo__fix::before {
  content: '';
  position: absolute;
  inset: -12px;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  filter: blur(9px) brightness(0.45);
}

.fbd-photo__fix i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  aspect-ratio: 10 / 7;
  transform: translate(-50%, -50%);
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 2px #f4f1e8, 0 4px 12px rgba(0, 0, 0, 0.5);
}

.fbd[data-stage="detected"] .fbd-photo__fix,
.fbd[data-stage="scanfronts"] .fbd-photo__fix,
.fbd[data-stage="fronts"] .fbd-photo__fix {
  opacity: 1;
  transition-delay: calc(var(--boxdelay, 0s) + 0.1s);
}

/* ↻ badge: the app flags a print it will turn upright */
.fbd-orient {
  position: absolute;
  top: 4px;
  left: -2px;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: clamp(0.5rem, 1.15vw, 0.68rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #1d1712;
  background: var(--accent);
  border-radius: 3px;
  padding: 0.08em 0.5em;
  white-space: nowrap;
  transition: opacity 0.4s ease;
}

.fbd[data-stage="flipped"] .fbd-orient,
.fbd[data-stage="scanbacks"] .fbd-orient,
.fbd[data-stage="done"] .fbd-orient {
  opacity: 0;
}

/* Once the fronts are saved, tapping the glass flips the photos */
.fbd[data-stage="fronts"] .fbd-bed {
  cursor: pointer;
}

/* --- Detection boxes + filename tags --- */

.fbd-photo__box {
  position: absolute;
  inset: -5px;
  border: 2px dashed var(--accent);
  border-radius: 4px;
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3), border-color 0.4s ease;
  transition-delay: var(--boxdelay, 0s);
  pointer-events: none;
  z-index: 4;
}

/* Boxes appear once detected, vanish while photos are being flipped,
   then return in the back color */
.fbd[data-stage="detected"] .fbd-photo__box,
.fbd[data-stage="scanfronts"] .fbd-photo__box,
.fbd[data-stage="fronts"] .fbd-photo__box,
.fbd[data-stage="flipped"] .fbd-photo__box,
.fbd[data-stage="scanbacks"] .fbd-photo__box,
.fbd[data-stage="done"] .fbd-photo__box {
  opacity: 1;
  transform: scale(1);
}

.fbd[data-stage="flipped"] .fbd-photo__box,
.fbd[data-stage="scanbacks"] .fbd-photo__box,
.fbd[data-stage="done"] .fbd-photo__box {
  border-color: var(--fb-back);
}

.fbd-tag {
  position: absolute;
  top: -1.5em;
  left: -2px;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: clamp(0.5rem, 1.15vw, 0.68rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #1d1712;
  background: var(--accent);
  border-radius: 3px;
  padding: 0.08em 0.5em;
  white-space: nowrap;
  transition: background 0.4s ease, color 0.4s ease;
}

.fbd-tag i {
  font-style: normal;
}

.fbd-tag i::after {
  content: '';
}

.fbd[data-stage="flipped"] .fbd-tag,
.fbd[data-stage="scanbacks"] .fbd-tag,
.fbd[data-stage="done"] .fbd-tag {
  background: var(--fb-back);
  color: #fff;
}

.fbd[data-stage="flipped"] .fbd-tag i::after,
.fbd[data-stage="scanbacks"] .fbd-tag i::after,
.fbd[data-stage="done"] .fbd-tag i::after {
  content: '_b';
}

/* --- Files panel --- */

.fbd-files {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.1rem 1.1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fbd-files__head {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: #9c8f80;
  text-transform: none;
  margin-bottom: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fbd-files__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 0.8rem;
  align-content: start;
  flex: 1;
}

.fbd-pair {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.fbd-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  transition-delay: var(--filedelay, 0s);
  min-width: 0;
}

/* Front files land after the first scan pass, backs after the second */
.fbd[data-stage="fronts"] .fbd-file--front,
.fbd[data-stage="flipping"] .fbd-file--front,
.fbd[data-stage="flipped"] .fbd-file--front,
.fbd[data-stage="scanbacks"] .fbd-file--front,
.fbd[data-stage="done"] .fbd-file--front,
.fbd[data-stage="done"] .fbd-file--back {
  opacity: 1;
  transform: translateY(0);
}

.fbd-file__thumb {
  width: 34px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 3px;
  background-color: #f4f1e8;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  border: 2px solid transparent;
}

.fbd-file--front .fbd-file__thumb {
  border-color: var(--accent);
}

.fbd-file--back .fbd-file__thumb {
  border-color: var(--fb-back);
  background-image: none;
  background: linear-gradient(160deg, var(--fb-paper), #EDE5D2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Caveat', cursive;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fb-ink);
}

.fbd-file__name {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.6rem;
  color: #cdc2b2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fbd-file--back .fbd-file__name b {
  color: var(--fb-back);
  font-weight: 700;
}

.fbd-files__count {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: #9c8f80;
  min-height: 1.2em;
}

.fbd-files__count b {
  color: #E8DFD2;
}

/* --- Controls under the window --- */

.fbd-controls {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

.fbd-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.1rem;
  list-style: none;
  counter-reset: fbdstep;
  flex: 1;
  min-width: 260px;
}

.fbd-steps li {
  counter-increment: fbdstep;
  display: flex;
}

/* Each step is a real button: click to jump the demo to that step. */
.fbd-steps button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: color 0.3s ease;
}

.fbd-steps button::before {
  content: counter(fbdstep);
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.fbd-steps button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.fbd-steps li.is-active button {
  color: var(--text-primary);
  font-weight: 600;
}

.fbd-steps li.is-active button::before {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.fbd-steps li.is-done button {
  color: var(--text-secondary);
}

.fbd-steps li.is-done button::before {
  content: '✓';
  border-color: var(--green);
  color: var(--green);
}

/* Hover affordance — last so it also lifts done steps; the active step
   keeps its filled circle. */
.fbd-steps li:not(.is-active) button:hover {
  color: var(--text-primary);
}

.fbd-steps li:not(.is-active) button:hover::before {
  border-color: var(--accent);
}

.fbd-action {
  min-width: 15rem;
}

.fbd-action[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none !important;
}

.fbd-caption {
  width: 100%;
  font-size: 0.98rem;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0.4rem 0 0;
  min-height: 1.6em;
}

/* ============================================
   Flip-card demo — "the back is half the story"
   ============================================ */

.fb-flip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}

.fb-flipcard {
  display: block;
  width: min(380px, 100%);
  margin: 0 auto;
  aspect-ratio: 10 / 8;
  perspective: 1200px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fb-flipcard__inner {
  display: block; /* spans inside the <button>: inline width/height would collapse */
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.35, 0, 0.25, 1);
}

.fb-flipcard.is-flipped .fb-flipcard__inner {
  transform: rotateY(180deg);
}

.fb-flipcard__face {
  display: block;
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
}

.fb-flipcard__face--front {
  background: #f4f1e8;
  padding: 4%;
  transform: rotate(-1.5deg);
}

.fb-flipcard__face--front i {
  display: block;
  width: 100%;
  height: 100%;
  background: url('/images/apps-demo/family-04.jpg') center/cover;
}

.fb-flipcard__face--back {
  transform: rotateY(180deg) rotate(1.5deg);
  background: linear-gradient(160deg, var(--fb-paper), #EAE1CC);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 8%;
}

.fb-flipcard__writing {
  font-family: 'Caveat', 'Bradley Hand', cursive;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 600;
  color: var(--fb-ink);
  line-height: 1.3;
  text-align: center;
  transform: rotate(-2.5deg);
}

.fb-flipcard__stamp {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(46, 95, 116, 0.45);
  border: 1px solid rgba(46, 95, 116, 0.3);
  border-radius: 3px;
  padding: 0.2em 0.7em;
  transform: rotate(-2.5deg);
}

.fb-flipcard__hint {
  display: block;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.4rem;
}

.fb-flip__extract {
  margin-top: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--fb-back);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
}

.fb-flip__extract-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fb-back);
  margin-bottom: 0.5rem;
}

.fb-flip__extract ul {
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.fb-flip__extract li {
  padding: 0.18rem 0;
}

.fb-flip__extract li b {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   Time-savings slider
   ============================================ */

.fb-calc {
  max-width: 760px;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.2rem 2.4rem;
}

.fb-calc__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.fb-calc__label {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.fb-calc__value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.fb-calc input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin: 0.4rem 0 1.6rem;
  cursor: pointer;
}

.fb-calc__compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.fb-calc__cell {
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border-light);
}

.fb-calc__cell--old {
  background: var(--bg-warm);
}

.fb-calc__cell--new {
  background: var(--accent-light);
  border-color: var(--accent);
}

.fb-calc__cell-title {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.fb-calc__cell--new .fb-calc__cell-title {
  color: var(--accent);
}

.fb-calc__hours {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.fb-calc__cell-note {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0.4rem 0 0;
}

.fb-calc__saved {
  text-align: center;
  font-size: 1.05rem;
  margin: 1.4rem 0 0;
  color: var(--text-secondary);
}

.fb-calc__saved b {
  color: var(--green);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.fb-calc__fine {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.8rem 0 0;
}

/* ============================================
   Feature grid
   ============================================ */

.fb-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.3rem;
}

.fb-feature {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.fb-feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Illustrated tile icons, same visual language as the site's scan-*.svg set */
.fb-feature__icon {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.fb-feature h3 {
  font-size: 1.12rem;
}

.fb-feature p {
  font-size: 0.92rem;
  margin: 0;
}

/* ============================================
   Timeline Scan service bridge
   ============================================ */

.fb-bridge {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.3rem;
  margin-top: 2.4rem;
}

.fb-bridge__card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.9rem 1.8rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.fb-bridge__card p {
  flex: 1;
}

.fb-bridge__tag {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.55rem;
}

.fb-bridge__card .btn {
  align-self: flex-start;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .fb-hero__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .fb-hero__sub {
    margin-left: auto;
    margin-right: auto;
  }

  .fb-hero__buttons,
  .fb-hero__meta {
    justify-content: center;
  }

  .fb-hero__icon {
    width: 150px;
    height: 150px;
  }

  .fbd-body {
    grid-template-columns: 1fr;
  }

  .fbd-files {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .fb-features {
    grid-template-columns: 1fr 1fr;
  }

  .fb-flip {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .fb-bridge {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .fb-hero__copy h1 {
    font-size: 2rem;
  }

  .fb-features {
    grid-template-columns: 1fr;
  }

  .fb-calc {
    padding: 1.5rem 1.2rem;
  }

  .fb-calc__compare {
    grid-template-columns: 1fr;
  }

  .fbd-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .fbd-action {
    width: 100%;
  }
}

/* ============================================
   Help page (/frontback-scanner/help/) — fbh- prefix
   ============================================ */

.fbh-hero {
  max-width: 780px;
}

.fbh-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.6rem;
}

.fbh-toc a {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.32em 0.9em;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.fbh-toc a:hover {
  border-color: var(--accent);
  background: rgba(224, 177, 79, 0.12);
}

/* Screenshot figures: the app is dark, so give each shot a quiet frame */
.fbh-fig {
  margin: 0;
  text-align: center;
}

.fbh-fig img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md, 0 10px 30px rgba(0, 0, 0, 0.18));
}

.fbh-fig figcaption {
  font-size: 0.82rem;
  opacity: 0.72;
  margin-top: 0.6rem;
  line-height: 1.45;
}

.fbh-fig--wide {
  max-width: 1000px;
  margin: 0 auto;
}

.fbh-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 2.2rem;
  max-width: 1000px;
  margin: 2.2rem auto 0;
}

.fbh-map p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Text + figure rows */
.fbh-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 2.6rem;
  align-items: start;
  max-width: 1000px;
  margin: 0 auto;
}

.fbh-row + .fbh-row {
  margin-top: 3rem;
}

.fbh-row + .fbh-fig--wide {
  margin-top: 3rem;
}

.fbh-row__text h3 {
  font-size: 1.15rem;
  margin: 1.6rem 0 0.6rem;
}

.fbh-row__text h3:first-child {
  margin-top: 0;
}

.fbh-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fbh-list li {
  position: relative;
  padding-left: 1.3rem;
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  line-height: 1.62;
}

.fbh-list li::before {
  content: '\2726';
  position: absolute;
  left: 0;
  top: 0.1em;
  font-size: 0.7em;
  color: var(--accent);
}

.fbh-figcol {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* Keyboard keys */
kbd {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.82em;
  font-weight: 600;
  border: 1px solid var(--border-light);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.12em 0.5em;
  background: rgba(128, 128, 128, 0.08);
  white-space: nowrap;
}

/* Cheat-sheet table */
.fbh-cheat {
  max-width: 760px;
  margin: 0 auto;
  overflow-x: auto;
}

.fbh-cheat table {
  width: 100%;
  border-collapse: collapse;
}

.fbh-cheat td {
  padding: 0.7rem 1rem 0.7rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.95rem;
  line-height: 1.5;
  vertical-align: top;
}

.fbh-cheat td:first-child {
  white-space: nowrap;
  width: 1%;
  padding-right: 2.2rem;
}

@media (max-width: 760px) {
  .fbh-row {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }

  .fbh-map {
    grid-template-columns: 1fr;
  }
}

/* Respect reduced-motion: no sweeps, instant flips/fades */
@media (prefers-reduced-motion: reduce) {
  .fbd-sweep,
  .fbd-toolchip.is-next {
    animation: none !important;
  }

  .fbd-photo__flip,
  .fbd-photo__box,
  .fbd-photo__fix,
  .fbd-orient,
  .fbd-file,
  .fb-flipcard__inner {
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }
}
