/* Sections added on top of the restyle: at a glance, platforms, modes, guide teaser, tour, guide page.
   Separate file on purpose, so a later restyle of styles.css cannot overwrite it.
   Uses the tokens of styles.css (--bg-card, --line, --accent, --text-soft, ...). */

/* ---------- header additions ---------- */
.tour-button { gap: 6px; }
.tour-button svg { width: 15px; height: 15px; }

/* ---------- at a glance ---------- */
.glance-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 40px; }
.glance-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 8px; align-content: start; }
.glance-card h3 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.glance-card p { margin: 0; color: var(--text-soft); line-height: 1.8; font-size: .96rem; }
.glance-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.glance-ico svg { width: 22px; height: 22px; }
.teach { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.teach-step { padding: 22px 22px 24px; display: grid; gap: 8px; align-content: start; position: relative; }
.teach-step + .teach-step { border-inline-start: 1px solid var(--line); }
.teach-when { font-size: .8rem; font-weight: 800; color: var(--accent); letter-spacing: .02em; }
.teach-step h3 { margin: 0; font-size: 1.08rem; font-weight: 800; }
.teach-step p { margin: 0; color: var(--text-soft); line-height: 1.85; font-size: .95rem; }
.teach-step kbd, .prose kbd, .keys kbd { font: 700 .78rem/1 "Inter", system-ui, sans-serif; padding: 3px 7px; border-radius: 6px; background: var(--bg-raised); border: 1px solid var(--line-strong); color: var(--text); direction: ltr; unicode-bidi: isolate; }
.teach-title { margin: 0 0 14px; font-size: 1.1rem; font-weight: 800; }

/* ---------- platforms ---------- */
.platform-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 22px; }
.seg { display: inline-flex; padding: 4px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 999px; gap: 2px; }
.seg button { font: inherit; font-size: .92rem; font-weight: 700; color: var(--text-soft); background: transparent; border: 0; border-radius: 999px; padding: 6px 18px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:focus-visible, .modes-tabs button:focus-visible, .tour-card button:focus-visible, .tour-card a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-note { color: var(--text-soft); font-size: .9rem; margin: 0; }
.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.platform { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 8px; align-content: start; }
.platform-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.platform-name { font-size: 1.12rem; font-weight: 800; margin: 0; margin-inline-end: auto; }
.badge { font-size: .74rem; font-weight: 600; padding: 2px 10px; border-radius: 6px; line-height: 1.7; white-space: nowrap; }
.badge-checked { background: rgba(34, 197, 94, .12); color: #4ade80; border: 1px solid rgba(34, 197, 94, .22); }
.badge-experimental { background: rgba(255,255,255,.04); color: var(--text-soft); border: 1px solid var(--line); }
.badge-cost { border: 1px solid var(--line); color: var(--text-soft); background: rgba(255,255,255,.02); }
.platform p { margin: 0; color: var(--text-soft); font-size: .92rem; line-height: 1.75; }
.platform-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 2px; font-size: .86rem; }
.platform-foot a { color: var(--accent); font-weight: 700; text-decoration: none; }
.platform-foot a:hover { text-decoration: underline; }
.platform-foot .need { color: var(--text-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; color: var(--text-soft); font-size: .9rem; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.platform-honest { margin-top: 22px; padding: 14px 18px; border-radius: 14px; background: var(--accent-soft); border: 1px solid rgba(245,185,71,.28); color: var(--text); font-size: .94rem; line-height: 1.85; }

/* ---------- modes ---------- */
.modes { display: grid; grid-template-columns: 1fr 1.15fr; gap: 28px; align-items: start; }
.modes-tabs { display: grid; gap: 10px; }
.modes-tabs button { font: inherit; text-align: start; color: var(--text); background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; cursor: pointer; display: grid; gap: 2px; transition: border-color .15s ease, background .15s ease; }
.modes-tabs button strong { font-size: 1.02rem; }
.modes-tabs button span { color: var(--text-soft); font-size: .9rem; line-height: 1.7; }
.modes-tabs button:hover { border-color: var(--line-strong); }
.modes-tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--bg-card-hi, var(--bg-card)); box-shadow: 0 0 0 1px var(--accent) inset; }
.modes-stage { position: sticky; top: 90px; display: grid; gap: 14px; }
.mock { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-strong); background: radial-gradient(75% 70% at 50% 15%, rgba(255,255,255,.05), transparent 65%), #0c0d12; box-shadow: 0 24px 56px rgba(0,0,0,.55); display: grid; align-content: end; padding: 18px 18px 20px; }
.mock-bar { position: absolute; inset-inline: 18px; top: 14px; display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: rgba(255,255,255,.7); }
.mock-bar .pill { padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.18); }
.mock-lines { text-align: center; display: grid; gap: 6px; padding: 10px 14px 12px; background: rgba(8,10,15,.62); border-radius: 12px; backdrop-filter: blur(6px); }
.mock-de { direction: ltr; font-weight: 800; font-size: clamp(.95rem, 1.7vw, 1.2rem); color: #fff; font-family: "Inter", system-ui, sans-serif; transition: filter .25s ease; }
.mock-fa { color: #ffd98e; font-size: clamp(.85rem, 1.5vw, 1rem); font-weight: 600; }
.mock-progress { height: 4px; margin-top: 12px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.mock-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.mock[data-mode="flow"] .mock-progress span { animation: mock-run 9s linear infinite; }
.mock[data-mode="listening"] .mock-de { filter: blur(7px); cursor: pointer; }
.mock[data-mode="listening"] .mock-de:hover, .mock[data-mode="listening"] .mock-de:focus-visible, .mock[data-mode="listening"][data-revealed="true"] .mock-de { filter: none; }
.mock-hint { position: absolute; inset-inline-start: 18px; top: 44px; font-size: .78rem; color: rgba(255,255,255,.75); display: none; }
.mock[data-mode="listening"] .mock-hint { display: block; }
.mock-pause { position: absolute; inset: 0; display: none; place-items: center; background: rgba(0,0,0,.35); }
.mock-pause span { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px; border-radius: 999px; background: rgba(8,10,15,.8); border: 1px solid rgba(255,255,255,.25); color: #fff; font-weight: 700; font-size: .92rem; }
.mock[data-mode="sentence"][data-paused="true"] .mock-pause { display: grid; }
.mock[data-mode="study"] .mock-de[data-pass="1"] { filter: blur(9px); }
.mock[data-mode="study"][data-pass="1"] .mock-fa, .mock[data-mode="study"][data-pass="2"] .mock-fa { visibility: hidden; }
.mock[data-mode="study"][data-pass="1"] .mock-de { filter: blur(9px); }
.mock[data-mode="study"][data-pass="2"] .mock-de, .mock[data-mode="study"][data-pass="3"] .mock-de { filter: none; }
.modes-note { color: var(--text-soft); line-height: 1.85; margin: 0; }
.modes-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text-soft); font-size: .9rem; }
.keys span { display: inline-flex; align-items: center; gap: 6px; }
@keyframes mock-run { from { width: 0; } to { width: 100%; } }

/* ---------- guide teaser ---------- */
.guide-steps { list-style: none; margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: gs; }
.guide-steps li { counter-increment: gs; }
.guide-steps a { display: grid; gap: 4px; height: 100%; padding: 18px 20px 18px 20px; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color .15s ease, transform .15s ease; position: relative; }
.guide-steps a:hover { border-color: var(--accent); transform: translateY(-2px); }
.guide-steps a::before { content: counter(gs); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; margin-bottom: 6px; border: 1px solid rgba(245,185,71,.2); }
:lang(fa) .guide-steps a::before { content: counter(gs, persian); }
.guide-steps strong { font-size: 1.02rem; }
.guide-steps span { color: var(--text-soft); font-size: .92rem; line-height: 1.75; }

/* ---------- tour ---------- */
.tour-ring { position: fixed; z-index: 90; pointer-events: none; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(4,6,10,.72), 0 0 0 3px var(--accent); transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease; }
.tour-card { position: fixed; z-index: 95; inset-inline: 16px; bottom: 16px; max-width: 460px; margin-inline: auto; background: var(--bg-card-hi, var(--bg-card)); border: 1px solid var(--line-strong); border-radius: 18px; padding: 18px 20px 16px; box-shadow: 0 24px 60px rgba(0,0,0,.6); display: grid; gap: 10px; }
.tour-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .82rem; color: var(--text-soft); }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: background .2s ease, width .2s ease; }
.tour-dots i[data-on="true"] { background: var(--accent); width: 20px; border-radius: 999px; }
.tour-card h3 { margin: 0; font-size: 1.1rem; font-weight: 800; outline: none; }
.tour-card p { margin: 0; color: var(--text-soft); line-height: 1.85; font-size: .95rem; }
.tour-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tour-actions .grow { margin-inline-start: auto; display: flex; gap: 8px; }
.tour-close { font: inherit; font-size: .85rem; color: var(--text-soft); background: none; border: 0; cursor: pointer; padding: 2px 4px; }
.tour-close:hover { color: var(--text); }
.tour-prompt { position: fixed; z-index: 80; inset-inline-start: 16px; bottom: 16px; max-width: 340px; background: var(--bg-card-hi, var(--bg-card)); border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px 16px; box-shadow: 0 18px 44px rgba(0,0,0,.5); display: grid; gap: 10px; animation: tour-in .4s ease both; }
.tour-prompt p { margin: 0; font-size: .95rem; line-height: 1.75; }
.tour-prompt .row { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes tour-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tour-active { overflow-anchor: none; }

/* ---------- guide page ---------- */
.guide-layout { display: grid; grid-template-columns: 240px 1fr; gap: 44px; align-items: start; padding: 48px 0 72px; }
.guide-toc { position: sticky; top: 90px; display: grid; gap: 2px; font-size: .94rem; }
.guide-toc a { color: var(--text-soft); text-decoration: none; padding: 6px 12px; border-radius: 10px; border-inline-start: 2px solid transparent; }
.guide-toc a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.guide-toc a[aria-current="true"] { color: var(--text); border-inline-start-color: var(--accent); background: rgba(255,255,255,.05); }
.prose h1 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); line-height: 1.4; margin: 0 0 10px; }
.prose > .lead { color: var(--text-soft); margin: 0 0 30px; max-width: 42em; line-height: 1.9; }
.prose section { padding: 28px 0 8px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.prose section:first-of-type { border-top: 0; padding-top: 0; }
.prose h2 { font-size: 1.45rem; margin: 0 0 10px; }
.prose p, .prose li { color: var(--text-soft); line-height: 1.95; }
.prose p { margin: 0 0 12px; max-width: 46em; }
.prose ol, .prose ul { padding-inline-start: 1.4em; margin: 0 0 14px; max-width: 46em; }
.prose strong { color: var(--text); }
.prose a:not(.btn) { color: var(--accent); }
.callout { padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid rgba(245,185,71,.28); color: var(--text); margin: 0 0 14px; max-width: 46em; line-height: 1.85; }
.callout.note { background: rgba(255,255,255,.04); border-color: var(--line-strong); }
.key-list { margin: 0 0 14px; max-width: 46em; }
.key-row { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 6px 18px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.key-row > * { min-width: 0; }
.key-row dt { margin: 0; font-weight: 600; color: var(--text); line-height: 1.9; }
.key-row dd { margin: 0; color: var(--text-soft); line-height: 1.9; }
.faq-list details { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); margin: 0 0 10px; max-width: 46em; }
.faq-list summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-list summary::after { content: "+"; color: var(--accent); font-weight: 800; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list details > div { padding: 0 18px 14px; color: var(--text-soft); line-height: 1.9; }
.faq-list summary::-webkit-details-marker { display: none; }
.install-box { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 14px; margin: 0 0 14px; max-width: 46em; }
.install-box p { margin: 0; flex: 1 1 260px; }
.guide-cta { margin-top: 34px; padding: 26px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.guide-cta h2 { margin: 0; font-size: 1.25rem; }

/* A grid item will not shrink below its content unless told to; without this the scrolling
   table of contents stretches the whole guide page past the screen on a phone. */
.guide-layout > *, .prose { min-width: 0; }
.guide-toc { max-width: 100%; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .glance-cards, .teach, .platform-grid, .guide-steps { grid-template-columns: 1fr 1fr; }
  .teach-step + .teach-step { border-inline-start: 0; border-top: 1px solid var(--line); }
  .teach { grid-template-columns: 1fr; }
  .modes { grid-template-columns: 1fr; }
  .modes-stage { position: static; order: -1; }
  .guide-layout { grid-template-columns: 1fr; gap: 20px; }
  .guide-toc { position: static; grid-auto-flow: column; overflow-x: auto; padding-bottom: 6px; }
  .guide-toc a { white-space: nowrap; }
}
@media (max-width: 680px) {
  .glance-cards, .platform-grid, .guide-steps { grid-template-columns: 1fr; }
  .tour-button span { display: none; }
  .tour-card { inset-inline: 10px; bottom: 10px; }
  .tour-prompt { inset-inline: 10px; bottom: 10px; max-width: none; }
  .key-row { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-ring, .tour-dots i, .mock-de, .seg button { transition: none; }
  .mock[data-mode="flow"] .mock-progress span { animation: none; width: 55%; }
  .tour-prompt { animation: none; }
}
