/* Slope-IQ design dialog demo. Markup: section.siq-wrap in index.html; behaviour: assets/slope-iq.js.
   The dialog uses the app's own Sunlight-theme colours (#166534 tabs, #4ade80 accent, #C2410C design). */

.siq-wrap { padding: clamp(64px, 8vw, 104px) 0; background: #f3ecdf; }
.siq-head { max-width: 820px; }
.siq-head .lead { margin-top: 16px; }

/* the tablet the dialog runs on */
.siq-device {
  margin-top: clamp(28px, 3.5vw, 44px);
  padding: clamp(8px, 1.2vw, 14px);
  border-radius: clamp(16px, 2vw, 26px);
  background: #141210;
  box-shadow: 0 30px 70px rgba(26, 22, 18, .22), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.siq {
  border-radius: clamp(10px, 1.2vw, 14px);
  background: #fff;
  color: #000;
  overflow: hidden;
  font-family: "Roboto", "Segoe UI", system-ui, sans-serif;
}

/* header */
.siq__top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #e0e0e0; }
.siq__title { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; margin-right: auto; }
.siq__title svg { width: 26px; height: 26px; flex: none; }
.siq__outlet {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  background: #f5f5f5; border: 1px solid #000; color: #333;
  font: 600 13px/1 inherit; font-family: inherit; cursor: pointer;
}
.siq__outlet svg { width: 16px; height: 16px; }
.siq__outlet.is-on { background: rgba(194, 65, 12, .15); border-color: #c2410c; color: #c2410c; }
.siq__x { width: 34px; height: 34px; display: grid; place-items: center; color: #333; }
.siq__x svg { width: 20px; height: 20px; }

/* mode tabs + hint/undo */
.siq__bar { display: flex; align-items: center; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap; }
.siq__tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border: 0; border-radius: 8px;
  background: #f5f5f5; color: #333;
  font: 600 14px/1 inherit; font-family: inherit; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.siq__tab svg { width: 18px; height: 18px; }
.siq__tab:hover:not(.is-on) { background: #e9e9e9; }
.siq__tab.is-on { background: #166534; color: #fff; }
.siq__tab:focus-visible, .siq__outlet:focus-visible, .siq__undo:focus-visible, .siq__card button:focus-visible,
.siq__cancel:focus-visible, .siq__go:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 2px; }
.siq__hint { margin-left: auto; font-size: 11px; font-style: italic; color: #555; }
.siq__undo { border: 0; background: none; padding: 8px 6px; font: 600 13px/1 inherit; font-family: inherit; color: #166534; cursor: pointer; }
.siq__undo:disabled { color: #aaa; cursor: default; }

/* parameter cards */
.siq__params {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px;
  margin: 10px 16px 0; padding: 10px; border-radius: 10px;
  background: rgba(245, 245, 245, .4);
}
.siq__card {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto auto; gap: 4px 6px;
  padding: 8px 8px 8px 12px; border-radius: 10px;
  background: #fff; border: 1px solid #000;
  box-shadow: inset 4px 0 0 #4ade80;
}
.siq__card[hidden] { display: none; }
.siq__card-label { grid-column: 1 / -1; font-size: 10px; font-weight: 800; letter-spacing: .08em; line-height: 1.2; color: #15803d; overflow-wrap: break-word; }
.siq__card-val { grid-column: 1 / -1; font: 700 20px/1.1 ui-monospace, "Roboto Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
.siq__card-btns { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.siq__card button {
  min-height: 30px; border: 1px solid #d4d4d4; border-radius: 7px;
  background: #f5f5f5; color: #000; font: 700 17px/1 inherit; font-family: inherit; cursor: pointer;
}
.siq__card button:hover { background: #e9e9e9; }
.siq__card button:active { background: #dcfce7; }

/* chart */
.siq__chart { position: relative; margin: 10px 16px 0; padding: 8px; border: 1px solid #000; border-radius: 12px; background: #fff; }
.siq__svg { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.siq.is-free .siq__svg { touch-action: none; }
.siq.is-edit .siq__svg { cursor: crosshair; }
.siq__axis { font: 400 10px/1 "Roboto", "Segoe UI", system-ui, sans-serif; fill: #000; }
.siq__axis--unit { font-size: 8px; fill: #333; }
.siq__se { font: 600 8px/1 "Roboto", "Segoe UI", system-ui, sans-serif; letter-spacing: .05em; fill: #333; }
.siq__terrain { fill: none; stroke: #166534; stroke-width: 2.25; stroke-dasharray: 8 4; stroke-linejoin: round; }
.siq__design { fill: none; stroke: #c2410c; stroke-width: 5.25; stroke-linejoin: round; stroke-linecap: round; }
.siq__depth { fill: none; stroke-width: 1; stroke-dasharray: 6 4; }
.siq__depth--min { stroke: #00ff00; stroke-opacity: .6; }
.siq__depth--max { stroke: #ff00ff; stroke-opacity: .6; }
.siq__depth-label { font: 600 8px/1 "Roboto", "Segoe UI", system-ui, sans-serif; }
.siq__depth-label--max { fill: #ff00ff; fill-opacity: .7; }
.siq__depth-label--min { fill: #00a000; fill-opacity: .7; }
.siq__dot { fill: #166534; }
.siq__dot--on { fill: #f59e0b; stroke: #f59e0b; stroke-width: 2; }
.siq__vertex { fill: #fff; stroke: #c2410c; stroke-width: 2; }
.siq.is-free .siq__vertex { cursor: grab; }
.siq__vertex-t { font: 600 8px/1 "Roboto", "Segoe UI", system-ui, sans-serif; fill: #c2410c; }
.siq__pill { fill: #f5f5f5; fill-opacity: .87; }
.siq__pill-t { font: 600 9px/1 "Roboto", "Segoe UI", system-ui, sans-serif; fill: #c2410c; }
.siq__pill-t--flat { fill: #991b1b; fill-opacity: .5; }
.siq__legend { font: 600 9px/1 "Roboto", "Segoe UI", system-ui, sans-serif; }
.siq__scan { stroke: #4ade80; stroke-width: 2; }
.siq__legend-html { display: none; flex-wrap: wrap; gap: 4px 12px; padding: 6px 4px 2px; font: 600 10px/1.2 "Roboto", "Segoe UI", system-ui, sans-serif; }
.siq__legend-html span { display: inline-flex; align-items: center; gap: 5px; }
.siq__legend-html i { display: inline-block; width: 14px; }
.siq__legend-html i.is-fill { height: 8px; background: var(--c); opacity: .67; }
.siq__legend-html i.is-solid { height: 2.5px; background: var(--c); }
.siq__legend-html i.is-dash { height: 0; border-top: 1.5px dashed var(--c); }
.siq.is-narrow .siq__legend-html { display: flex; }

/* stats strip */
.siq__stats {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px;
  margin: 10px 16px 0; padding: 9px 14px; border: 1px solid #000; border-radius: 8px; background: #f5f5f5;
}
.siq__stats-lead { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.siq__stats-lead svg { width: 15px; height: 15px; }
.siq__stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 11px; color: #555; }
.siq__stat b { font: 700 14px/1 ui-monospace, "Roboto Mono", Consolas, monospace; color: #000; font-variant-numeric: tabular-nums; }
.siq__stat b.is-accent { color: #15803d; }
.siq__badge {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto;
  padding: 6px 10px; border-radius: 8px;
  background: rgba(74, 222, 128, .15); border: 1px solid rgba(74, 222, 128, .4);
  font-size: 12px; font-weight: 700; color: #000;
}
.siq__badge svg { width: 15px; height: 15px; }

/* footer */
.siq__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 16px; border-top: 1px solid #e0e0e0; }
.siq__cancel { border: 0; background: none; padding: 10px 6px; font: 500 15px/1 inherit; font-family: inherit; color: #333; cursor: pointer; }
.siq__go {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 8px;
  background: #4ade80; color: #000; font: 700 15px/1 inherit; font-family: inherit; cursor: pointer;
}
.siq__go svg { width: 16px; height: 16px; }
.siq__go:hover { filter: brightness(.96); }

.siq-cap { margin-top: 12px; font-size: 13px; color: var(--ink-3); }

/* the three design modes, synced with the tabs */
.siq-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: clamp(22px, 3vw, 32px); }
.siq-mode {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 18px 18px 20px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line-2); color: var(--ink);
  font: inherit; cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.siq-mode:hover { border-color: var(--ink); }
.siq-mode:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 3px; }
.siq-mode.is-on { border-color: #166534; box-shadow: inset 0 4px 0 #166534; }
.siq-mode__name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.siq-mode__body { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.siq-mode__try { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 700; color: #166534; }
.siq-mode.is-on .siq-mode__try { color: var(--ink-3); }

.siq .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .siq__params { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .siq-modes { grid-template-columns: 1fr; gap: 10px; }
  .siq-mode { padding: 14px 16px; }
  .siq__top { padding: 10px 12px; }
  .siq__title { font-size: 16px; }
  .siq__title svg { width: 22px; height: 22px; }
  .siq__outlet { padding: 6px 9px; font-size: 12px; }
  .siq__x { display: none; }
  .siq__bar { padding: 8px 10px 0; }
  .siq__tab { padding: 9px 11px; font-size: 13px; }
  .siq__tab svg { display: none; }
  .siq__hint { order: 5; width: 100%; margin: 2px 0 0; }
  .siq__params { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 8px 10px 0; padding: 8px; }
  .siq__card { flex: 0 0 132px; scroll-snap-align: start; }
  .siq__chart { margin: 8px 10px 0; padding: 4px; }
  .siq__stats { margin: 8px 10px 0; padding: 8px 10px; gap: 4px 12px; }
  .siq__badge { margin-left: 0; }
  .siq__foot { padding: 10px; }
  .siq__go { padding: 11px 16px; }
}
