/* Gym Flooring Calculator page (components/gym-flooring-calculator.jinja).
   Loaded only on that page from templates/page.jinja top_links.
   Uses logical properties (inline-start/end) so RTL and LTR both work
   without a separate main.rtl.css override. */

.gfc {
  --gfc-ink: #111;
  --gfc-ink-2: #555;
  --gfc-line: #e5e5e5;
  --gfc-soft: #f5f5f5;
  --gfc-radius: 8px;
  /* Accent = the store's brand colour (Theme > Branding, #111 on live).
     Brand red (#B10E00) is used ONLY as the hero background glow (--gfc-hero-glow). */
  --gfc-accent: var(--primary-color, #111);
  --gfc-accent-dark: #000;
  --gfc-accent-soft: #efefef;
  --gfc-accent-light: #a8a8a8;
  --gfc-hero-glow: rgba(177, 14, 0, .6);

  /* Fluid type scale: min at ~375px, max at ~1200px. Body never <16px
     (readability + no iOS zoom), meta never <13px. */
  --gfc-fs-xs: 13px;
  --gfc-fs-sm: 14px;
  --gfc-fs-base: 16px;
  --gfc-fs-lead: clamp(16px, .4vw + 14.5px, 18px);
  --gfc-fs-h3: clamp(17px, .4vw + 15.5px, 20px);
  --gfc-fs-h2: clamp(24px, 1vw + 20px, 32px);
  --gfc-fs-h1: clamp(32px, 2.4vw + 23px, 52px);
  --gfc-fs-display: clamp(44px, 1.5vw + 38px, 56px);
  --gfc-lh-tight: 1.2;
  --gfc-lh-body: 1.65;

  color: var(--gfc-ink);
  font-size: var(--gfc-fs-base);
  line-height: var(--gfc-lh-body);
  padding-bottom: 0;
}

.gfc .container { max-width: 1200px; }

.gfc-h2 {
  font-size: var(--gfc-fs-h2);
  line-height: var(--gfc-lh-tight);
  font-weight: 700;
  margin: 0 0 clamp(16px, 1.5vw, 24px);
  text-wrap: balance;
  color: var(--gfc-ink);
}

/* ---------- Buttons ---------- */
.gfc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none !important;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, opacity .2s;
}
.gfc-btn--dark { background: var(--gfc-accent); color: #fff !important; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.gfc-btn--dark:hover:not(:disabled) { background: var(--gfc-accent-dark); }
.gfc-btn--accent { background: var(--gfc-accent); color: #fff !important; }
.gfc-btn--accent:hover { background: var(--gfc-accent-dark); }
/* Hero CTA: white pill on the dark hero (brand black would vanish). */
.gfc-hero .gfc-btn--accent { background: #fff; color: var(--gfc-ink) !important; }
.gfc-hero .gfc-btn--accent:hover { background: #e9e9e9; }
.gfc-btn--light { background: #fff; color: var(--gfc-ink) !important; }
.gfc-btn--light:hover { background: #e9e9e9; }
.gfc-btn--outline { background: transparent; color: var(--gfc-ink) !important; border-color: var(--gfc-ink); }
.gfc-btn--outline:hover { background: var(--gfc-ink); color: #fff !important; border-color: var(--gfc-ink); }
.gfc-btn--block { display: flex; width: 100%; }
.gfc-btn:disabled { opacity: .45; cursor: not-allowed; }
.gfc-btn:focus-visible,
.gfc input:focus-visible,
.gfc select:focus-visible,
.gfc summary:focus-visible { outline: 2px solid var(--gfc-accent); outline-offset: 2px; }

/* ---------- Hero ---------- */
.gfc-hero {
  background: var(--gfc-ink);
  color: #fff;
  padding: 64px 0 56px;
  text-align: center;
  background-image: radial-gradient(ellipse at 50% 120%, var(--gfc-hero-glow), transparent 60%);
}
.gfc-eyebrow {
  display: block;
  font-size: var(--gfc-fs-xs);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .72);
  font-weight: 600;
  margin: 16px 0 0;
}
.gfc-hero__title {
  font-size: var(--gfc-fs-h1);
  line-height: 1.1;
  font-weight: 700;
  margin: 0 auto 16px;
  max-width: 18ch;
  color: #fff;
  text-wrap: balance;
}
.gfc-hero__sub {
  max-width: 640px;
  margin: 0 auto 28px;
  font-size: var(--gfc-fs-lead);
  line-height: var(--gfc-lh-body);
  opacity: .85;
}

/* ---------- Intro / formula ---------- */
.gfc-intro {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
  padding-top: 56px;
  padding-bottom: 24px;
}
.gfc-intro__text p { color: var(--gfc-ink-2); font-size: var(--gfc-fs-lead); line-height: var(--gfc-lh-body); margin: 0; max-width: 65ch; }
.gfc-steps__title {
  font-size: var(--gfc-fs-h3);
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--gfc-ink);
}
.gfc-formula { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gfc-formula li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--gfc-soft);
  border-radius: var(--gfc-radius);
  font-weight: 600;
}
.gfc-formula__body { display: grid; gap: 2px; min-width: 0; }
.gfc-formula__label { font-size: var(--gfc-fs-base); font-weight: 700; line-height: 1.35; color: var(--gfc-ink); }
.gfc-formula__text { font-size: var(--gfc-fs-sm); font-weight: 400; line-height: 1.5; color: var(--gfc-ink-2); }
.gfc-formula__n {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gfc-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--gfc-fs-sm);
}

/* ---------- Calculator ---------- */
.gfc-tool { padding-top: 40px; padding-bottom: 56px; scroll-margin-top: 100px; }
.gfc-tool__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.gfc-form {
  border: 1px solid var(--gfc-line);
  border-radius: var(--gfc-radius);
  padding: 24px;
  display: grid;
  gap: 18px;
}
.gfc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* Grid items default to min-width:auto, so a long <select> option would
   widen the column past the viewport on mobile. */
.gfc-intro > *, .gfc-tool__grid > *, .gfc-row > *, .gfc-field, .gfc-tips > * { min-width: 0; }
.gfc-tool__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gfc-field { display: grid; gap: 6px; }
.gfc-field label { font-size: var(--gfc-fs-sm); font-weight: 600; margin: 0; line-height: 1.4; }
.gfc-field input,
.gfc-field select,
.gfc-product__variant {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #cfcfcf;
  border-radius: var(--gfc-radius);
  background: #fff;
  font-size: 16px; /* >=16px stops iOS zoom on focus */
  color: var(--gfc-ink);
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.gfc-field input:focus,
.gfc-field select:focus,
.gfc-product__variant:focus { border-color: var(--gfc-accent); box-shadow: 0 0 0 3px rgba(0, 0, 0, .12); outline: none; }
.gfc-field input[type="number"] { direction: ltr; text-align: start; }
[dir="rtl"] .gfc-field input[type="number"] { text-align: right; }
.gfc-error { color: #b42318; font-size: var(--gfc-fs-sm); margin: -6px 0 0; }

.gfc-product {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--gfc-line);
  border-radius: var(--gfc-radius);
  background: var(--gfc-soft);
}
.gfc-product[hidden] { display: none; }
.gfc-product__img {
  flex: 0 0 72px;
  height: 72px;
  border-radius: 6px;
  background: #e9e9e9;
  overflow: hidden;
}
.gfc-product__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gfc-product__body { display: grid; gap: 4px; min-width: 0; flex: 1; }
.gfc-product__name { font-weight: 700; color: var(--gfc-ink) !important; line-height: 1.3; }
.gfc-product__meta { font-size: var(--gfc-fs-sm); color: var(--gfc-ink-2); }
.gfc-product__price { font-weight: 600; }
.gfc-product__variant { min-height: 44px; padding: 6px 10px; font-size: 16px; margin-top: 4px; }
.gfc-product__variant[hidden] { display: none; }

/* ---------- Product picker (styled radio list over the native select) ---------- */
.gfc-form.has-picker #gfc-product { display: none; }
.gfc-picker { display: grid; gap: 8px; }
.gfc-picker[hidden] { display: none; }
.gfc-opt {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--gfc-line);
  border-radius: var(--gfc-radius);
  background: #fff;
  cursor: pointer;
  font-weight: 400;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
[dir="rtl"] .gfc-opt { padding: 10px 10px 10px 14px; }
.gfc-opt:hover { border-color: #bdbdbd; }
.gfc-opt.is-checked { border-color: var(--gfc-accent); box-shadow: inset 0 0 0 1px var(--gfc-accent); background: #fafafa; }
.gfc-opt__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.gfc-opt:has(.gfc-opt__input:focus-visible) { outline: 2px solid var(--gfc-accent); outline-offset: 2px; }
.gfc-opt__thumb { width: 56px; height: 56px; border-radius: 6px; overflow: hidden; background: var(--gfc-soft); }
.gfc-opt__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gfc-opt__body { display: grid; gap: 2px; min-width: 0; }
.gfc-opt__name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--gfc-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gfc-opt__spec { font-size: var(--gfc-fs-xs); line-height: 1.4; color: var(--gfc-ink-2); }
.gfc-opt__foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 2px; }
.gfc-opt__price { font-size: var(--gfc-fs-sm); font-weight: 700; color: var(--gfc-ink); }
.gfc-opt__price:empty { display: none; }
.gfc-opt__tag { font-size: 12px; font-weight: 600; color: #b42318; }
.gfc-opt.is-oos .gfc-opt__thumb, .gfc-opt.is-oos .gfc-opt__name { opacity: .55; }
.gfc-opt__radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #bdbdbd;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.gfc-opt.is-checked .gfc-opt__radio { border-color: var(--gfc-accent); box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 10px var(--gfc-accent); }

/* With the picker the product card only carries the variant select. */
.gfc-form.has-picker .gfc-product { padding: 0; border: 0; background: none; }
.gfc-form.has-picker .gfc-product__img,
.gfc-form.has-picker .gfc-product__name,
.gfc-form.has-picker .gfc-product__meta,
.gfc-form.has-picker .gfc-product__price { display: none; }
.gfc-form.has-picker .gfc-product__variant { margin-top: 0; min-height: 48px; }

.gfc-result {
  background: var(--gfc-soft);
  border-radius: var(--gfc-radius);
  padding: 24px;
  display: grid;
  gap: 14px;
  position: sticky;
  top: 100px;
  border-top: 4px solid var(--gfc-accent);
}
.gfc-result__label { font-size: var(--gfc-fs-sm); font-weight: 600; color: var(--gfc-ink-2); }
.gfc-result__total { font-size: var(--gfc-fs-display); line-height: 1; font-weight: 800; color: var(--gfc-accent); font-variant-numeric: tabular-nums; }
.gfc-result__total small { font-size: .42em; font-weight: 600; }
.gfc-result__list { margin: 0; display: grid; gap: 0; }
.gfc-result__list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gfc-line);
}
.gfc-result__list > div[hidden] { display: none; }
.gfc-result__list dt { font-weight: 400; color: var(--gfc-ink-2); }
.gfc-result__list dd { margin: 0; font-weight: 700; text-align: end; }
.gfc-result__price dd { font-size: var(--gfc-fs-lead); color: var(--gfc-accent); }
.gfc-result__note {
  margin: 0;
  font-size: var(--gfc-fs-sm);
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff4e5;
  color: #7a4b00;
}
.gfc-result__note[hidden], .gfc-result__msg[hidden], .gfc-btn[hidden] { display: none; }
.gfc-result__msg { margin: 0; font-size: var(--gfc-fs-sm); font-weight: 600; }
.gfc-result__msg.is-ok { color: #067647; }
.gfc-result__msg.is-err { color: #b42318; }
.gfc-result__msg a { color: inherit; text-decoration: underline; }
.gfc-result__disclaimer { margin: 0; font-size: var(--gfc-fs-xs); color: var(--gfc-ink-2); line-height: 1.5; }

.gfc-plan { margin: 4px 0 0; background: #fff; border-radius: var(--gfc-radius); padding: 8px; }
.gfc-plan[hidden] { display: none; }
.gfc-plan svg { width: 100%; height: auto; display: block; }
.gfc-plan figcaption { font-size: var(--gfc-fs-xs); color: var(--gfc-ink-2); text-align: center; padding: 4px 4px 2px; }
.gfc-plan__room { fill: none; stroke: var(--gfc-ink); stroke-width: 2; }
.gfc-plan__tile { fill: var(--gfc-accent); stroke: #fff; stroke-width: .75; }
.gfc-plan__tile--cut { fill: var(--gfc-accent-light); }
.gfc-plan__dim { font-size: 12px; fill: var(--gfc-ink-2); font-family: inherit; }

/* ---------- Content sections ---------- */
.gfc-section { padding-top: 40px; padding-bottom: 40px; border-top: 1px solid var(--gfc-line); }

.gfc-table-wrap { overflow-x: auto; border: 1px solid var(--gfc-line); border-radius: var(--gfc-radius); }
.gfc-table { width: 100%; border-collapse: collapse; min-width: 520px; font-size: clamp(15px, .2vw + 14.3px, 16px); line-height: 1.5; }
.gfc-table th, .gfc-table td { padding: 14px 16px; text-align: start; border-bottom: 1px solid var(--gfc-line); vertical-align: top; }
.gfc-table thead th { background: var(--gfc-ink); color: #fff; font-weight: 600; }
.gfc-table tbody tr:last-child td { border-bottom: 0; }
.gfc-table td:first-child { font-weight: 700; white-space: nowrap; }
.gfc-table__rec td { background: var(--gfc-accent-soft); }
.gfc-table__rec td:first-child { color: var(--gfc-accent); box-shadow: inset 4px 0 0 var(--gfc-accent); }
[dir="rtl"] .gfc-table__rec td:first-child { box-shadow: inset -4px 0 0 var(--gfc-accent); }
.gfc-badge {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gfc-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}

.gfc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gfc-card {
  display: grid;
  gap: 6px;
  color: var(--gfc-ink) !important;
  text-decoration: none !important;
}
.gfc-card__img { display: block; aspect-ratio: 4 / 3; border-radius: var(--gfc-radius); overflow: hidden; background: var(--gfc-soft); }
.gfc-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gfc-card:hover .gfc-card__img img { transform: scale(1.04); }
.gfc-card:hover .gfc-card__title { color: var(--gfc-accent); }
.gfc-card__title { font-weight: 700; font-size: var(--gfc-fs-h3); line-height: 1.3; margin-top: 6px; }
.gfc-card__text { font-size: var(--gfc-fs-sm); line-height: 1.55; color: var(--gfc-ink-2); }

/* SB-CALC-02: server-rendered recommended products. Logical properties only, so
   the same rules work in RTL and LTR. */
.gfc-rec__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.gfc-rec__card {
  display: grid;
  gap: 6px;
  height: 100%;
  padding: 12px;
  border: 1px solid var(--gfc-line);
  border-radius: var(--gfc-radius);
  color: var(--gfc-ink) !important;
  text-decoration: none !important;
  transition: border-color .2s;
}
.gfc-rec__card:hover { border-color: var(--gfc-accent); }
.gfc-rec__card:focus-visible { outline: 2px solid var(--gfc-accent); outline-offset: 2px; }
.gfc-rec__img { display: block; aspect-ratio: 1 / 1; border-radius: 6px; overflow: hidden; background: var(--gfc-soft); }
.gfc-rec__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gfc-rec__name { font-weight: 700; font-size: var(--gfc-fs-base); line-height: 1.35; }
.gfc-rec__card:hover .gfc-rec__name { color: var(--gfc-accent); }
.gfc-rec__meta { font-size: var(--gfc-fs-sm); color: var(--gfc-ink-2); }
.gfc-rec__price { font-weight: 700; color: var(--gfc-accent); }
.gfc-rec__price:empty { display: none; }

.gfc-tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gfc-tip { padding: 24px; background: var(--gfc-soft); border-radius: var(--gfc-radius); border-top: 3px solid var(--gfc-accent); }
.gfc-tip__n { font-size: var(--gfc-fs-xs); font-weight: 700; color: var(--gfc-accent); }
.gfc-tip h3 { font-size: var(--gfc-fs-h3); line-height: 1.3; font-weight: 700; margin: 8px 0; }
.gfc-tip p { margin: 0; color: var(--gfc-ink-2); line-height: var(--gfc-lh-body); }

.gfc-faq { border-top: 1px solid var(--gfc-line); }
.gfc-faq__item { border-bottom: 1px solid var(--gfc-line); }
.gfc-faq__item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  font-weight: 600;
  font-size: var(--gfc-fs-h3);
  line-height: 1.4;
}
.gfc-faq__item summary::-webkit-details-marker { display: none; }
.gfc-faq__item summary::after { content: '+'; font-size: 24px; font-weight: 400; line-height: 1; flex: 0 0 auto; color: var(--gfc-accent); }
.gfc-faq__item summary:hover { color: var(--gfc-accent); }
.gfc-faq__item[open] summary::after { content: '−'; }
.gfc-faq__item p { margin: 0 0 18px; color: var(--gfc-ink-2); line-height: var(--gfc-lh-body); max-width: 70ch; }

.gfc-cms { line-height: var(--gfc-lh-body); max-width: 75ch; }

.gfc-cta { background: var(--gfc-accent); color: #fff; text-align: center; padding: 56px 0; margin-top: 16px; }
.gfc-cta h2 { color: #fff; font-size: var(--gfc-fs-h2); line-height: var(--gfc-lh-tight); font-weight: 700; margin: 0 auto 20px; max-width: 24ch; text-wrap: balance; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
  .gfc-intro { grid-template-columns: 1fr; gap: 24px; padding-top: 40px; }
  .gfc-tool__grid { grid-template-columns: 1fr; }
  .gfc-result { position: static; }
  .gfc-tips { grid-template-columns: 1fr; }
  .gfc-rec__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575px) {
  .gfc-hero { padding: 44px 0 40px; }
  .gfc-form, .gfc-result { padding: 18px; }
  .gfc-opt { grid-template-columns: 48px minmax(0, 1fr) 18px; gap: 12px; }
  .gfc-opt__thumb { width: 48px; height: 48px; }
  .gfc-opt__name { font-size: var(--gfc-fs-sm); }
  .gfc-opt__radio { width: 18px; height: 18px; }
  .gfc-opt.is-checked .gfc-opt__radio { box-shadow: inset 0 0 0 3.5px #fff, inset 0 0 0 9px var(--gfc-accent); }
  .gfc-btn { padding: 12px 22px; }
  .gfc-table th, .gfc-table td { padding: 12px 14px; }
}

/* Arabic (Changa): uppercase/tracking mean nothing in Arabic script and the
   taller glyphs need a little more leading. */
[dir="rtl"] .gfc-eyebrow { letter-spacing: 0; text-transform: none; font-size: var(--gfc-fs-sm); }
[dir="rtl"] .gfc-hero__title { line-height: 1.25; }
[dir="rtl"] .gfc-h2, [dir="rtl"] .gfc-cta h2 { line-height: 1.35; }
