/* falakbin.ir/lab/telescope (Views/public/sim_telescope, fb-sim-telescope.js): where to start (three steps and ready
   scenes), then the eyepiece and its figures on one side and the panel of five tabs on the other; on a phone the panel
   under the figures. The scene is dark on both themes. */

/* ---- Where to start ---- */
/* Kept low, so the eyepiece is not pushed far down: the title and its line on one row, the three steps one quiet strip,
   each ready scene one slim row (its line trimmed to fit). */
.flk-tel-guide { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.flk-tel-guide-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.flk-tel-guide-head h2 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.flk-tel-guide-head h2 .flk-i { width: 18px; height: 18px; color: var(--teal-ink); }
.flk-tel-guide-head p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.8; }
.flk-tel-steps { list-style: none; margin: 0; padding: 8px 4px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); counter-reset: telstep; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-soft); }
.flk-tel-steps li { counter-increment: telstep; position: relative; padding: 0 12px; padding-inline-start: 42px; font-size: .8rem; line-height: 1.75; }
.flk-tel-steps li + li { border-inline-start: 1px solid var(--line-soft); }
.flk-tel-steps li::before {
    content: counter(telstep, persian); position: absolute; inset-inline-start: 12px; top: 1px; width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; background: var(--teal-soft); color: var(--teal-ink); font-weight: 900; font-size: .78rem;
}
.flk-tel-steps b { font-size: .84rem; margin-inline-end: 6px; }
.flk-tel-steps span { color: var(--muted); }
.flk-tel-scenes-h { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 700; }
.flk-tel-scenes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: -4px; }
.flk-tel-scene {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
    color: var(--fg); font: inherit; text-align: start; cursor: pointer; min-height: 40px; min-width: 0; transition: border-color .15s, background .15s;
}
.flk-tel-scene:hover, .flk-tel-scene:focus-visible { border-color: var(--teal); background: var(--teal-soft); }
.flk-tel-scene .flk-i { flex: none; width: 18px; height: 18px; color: var(--teal-ink); }
.flk-tel-scene span { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.flk-tel-scene b { flex: none; font-size: .84rem; font-weight: 800; }
.flk-tel-scene small { min-width: 0; color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- The simulator ---- */
.flk-tel { grid-template-columns: minmax(0, 1fr) 440px; }
.flk-tel-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; container-type: inline-size; }
/* Until the widget has mounted (fb-core sets data-ready), the stage, the figures and the panel hold about the room they
   will take, so the page does not jump by most of a screen when they fill: the eyepiece is min(width, 760 px) square
   (measured 2026-10-24; the figures and the panel by the median of Sun, Moon, Saturn, M42 and Albireo). */
.flk-tel:not([data-ready]):not([data-failed]) .flk-tel-stage::before { content: ''; display: block; height: min(100cqw, 760px); }
.flk-tel:not([data-ready]):not([data-failed]) .flk-tel-card { min-height: 780px; }
.flk-tel:not([data-ready]):not([data-failed]) .flk-tel-panel { min-height: 1080px; }
.flk-tel-stage { background: #000; }
.flk-tel .flk-sim-canvas { cursor: grab; }
.flk-tel .flk-sim-canvas:active { cursor: grabbing; }

/* The view under the picture: a segmented switch, and the moment. */
.flk-tel-views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.flk-tel-viewseg { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; }
.flk-tel-viewseg button {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 38px; border: 0; border-radius: 9px; background: none;
    color: var(--muted); font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
}
.flk-tel-viewseg button .flk-i { width: 16px; height: 16px; }
.flk-tel-viewseg button:hover { color: var(--fg); }
.flk-tel-viewseg button[aria-pressed="true"] { background: var(--teal-soft); color: var(--teal-ink); }
.flk-tel-viewseg button:disabled { opacity: .4; cursor: default; }
.flk-tel-when { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .86rem; font-weight: 700; }
.flk-tel-when .flk-i { width: 16px; height: 16px; color: var(--teal-ink); }

/* The figures: a head with the target and its moment, then three groups of tiles. */
.flk-tel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.flk-tel-card-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px 18px; align-items: start; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.flk-tel-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flk-tel-title small { color: var(--teal-ink); font-size: .8rem; font-weight: 700; }
.flk-tel-title b { font-size: 1.3rem; font-weight: 900; line-height: 1.5; }
.flk-tel-key { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flk-tel-key div { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.flk-tel-key dt { color: var(--muted); font-size: .74rem; }
.flk-tel-key dd { margin: 2px 0 0; font-size: .86rem; font-weight: 800; line-height: 1.75; }
.flk-tel-detail { margin: 0; font-size: .88rem; line-height: 1.95; color: var(--fg); }
.flk-tel-detail:empty, .flk-tel-note:empty, .flk-tel-warns:empty { display: none; }
.flk-tel-warns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.flk-tel-warns li {
    position: relative; padding: 8px 12px; padding-inline-start: 30px; border-radius: 10px; font-size: .84rem; line-height: 1.85; color: var(--fg);
    background: var(--orange-soft, rgba(255, 140, 26, .1)); border-inline-start: 3px solid var(--orange-ink);
}
.flk-tel-warns li::before { content: '!'; position: absolute; inset-inline-start: 10px; top: 8px; color: var(--orange-ink); font-weight: 900; }
.flk-tel-group h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 7px; font-size: .86rem; font-weight: 800; color: var(--muted); }
.flk-tel-group h3 .flk-i { width: 16px; height: 16px; color: var(--teal-ink); }
.flk-tel-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.flk-tel-stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.flk-tel-stats div { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.flk-tel-stats dt { color: var(--muted); font-size: .72rem; line-height: 1.6; }
.flk-tel-stats dd { margin: 2px 0 0; font-weight: 800; font-size: .9rem; font-variant-numeric: tabular-nums; line-height: 1.7; }
.flk-tel-stats .flk-tel-wide2 { grid-column: span 2; }
.flk-tel-stats .flk-tel-wide4 { grid-column: 1 / -1; }
.flk-tel-stats div:has(> dd:empty) { display: none; }
.flk-tel-sky { margin: 0; font-size: .86rem; line-height: 1.9; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 8px 12px; }
.flk-tel-note { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.95; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* ---- The panel: five tabs in one row, each an icon over its name ---- */
.flk-tel-panel { min-width: 0; gap: 14px; padding-top: 10px; }
.flk-tel-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin: 0 -6px; border-bottom: 1px solid var(--line); }
.flk-tel-tabs button {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 10px; min-height: 60px;
    border: 0; border-radius: 10px 10px 0 0; background: none; color: var(--muted); font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer;
    white-space: nowrap; transition: color .15s, background .15s;
}
.flk-tel-tabs button .flk-i { width: 20px; height: 20px; }
.flk-tel-tabs button:hover { color: var(--fg); background: var(--bg-2); }
.flk-tel-tabs button[aria-selected="true"] { color: var(--teal-ink); background: var(--teal-soft); }
.flk-tel-tabs button[aria-selected="true"]::after { content: ''; position: absolute; inset-inline: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--teal); }
.flk-tel-tabs button:focus-visible { outline: 2px solid var(--teal-ink); outline-offset: -2px; }

.flk-tel-pane { display: flex; flex-direction: column; gap: 12px; }
.flk-tel-pane[hidden] { display: none; }
.flk-tel-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.flk-tel-cats button { min-height: 42px; padding: 4px 2px; font-size: .74rem; white-space: normal; line-height: 1.35; }
.flk-tel-list { min-height: 9.5rem; }
.flk-tel-list option { padding: 3px 4px; }
.flk-tel-count { margin-inline-start: auto; color: var(--muted); font-size: .78rem; }
.flk-tel-date { border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.flk-tel-date legend { padding: 0 6px; color: var(--muted); font-size: .84rem; font-weight: 700; }
.flk-tel-date-row { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr) 4rem 7rem; gap: 6px; }
.flk-tel-date-row .flk-sim-select { width: 100%; min-width: 0; min-height: 40px; }
.flk-tel .flk-sim-chips .flk-chip, .flk-tel-suggest { cursor: pointer; font: inherit; font-size: .8rem; min-height: 36px; }
.flk-tel-small { margin: 0; color: var(--muted); font-size: .8rem; align-self: center; }
.flk-tel-events { display: flex; flex-direction: column; gap: 6px; }
.flk-tel-ev { display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: start; padding: 6px 12px; border-radius: 12px; }
.flk-tel-ev b { font-size: .84rem; }
.flk-tel-ev small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.flk-tel-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flk-tel-custom[hidden] { display: none; }
.flk-tel-custom .flk-sim-ctl:last-child:nth-child(3) { grid-column: 1 / -1; }
.flk-tel-checks { display: flex; flex-direction: column; gap: 8px; }
.flk-tel .flk-sim-check { font-size: .84rem; min-height: 32px; }
.flk-tel .flk-sim-ctl input[type="range"] { width: 100%; accent-color: var(--teal); direction: ltr; margin: 0; }
/* What each end of a slider means, the better one in teal on the right (Views/public/sim_telescope, $range). */
.flk-tel-ends { display: flex; justify-content: space-between; gap: 8px; direction: ltr; margin-top: -4px; color: var(--muted); font-size: .72rem; line-height: 1.6; }
.flk-tel-ends span { direction: rtl; unicode-bidi: isolate; }
.flk-tel-ends .flk-tel-good { color: var(--teal-ink); font-weight: 700; }
.flk-tel-mountpic { display: block; width: 100%; height: auto; border-radius: 12px; background: #03141a; border: 1px solid var(--line-soft); }

@media (max-width: 1180px) {
    .flk-tel { grid-template-columns: minmax(0, 1fr) 400px; }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-card { min-height: 1100px; }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-panel { min-height: 1150px; }
    .flk-tel-stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flk-tel-scenes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flk-tel-card-head { grid-template-columns: minmax(0, 1fr); }
    .flk-tel-date-row { grid-template-columns: 5.4rem minmax(0, 1fr) 4rem; }
    .flk-tel-date-row [data-tel-h] { grid-column: 1 / -1; }
}
@media (max-width: 920px) {
    .flk-tel { grid-template-columns: minmax(0, 1fr); }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-card { min-height: 860px; }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-panel { min-height: 1220px; }
    .flk-tel-stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .flk-tel-card-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
    .flk-tel-steps { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .flk-tel-steps li + li { border-inline-start: 0; }
}
@media (max-width: 640px) {
    .flk-tel-guide { padding: 12px; gap: 8px; }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-card { min-height: 1350px; }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-panel { min-height: 1250px; }
    .flk-tel:not([data-ready]):not([data-failed]) .flk-tel-stage::before { height: calc(min(100cqw, 760px) + 40px); }
    /* Compact on a phone, so the eyepiece is not far below: the steps a strip of three names, the scenes two by two. */
    .flk-tel-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 6px 0; }
    .flk-tel-steps li { padding: 0 6px; padding-inline-start: 34px; }
    .flk-tel-steps li + li { border-inline-start: 1px solid var(--line-soft); }
    .flk-tel-steps li::before { inset-inline-start: 6px; top: 0; }
    .flk-tel-steps b { margin: 0; font-size: .8rem; line-height: 22px; }
    .flk-tel-steps span { display: none; }
    .flk-tel-scenes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .flk-tel-scene { padding: 8px; gap: 6px; min-height: 44px; }
    .flk-tel-scene .flk-i { width: 18px; height: 18px; }
    .flk-tel-scene b { flex: 1 1 auto; font-size: .78rem; }
    .flk-tel-scene small { display: none; }
    .flk-tel-stats, .flk-tel-stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flk-tel-stats .flk-tel-wide2 { grid-column: 1 / -1; }
    .flk-tel-card { padding: 14px 12px; }
    .flk-tel-card-head { grid-template-columns: minmax(0, 1fr); }
    .flk-tel-tabs button { font-size: .7rem; padding-inline: 0; }
    .flk-tel-tabs button span { white-space: normal; text-align: center; line-height: 1.4; }
    .flk-tel-when { margin-inline-start: 0; width: 100%; }
}
.flk-tel-lesson { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
.flk-tel-lesson[hidden] { display: none; }
.flk-tel-guide[hidden] { display: none; }
.flk-tel-lesson h2 { margin: .25rem 0 .75rem; }
.flk-tel-lesson-kicker { color: var(--accent); margin: 0; }
.flk-tel-lesson-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.flk-tel-lesson-actions [aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
