html:has(.applications-page) { scroll-behavior: auto; }
.applications-page { background: #f2f2ee; }
.apps { --dark: #1c342e; color: var(--ink, #1c272d); font-family: Anuphan, sans-serif; }
.apps .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.apps-head { max-width: 1600px; margin: 0 auto; padding: 132px 4% 28px; }
.apps-head h1 { margin: 0; font: 300 clamp(36px, 4.4vw, 64px)/1.15 Anuphan, sans-serif; letter-spacing: -.025em; text-wrap: balance; }
.apps-head p { margin: 12px 0 0; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.6; color: #4a5357; }
.apps-facts { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.apps-facts li { padding: 6px 14px; border: 1px solid #d9dad3; border-radius: 40px; font-size: 14px; line-height: 1.4; color: #3d4649; }

.apps-list { max-width: 1600px; margin: 0 auto; padding: 0 4% 72px; }

/* tabs = image cards */
.app-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.app-tabs [role="tab"] {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
  padding: 0; border: 2px solid #e1e2dc; border-radius: 14px; overflow: hidden;
  background: #fff; color: inherit; font: 500 15px/1.35 Anuphan, sans-serif; text-align: left; cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.app-tabs [role="tab"] img { grid-column: 1 / -1; width: 100%; height: 96px; object-fit: cover; display: block; }
.app-tab-label { padding: 10px 0 10px 14px; align-self: center; }
.app-tabs [role="tab"] .icon { grid-row: 2; grid-column: 2; align-self: center; margin: 0 12px; }
.app-tabs .app-tab-on { display: none; padding: 3px; border-radius: 50%; background: var(--ink, #1c272d); color: var(--lime); }
.app-tabs [role="tab"]:hover { border-color: #b9bcb3; }
.app-tabs [aria-selected="true"], .app-tabs [aria-selected="true"]:hover { background: var(--lime); border-color: var(--lime); }
.app-tabs [aria-selected="true"] .app-tab-go { display: none; }
.app-tabs [aria-selected="true"] .app-tab-on { display: block; }
.app-tabs [role="tab"]:focus-visible { outline: 3px solid var(--ink, #1c272d); outline-offset: 3px; }

/* no JS: all panels stacked; with JS: only the active one */
.app-panel + .app-panel { margin-top: 56px; }
.app-panel { scroll-margin-top: 100px; }
.apps-list.is-tabbed .app-panel { margin: 0; scroll-margin-top: 240px; } /* keep the area cards in view on #hash */
.apps-list.is-tabbed .app-panel:not(.is-active) { display: none; }
.apps-list.is-tabbed .app-panel.is-active { animation: app-in .32s ease-out; }
@keyframes app-in { from { opacity: 0; transform: translateY(8px); } }

.app-card { display: grid; grid-template-columns: 42fr 58fr; min-height: 414px; border-radius: 20px; overflow: hidden; background: var(--dark); }
.app-copy { padding: clamp(28px, 3.4vw, 52px); color: #fff; display: flex; flex-direction: column; }
.app-copy h2 { margin: 0; font: 300 clamp(28px, 3vw, 44px)/1.2 Anuphan, sans-serif; letter-spacing: -.02em; text-wrap: balance; }
.app-lead { margin: 14px 0 0; font-size: 16px; line-height: 1.7; color: #d6dfdb; }
.app-tip { margin-top: 22px; padding-top: 20px; border-top: 1px solid #ffffff2b; }
.app-tip h3 { margin: 0; font: 600 16px/1.4 Anuphan, sans-serif; color: var(--lime); }
.app-tip p { margin: 6px 0 0; font-size: 15px; line-height: 1.7; color: #c7d2cd; }
.app-actions { margin-top: auto; padding-top: 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.app-cta { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 24px; border-radius: 40px; background: var(--lime); color: var(--ink, #1c272d); font-weight: 500; text-decoration: none; transition: transform .2s; }
.app-cta:hover { transform: translateY(-1px); }
.app-link { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 500; text-decoration: none; }
.app-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.app-copy a:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

.compare > img, .compare-before img { display: block; width: 100%; max-width: none; height: 100%; object-fit: cover; }

/* before/after: native range drives a clip-path */
.compare { position: relative; margin: 0; min-height: 300px; overflow: hidden; background: #11181c; --pos: 50%; }
.compare > img { position: absolute; inset: 0; }
.compare-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare-chip { position: absolute; top: 16px; left: 16px; padding: 6px 12px; border-radius: 40px; background: #11181cc2; color: #fff; font-size: 13px; line-height: 1.4; }
.compare-chip-after { left: auto; right: 16px; background: var(--lime); color: var(--ink, #1c272d); }
.compare-range {
  position: absolute; top: 50%; left: -22px; width: calc(100% + 44px); height: 44px; margin: -22px 0 0;
  -webkit-appearance: none; appearance: none; background: transparent; opacity: 0; cursor: ew-resize; touch-action: pan-y; z-index: 3;
}
.compare-range::-webkit-slider-runnable-track { height: 44px; }
.compare-range::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 44px; }
.compare-range::-moz-range-track { height: 44px; background: transparent; }
.compare-range::-moz-range-thumb { width: 44px; height: 44px; border: 0; }
.compare-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 10px #0006; pointer-events: none; z-index: 2; }
.compare-handle > span {
  position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: #fff; color: var(--ink, #1c272d); box-shadow: 0 2px 10px #0000004d;
}
.compare-handle .icon { width: 14px; height: 14px; }
.compare-handle .icon:first-child { transform: scaleX(-1); }
.compare-range:focus-visible ~ .compare-handle > span { box-shadow: 0 0 0 3px var(--ink, #1c272d), 0 0 0 6px var(--lime); }
.compare-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 7px 14px; border-radius: 40px; background: #ffffffe6; color: var(--ink, #1c272d); font-size: 13px; white-space: nowrap; pointer-events: none; }
.compare:has(.compare-range[hidden]) :is(.compare-hint, .compare-handle) { display: none; }

/* spec sheet: columns line up with the card above (standard values | prep checklist) */
.app-sheet { display: grid; grid-template-columns: 42fr 58fr; grid-template-areas: "spec plan" "pick plan" "result plan" "prep prep"; margin-top: 12px; border-radius: 20px; overflow: hidden; background: #fff; }
.app-sheet > section, .app-ex > section { padding: clamp(24px, 2.6vw, 36px) clamp(28px, 3.4vw, 52px); }
.app-spec { grid-area: spec; }
/* several sample layouts per area: chips swap result + plan; without JS only the first shows */
.app-ex { display: contents; }
.app-ex[hidden] { display: none; }
.app-ex-pick { grid-area: pick; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 clamp(28px, 3.4vw, 52px) clamp(20px, 2.2vw, 28px); }
.app-ex-label { width: 100%; font-size: 13px; color: #5a6366; }
.app-ex-pick button { padding: 7px 14px; border: 1px solid #e1e2dc; border-radius: 40px; background: #fff; color: inherit; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.3; cursor: pointer; transition: border-color .2s, background-color .2s; }
.app-ex-pick button:hover { border-color: #b9bcb3; }
.app-ex-pick button[aria-pressed="true"] { border-color: var(--lime); background: var(--lime); }
.app-ex-pick button:focus-visible { outline: 3px solid var(--ink, #1c272d); outline-offset: 2px; }
.app-result { grid-area: result; border-top: 1px solid #e6e7e1; }
.app-result dl { margin: 16px 0 0; }
.app-product { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 10px; border: 1px solid #e1e2dc; border-radius: 14px; color: inherit; text-decoration: none; transition: border-color .2s; }
.app-product:hover { border-color: #b9bcb3; }
.app-product:focus-visible, .app-quote:focus-visible { outline: 3px solid var(--ink, #1c272d); outline-offset: 3px; }
.app-product img { width: 64px; height: 64px; flex: none; border-radius: 10px; background: #f2f2ee; object-fit: contain; }
.app-product > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-product strong { font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.app-product small, .app-product-spec { font-size: 13px; line-height: 1.45; color: #5a6366; }
.app-quote { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font-weight: 500; color: var(--ink, #1c272d); text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.app-quote:hover { text-decoration-color: currentColor; }
.app-faq { margin-top: 12px; padding: clamp(24px, 2.6vw, 36px) clamp(28px, 3.4vw, 52px); border-radius: 20px; background: #fff; }
.app-faq .app-sheet-title { margin-bottom: 4px; }
.app-faq details { border-top: 1px solid #eeefea; }
.app-faq details:first-of-type { border-top: 0; }
.app-faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; font-weight: 500; font-size: 16px; line-height: 1.5; cursor: pointer; list-style: none; }
.app-faq summary::-webkit-details-marker { display: none; }
.app-faq summary::after { content: "+"; flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #f2f2ee; font-size: 18px; line-height: 1; }
.app-faq details[open] summary::after { content: "−"; background: var(--lime); }
.app-faq summary:focus-visible { outline: 3px solid var(--ink, #1c272d); outline-offset: 2px; }
.app-faq details p { margin: 0 0 16px; max-width: 72ch; font-size: 15px; line-height: 1.7; color: #4a5357; }
.app-plan { grid-area: plan; position: relative; display: flex; align-items: center; margin: 0; padding: 20px 20px 38px; background: #efefec; }
.app-plan img { width: 100%; height: auto; }
.app-plan figcaption { position: absolute; left: 20px; bottom: 12px; font-size: 12px; line-height: 1.4; color: #5a6265; }
.app-prep-box { grid-area: prep; border-top: 1px solid #e6e7e1; }
.app-sheet-title { margin: 0 0 20px; font: 600 17px/1.4 Anuphan, sans-serif; }
.app-spec dl { margin: 0; }
.app-spec dl > div, .app-result dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid #eeefea; }
.app-spec dl > div:first-child, .app-result dl > div:first-child { border-top: 0; padding-top: 0; }
.app-spec dt, .app-result dt { font-size: 14px; line-height: 1.4; color: #5a6366; }
.app-spec dd, .app-result dd { margin: 0; font: 600 clamp(22px, 1.9vw, 28px)/1.1 Anuphan, sans-serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-spec dd small, .app-result dd small { font-size: 14px; font-weight: 500; letter-spacing: 0; color: #5a6366; }
.app-spec-src { margin: 20px 0 0; font-size: 13px; line-height: 1.6; color: #6b7376; }
.app-prep { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-prep li { padding: 0 20px; border-left: 1px solid #e6e7e1; }
.app-prep li:first-child { padding-left: 0; border-left: 0; }
.app-prep p { margin: 4px 0 0; font-size: 15px; line-height: 1.55; color: #5a6366; }
.app-prep .app-prep-k { margin: 0; font-weight: 600; font-size: 16px; color: var(--ink, #1c272d); }

@media (max-width: 1100px) {
  .app-tabs { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: -4%; padding-inline: 4%; scroll-padding-inline: 4%; }
  .app-tabs::-webkit-scrollbar { display: none; }
  .app-tabs [role="tab"] { flex: 0 0 200px; scroll-snap-align: start; }
}
@media (max-width: 860px) {
  /* mobile order: name, image, lead, CTA, tip (copy children join the card's flow) */
  .app-card { display: flex; flex-direction: column; min-height: 0; }
  .app-copy { display: contents; }
  .app-copy > * { padding-inline: 22px; }
  .app-copy h2 { order: 1; padding-block: 22px 16px; font-size: 26px; }
  .compare { order: 2; aspect-ratio: 3 / 2; min-height: 0; }
  .app-lead { order: 3; margin-top: 18px; }
  .app-actions { order: 4; padding-top: 20px; }
  .app-tip { order: 5; margin-top: 24px; padding-bottom: 26px; }
  .app-sheet { grid-template-columns: 1fr; grid-template-areas: "spec" "pick" "plan" "result" "prep"; }
  /* plan drawings carry small dimension text: keep them legible, swipe sideways */
  .app-plan { display: block; overflow-x: auto; }
  .app-plan img { width: 600px; max-width: none; }
  .app-sheet > section, .app-ex > section, .app-faq { padding: 22px; }
  .app-ex-pick { padding: 0 22px 22px; }
  /* tabs: compact chips that stick under the floating site header */
  .app-tabs { position: sticky; top: 76px; z-index: 5; margin-top: -8px; margin-bottom: 14px; padding-block: 8px; background: #f2f2ee; }
  .app-tabs [role="tab"] { flex: 0 0 auto; grid-template-columns: 40px auto auto; grid-template-rows: auto; align-items: center; padding: 5px; border-radius: 12px; }
  .app-tabs [role="tab"] img { grid-column: 1; width: 40px; height: 40px; border-radius: 8px; }
  .app-tab-label { padding: 0 0 0 10px; white-space: nowrap; }
  .app-tabs [role="tab"] .icon { grid-row: 1; grid-column: 3; margin: 0 6px 0 10px; }
  .apps-list.is-tabbed .app-panel { scroll-margin-top: 160px; }
}
@media (max-width: 700px) {
  .app-sheet-title { margin-bottom: 8px; }
  .app-spec-src { margin-top: 10px; }
  .app-prep { grid-template-columns: 1fr; }
  .app-prep li, .app-prep li:first-child { padding: 12px 0; border-left: 0; border-top: 1px solid #eeefea; }
  .app-prep li:first-child { border-top: 0; padding-top: 4px; }
}
@media (max-width: 700px) {
  .apps-head { padding: 104px 6% 22px; }
  .apps-list { padding: 0 6% 56px; }
  .app-tabs { margin-inline: -6%; padding-inline: 6%; scroll-padding-inline: 6%; }
  .compare-chip { top: 10px; left: 10px; font-size: 11px; padding: 4px 9px; }
  .compare-chip-after { right: 10px; left: auto; }
  .compare-hint { bottom: 10px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-tabs [role="tab"], .app-cta, .app-product, .app-ex-pick button { transition: none; }
  .app-cta:hover { transform: none; }
  .apps-list.is-tabbed .app-panel.is-active { animation: none; }
}
