/* css/site-carousel.css — Site Investigate full-screen 3D carousel shell.
   Light-theme surfaces matching css/feature-panels.css tokens. Layout only —
   the module card bodies keep their existing .si-* styling from feature-panels.css. */

/* ── panel overrides ──────────────────────────────────────────────────────
   #panel-site carries inline style="overflow-y:auto;padding:24px" and
   #site-app carries inline style="display:flex;flex-direction:column;gap:16px"
   in contistant.html; inline styles beat stylesheet rules, so these need
   !important. Same "lift the shared 960px .canvas-panel--app cap for one tab"
   pattern as #panel-planner in feature-panels.css. */
#panel-site {
  overflow: hidden !important;
  padding: 0 !important;
  align-items: stretch !important;
  justify-content: stretch !important;
}
#panel-site #site-app {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  gap: 0 !important;
}

/* ── wrap ─────────────────────────────────────────────────────────────────
   .canvas-panel is position:absolute; inset:0 inside .canvas, so 100% here is
   already "viewport minus topbar/tabbar" — no calc(100vh - chrome) guesswork. */
.sic-wrap {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface-canvas, #f6f8f9);
}

/* ── tab strip ────────────────────────────────────────────────────────────
   2026-08-16 redesign: the strip is the ONE pager (bottom dots row removed —
   it duplicated this and wasted stage height). Centered; inactive tabs are
   icon + status dot only, the Thai label expands on the active/hovered tab,
   so all 8 tabs fit at the 1280px floor with no horizontal scrolling. */
.sic-tabstrip {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 5px;
  align-items: center;
  padding: 8px 18px;
  overflow-x: auto;   /* safety net only — content fits at ≥1280px */
  overflow-y: hidden;
  background: #fff;
  border-bottom: 1px solid var(--color-border-default, #e2e6e9);
  scrollbar-width: thin;
}
.sic-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 5px 10px;
  border: 1px solid var(--color-border-default, #e2e6e9);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text-secondary, #64748b);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.sic-tab:hover { background: #f1f5f9; }
.sic-tab--active {
  background: #1e293b;
  border-color: #1e293b;
  color: #fff;
}
.sic-tab__icon { font-size: 14px; }
/* label collapses to nothing on inactive tabs, slides open on active/hover.
   max-width transition (not display) so the reveal is a smooth expand;
   margins ride inside the transition so the collapsed state is truly zero. */
.sic-tab__label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0;
  transition: max-width .28s ease, opacity .18s ease, margin .28s ease;
}
.sic-tab--active .sic-tab__label,
.sic-tab:hover .sic-tab__label {
  max-width: 150px;
  opacity: 1;
  margin: 0 2px 0 6px;
}
.sic-tab__tick { font-size: 11px; color: #22c55e; }
.sic-tab--active .sic-tab__tick { color: #86efac; }

.sic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  flex: 0 0 auto;
}
/* gap:0 on the tab (so the collapsed label costs zero width) — the dot and
   tick space themselves instead. */
.sic-tab .sic-dot { margin-left: 6px; }
.sic-tab .sic-tab__tick { margin-left: 3px; }
.sic-dot--empty { background: #9ca3af; }
.sic-dot--partial { background: #f59e0b; }
.sic-dot--complete { background: #22c55e; }

/* ── stage ────────────────────────────────────────────────────────────── */
.sic-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  perspective: 1400px;
  transform-style: preserve-3d;
  overflow: hidden;
}

.sic-card {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: min(920px, 78%);
  /* half the width expression above, negated — keep the two in sync.
     (min(-460px, -39%) would pick the MORE negative branch and only center
     at a stage width of ~1180px.) */
  margin-left: calc(min(920px, 78%) / -2);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-border-default, #e2e6e9);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .06);
  overflow: hidden;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  backface-visibility: hidden;
  /* Paint order, NOT 3D depth sorting: `.sic-stage` has `overflow: hidden`,
     which is a grouping property and forces its `transform-style` back to
     `flat` — so a neighbor's `translateZ(-260px)` does NOT push it behind the
     current card, it just scales it down while still painting later in DOM
     order (it would cover ~29% of the current card's right edge at 1440px).
     Order the layers explicitly instead. */
  z-index: 1;
}
.sic-card--live { z-index: 2; }

/* Task 7: per-module ambient SVG theme, decorative only (pointer-events:none,
   z-index 0 — always behind .sic-card__scroll's z-index 1 content). */
.sic-card__theme {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
/* site_investigation's soil-strata theme fills the whole card as a faint
   backdrop instead of a header band — see themeZoneClass() in site-index.js. */
.sic-card__theme--bg { opacity: .07; }
/* Header-band themes (2026-08-16 readability pass): the card title/head text
   lives at the top-LEFT of this band, so the art is double-masked — it fades
   out toward the bottom (before the form fields start) AND toward the left
   (so the title sits on near-plain white), leaving the gimmick visible in the
   top-right where the head row is empty. Opacity dropped .9 → .5 on top. */
.sic-card__theme:not(.sic-card__theme--bg) {
  top: 0;
  left: 0;
  right: 0;
  height: 150px;
  opacity: .5;
  -webkit-mask-image:
    linear-gradient(to bottom, #000 0%, #000 40%, transparent 96%),
    linear-gradient(to right, transparent 0%, rgba(0, 0, 0, .18) 28%, #000 62%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, #000 0%, #000 40%, transparent 96%),
    linear-gradient(to right, transparent 0%, rgba(0, 0, 0, .18) 28%, #000 62%);
  mask-composite: intersect;
}
.sicth-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sic-card__scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 26px;
}

.sic-card__footer {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 26px;
  border-top: 1px solid var(--color-border-default, #e2e6e9);
  background: #fff;
}
.sic-card__footer .si-module-error { flex: 1 1 100%; margin: 0; }

.sic-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-subtle, #eef1f3);
}
.sic-card__icon { font-size: 22px; }
.sic-card__titles { display: flex; flex-direction: column; line-height: 1.25; }
.sic-card__title { font-size: 16px; font-weight: 800; color: #1e293b; }
.sic-card__subtitle { font-size: 11.5px; color: var(--color-text-secondary, #64748b); }
.sic-card__badges { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* ── ◀ ▶ stage-edge nav buttons (spec §3) ────────────────────────────────
   Overlaid at the stage's own left/right edges (children of .sic-stage, so
   they sit inside its bounds and are never clipped by `overflow: hidden`);
   z-index above every card (.sic-card max z-index is 2 via .sic-card--live). */
.sic-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border-default, #e2e6e9);
  background: rgba(255, 255, 255, .92);
  color: #1e293b;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .14);
  transition: background .18s, color .18s, opacity .18s, transform .18s;
}
.sic-nav:hover:not(:disabled) { background: #1e293b; color: #fff; }
.sic-nav:active:not(:disabled) { transform: translateY(-50%) scale(.94); }
.sic-nav:disabled { opacity: .35; cursor: default; box-shadow: none; }
.sic-nav--prev { left: 14px; }
.sic-nav--next { right: 14px; }

/* (position-dots row removed 2026-08-16 — the centered tab strip is the one
   pager; the stage reclaimed the row's height.) */

/* ── reduced motion: flat cross-fade, no 3D ───────────────────────────── */
.sic-stage.sic--reduced { perspective: none; }
.sic-stage.sic--reduced .sic-card { transition: opacity .01s !important; }
@media (prefers-reduced-motion: reduce) {
  .sic-card { transition: opacity .01s !important; }
  .sic-tab, .sic-tab__label { transition: none; }
}

/* ── Task 4: modern form fields + grouped Project Info card ─────────────
   Reused verbatim by Tasks 5–6 (fieldGroup/pillGroup helpers in
   js/site/site-index.js render this exact markup). */
.sic-group { margin: 0 0 22px; }
.sic-group:last-of-type { margin-bottom: 0; }
.sic-group > h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
}
.sic-group__hint {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--color-text-secondary, #64748b);
}
.sic-group__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}
/* wide items (pill groups, the site-context result block) span every column
   instead of squeezing into one grid cell like a plain text field would. */
.sic-group__grid > .sic-field--wide,
.sic-group__grid > .si-result-block {
  grid-column: 1 / -1;
}

.sic-group--collapsible {
  margin: 0 0 22px;
  padding: 4px 16px 16px;
  border: 1px solid var(--color-border-default, #e2e6e9);
  border-radius: 12px;
  background: #fafbfc;
}
.sic-group--collapsible > summary {
  padding: 10px 0;
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
  cursor: pointer;
  list-style: none;
}
.sic-group--collapsible > summary::-webkit-details-marker { display: none; }
.sic-group--collapsible > summary::before { content: '▸ '; color: #94a3b8; }
.sic-group--collapsible[open] > summary::before { content: '▾ '; }
.sic-group--collapsible > .si-law-note { margin-top: 10px; }

/* floating-label field wrapper — static label above the control (no JS float
   tricks); ✓ suffix appears once the field carries a real value. */
.sic-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sic-field__label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary, #64748b);
}
.sic-field--filled .sic-field__label::after {
  content: '✓';
  color: #22c55e;
  font-weight: 800;
}
.sic-field input,
.sic-field select,
.sic-field textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border, #d1d5db);
  background: #fff;
  color: #1e293b;
  font: inherit;
  font-size: 13.5px;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.sic-field textarea {
  height: auto;
  min-height: 72px;
  padding: 10px 12px;
  resize: vertical;
}
.sic-field input:focus,
.sic-field select:focus,
.sic-field textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}

/* radio-like pill selects (≤6 options), replacing a short <select> */
.sic-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.sic-pill {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border, #d1d5db);
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.sic-pill:hover { border-color: #94a3b8; background: #f8fafc; }
.sic-pill--on {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

/* ── 2026-08-16 input redesign: derived "already answered" chips ─────────
   Fields owned by Project Information are shown, not re-asked, in Weather /
   Building Law / Seismic — see derivedChips() in site-index.js. */
.sic-derived {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.sic-derived__chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid var(--color-border-default, #e2e6e9);
  font-size: 12px;
  color: var(--color-text-secondary, #64748b);
}
.sic-derived__chip strong { color: #1e293b; font-weight: 700; }
.sic-derived__chip--empty strong { color: #b45309; }
.sic-derived__link {
  border: none;
  background: none;
  padding: 7px 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  cursor: pointer;
}
.sic-derived__link:hover { text-decoration: underline; }

/* live soil-table validation strip (validateSoilLayers, soil-input-rules.js) */
.si-soil-warnings { display: flex; flex-direction: column; gap: 4px; }
.si-soil-warnings:not(:empty) { margin: 8px 0 2px; }
.si-soil-warning {
  font-size: 11.5px;
  line-height: 1.45;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 10px;
}

/* lab-test suite checkboxes (LAB_TEST_SUITE) replacing the free textarea */
.sic-labtests {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px 14px;
  margin-bottom: 8px;
}
.sic-labtest {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: #1e293b;
  cursor: pointer;
}
/* the generic `.sic-field input { width:100%; height:42px }` rule would blow
   these checkboxes up to full-row size — reset them to native checkbox scale */
.sic-labtest input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: #2563eb;
}

.si-add-row-hint { font-weight: 400; font-size: 11px; color: var(--color-text-disabled, #9ca3af); }

/* divider inside the ⚙️ advanced row separating the lab-table fields from
   the rarely-present triaxial/direct-shear add-ons */
.sic-soil-adv__more {
  padding: 8px 8px 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--color-text-disabled, #9ca3af);
  background: #fafbfc;
}

/* ── Task 5: soil card — per-row advanced expander ── */
/* roomier soil-table cells now that the row also carries an ⚙️ button */
.sic-card .si-soil-table th { padding: 8px 10px; }
.sic-card .si-soil-table td { padding: 7px 8px; }
.si-soil-actions { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.si-soil-adv-btn {
  border: 1px solid var(--color-border-default, #e2e6e9);
  background: #fff;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.si-soil-adv-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.si-soil-adv-btn--on { background: #2563eb; border-color: #2563eb; }

.sic-soil-adv td { padding: 0; border-bottom: 1px solid var(--color-border-default); }
.sic-soil-adv__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px 8px;
  background: #fafbfc;
  font-size: 11px;
}
.sic-soil-adv__grid label { display: flex; flex-direction: column; gap: 3px; color: var(--color-text-secondary, #64748b); }
.si-soil-advanced-pi { align-self: center; font-weight: 700; color: #1e293b; }

/* ── Task 6: shared result-box treatment — resultBox() (js/site/site-index.js)
   now emits class="si-result sic-result" for every module (1–7 alike, since
   resultBox() is one shared helper), so this file's cascade order (loaded
   after feature-panels.css, which owns the base .si-result rule) only needs
   to add the separated surface shade + the "ผลวิเคราะห์" header on top. ── */
.sic-result {
  margin-top: 18px;
  background: #eef2f9;
  border-color: #d7e0ef;
}
.sic-result__head {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: #2563eb;
}

/* ── Task 7: per-module ambient theme animations ─────────────────────────
   Every animated element here is paused by default and only ever runs on
   the current (`.sic-card--live`) card — a neighbor/preview card's theme
   sits frozen, matching `inert`/`aria-hidden` already applied to it by the
   carousel's layout(). Fully disabled (never just paused) under reduced
   motion, both the user's explicit in-app toggle (`.sic--reduced`, applied
   to `.sic-stage`) and the OS-level media query, per the Task 7 brief. */

@keyframes sicth-crane-swing {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}
@keyframes sicth-cloud-drift {
  from { transform: translateX(-14px); }
  to { transform: translateX(14px); }
}
@keyframes sicth-rain-fall {
  0% { opacity: 0; transform: translateY(-6px); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}
@keyframes sicth-wave-flow {
  to { stroke-dashoffset: -40; }
}
@keyframes sicth-flow-a {
  to { offset-distance: 100%; }
}
@keyframes sicth-flow-b {
  to { offset-distance: 100%; }
}

.sicth-crane-jib,
.sicth-cloud,
.sicth-rain-drop,
.sicth-wave,
.sicth-flow-dot {
  animation-play-state: paused;
}

.sic-card--live .sicth-crane-jib { animation: sicth-crane-swing 8s ease-in-out infinite; animation-play-state: running; }
.sic-card--live .sicth-cloud { animation: sicth-cloud-drift 30s ease-in-out infinite alternate; animation-play-state: running; }
.sic-card--live .sicth-cloud--1 { animation-delay: -6s; }
.sic-card--live .sicth-cloud--2 { animation-delay: -14s; }
.sic-card--live .sicth-rain-drop { animation: sicth-rain-fall 1.1s linear infinite; animation-play-state: running; }
.sic-card--live .sicth-wave { animation: sicth-wave-flow 2.4s linear infinite; animation-play-state: running; }
.sic-card--live .sicth-flow-dot {
  animation-duration: 4s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-play-state: running;
}
.sic-card--live .sicth-flow-dot--a { offset-path: path('M 0 40 C 100 40 100 90 200 90 S 300 40 400 40'); animation-name: sicth-flow-a; }
.sic-card--live .sicth-flow-dot--b { offset-path: path('M 0 100 C 120 100 120 50 240 50 S 340 100 400 100'); animation-name: sicth-flow-b; }

/* reduced motion: no ambient animation anywhere, live card or not */
.sic-stage.sic--reduced .sicth-crane-jib,
.sic-stage.sic--reduced .sicth-cloud,
.sic-stage.sic--reduced .sicth-rain-drop,
.sic-stage.sic--reduced .sicth-wave,
.sic-stage.sic--reduced .sicth-flow-dot {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .sicth-crane-jib,
  .sicth-cloud,
  .sicth-rain-drop,
  .sicth-wave,
  .sicth-flow-dot {
    animation: none !important;
  }
}
