/* How-to guides: #/guides and #/guides/<slug>, and the drawn phones in them.
 *
 * The --ph-* tokens are the Cova app's own palette (theme.config.js in the
 * app repo), so the drawn screens look like the app in each mode.
 */
:root {
  --ph-bg: #0d1117;
  --ph-header: #1c2128;
  --ph-surface: #161b22;
  --ph-surface-alt: #1c2128;
  --ph-surface-soft: #21262d;
  --ph-border: #30363d;
  --ph-text: #e6edf3;
  --ph-muted: #7d8590;
  --ph-info: #58a6ff;
  --ph-success: #3fb950;
  --ph-gold: #c9a84c;
  --ph-ink: #232323;
  --ph-key-bg: #1f1f22;
  --ph-key: #4a4a4f;
  --ph-key-text: #f2f2f2;
  --ph-bezel: #05070a;
  --spot-glow: rgba(201, 168, 76, 0.28);
}

:root[data-theme="light"] {
  --ph-bg: #fffaf8;
  --ph-header: #285c70;
  --ph-surface: #ffffff;
  --ph-surface-alt: #f9f3f1;
  --ph-surface-soft: #f2edea;
  --ph-border: #d6d3ba;
  --ph-text: #232323;
  --ph-muted: #757575;
  --ph-info: #3b82f6;
  --ph-success: #16a34a;
  --ph-key-bg: #d1d3d9;
  --ph-key: #ffffff;
  --ph-key-text: #111111;
  --ph-bezel: #1a1c20;
  --spot-glow: rgba(201, 168, 76, 0.35);
}

/* ── Guides index ─────────────────────────────────────────────────────── */
.guide-category { margin-top: 56px; }
.guide-category h2 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; letter-spacing: -0.02em; margin: 0 0 18px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.guide-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); text-decoration: none; transition: transform 0.2s, border-color 0.2s; }
.guide-card:hover, .guide-card:focus-visible { transform: translateY(-3px); border-color: var(--accent-line); }
.guide-card h3 { margin: 0; font-size: 1.05rem; color: var(--text); }
.guide-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.guide-card .guide-chips { margin-top: auto; padding-top: 8px; }

.guide-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }

.guide-search { display: block; max-width: 520px; margin: 0 auto; }
.guide-search input { width: 100%; padding: 14px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--input-bg); color: var(--text); font: inherit; }
.guide-search input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.guide-empty { text-align: center; color: var(--muted); margin-top: 40px; }
.guide-empty a { color: var(--accent-text); }
.guide-card[hidden], .guide-category[hidden] { display: none; }
.guide-related { margin-top: 56px; }
.guide-related h2 { font-size: 1.3rem; margin: 0 0 16px; }

/* ── Guide page ───────────────────────────────────────────────────────── */
.guide-page { padding: 72px 0 105px; }
.guide-container { width: min(calc(100% - 40px), 1000px); margin: 0 auto; }
.guide-intro { max-width: 720px; }
.guide-intro .post-category { margin-top: 28px; }
.guide-intro h1 { font-size: clamp(2.4rem, 5vw, 4rem); letter-spacing: -0.055em; line-height: 1.05; margin: 14px 0 16px; }
.guide-intro .lead { margin: 0 0 22px; }

.quick-steps { margin: 40px 0 16px; padding: 22px 26px; border: 1px solid var(--accent-line); border-radius: 16px; background: var(--accent-soft); }
.quick-steps h2 { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 12px; }
.quick-steps ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; counter-reset: quick; }
.quick-steps li { counter-increment: quick; display: flex; gap: 12px; align-items: baseline; }
.quick-steps li::before { content: counter(quick); flex: none; width: 22px; height: 22px; display: inline-grid; place-content: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 0.72rem; font-weight: 800; transform: translateY(-1px); }
.quick-steps a { color: var(--text); text-decoration: none; font-weight: 600; }
.quick-steps a:hover { color: var(--accent-text); }

.guide-step { display: grid; grid-template-columns: 1fr 300px; gap: 64px; align-items: center; padding: 64px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 92px; }
.guide-step:nth-of-type(even) .guide-step-text { order: 2; }
.guide-step.is-text-only { grid-template-columns: 1fr; }
.guide-step-number { display: inline-grid; place-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 1.1rem; }
.guide-step-label { margin: 18px 0 6px; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.guide-step h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.03em; margin: 0 0 12px; }
.guide-step-text p:not(.guide-step-label) { color: var(--body); font-size: 1.04rem; line-height: 1.75; margin: 0; max-width: 460px; }

.guide-notes { margin-top: 56px; padding: 28px 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.guide-notes h2 { font-size: 1.3rem; margin: 0 0 14px; }
.guide-notes ul { margin: 0; padding-left: 1.2em; color: var(--body); line-height: 1.7; }
.guide-notes li { margin: 0 0 8px; }
.guide-notes li::marker { color: var(--accent-heading); }
.guide-help { margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding: 26px 30px; border: 1px solid var(--accent-line); border-radius: 16px; background: var(--accent-soft); }
.guide-help h2 { font-size: 1.25rem; margin: 0 0 4px; }
.guide-help p { margin: 0; color: var(--muted); }

/* ── The drawn phone ──────────────────────────────────────────────────── */
.phone { margin: 0 auto; width: 290px; padding: 10px; border-radius: 48px; background: var(--ph-bezel); box-shadow: 0 30px 70px var(--shadow), inset 0 0 0 1.5px rgba(255, 255, 255, 0.08); }
.phone-screen { position: relative; height: 540px; overflow: hidden; border-radius: 38px; background: var(--ph-bg); color: var(--ph-text); font-size: 11px; line-height: 1.35; user-select: none; }
.phone-screen p { margin: 0; }
.ph-status { display: flex; align-items: center; justify-content: space-between; height: 38px; padding: 0 24px 0 30px; font-size: 12px; font-weight: 700; }
.ph-island { width: 84px; height: 24px; border-radius: 999px; background: #000; }
.ph-status-icons { font-size: 8px; letter-spacing: 1px; }

.ph-tabs { overflow-x: clip; padding: 6px 12px 10px; border-bottom: 1px solid var(--ph-surface-soft); }
.ph-tab-track { display: flex; gap: 6px; }
/* Scrolled to the end, as after swiping left; the padding keeps a ringed last pill's number on screen. */
.ph-tabs.is-scrolled .ph-tab-track { justify-content: flex-end; padding-right: 8px; }
.ph-pill { position: relative; flex: none; padding: 5px 11px; border: 1px solid var(--ph-border); border-radius: 999px; background: var(--ph-surface-soft); color: var(--ph-text); font-weight: 600; }
.ph-pill.is-active { background: var(--ph-gold); border-color: var(--ph-gold); color: var(--ph-ink); }

.ph-header { padding: 12px 15px 15px; background: var(--ph-header); color: rgba(255, 255, 255, 0.95); }
.ph-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.ph-greeting { display: inline-block; font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.ph-title { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.ph-sub { font-size: 10px; color: rgba(255, 255, 255, 0.6); margin-top: 2px !important; }
.ph-score { font-size: 10px; font-weight: 700; color: var(--ph-gold); margin-top: 5px !important; }
.ph-plus { display: grid; place-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ph-gold); font-size: 20px; line-height: 1; }
.ph-score-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph-score-pills span { display: grid; justify-items: center; gap: 1px; padding: 7px 4px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; background: rgba(255, 255, 255, 0.08); font-size: 12px; }
.ph-score-pills small { font-size: 7px; font-weight: 600; letter-spacing: 0.03em; color: rgba(255, 255, 255, 0.6); }
.ph-score-pills b { font-size: 12px; color: var(--ph-gold); }

.ph-body { display: grid; gap: 8px; padding: 12px; }
.ph-card { padding: 12px; border: 1px solid var(--ph-border); border-radius: 13px; background: var(--ph-surface); }
.ph-card-title { display: flex; justify-content: space-between; margin-bottom: 8px !important; font-size: 12px; font-weight: 700; }
.ph-card-title small { color: var(--ph-muted); font-weight: 600; }
.ph-habit { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px solid var(--ph-surface-soft); }
.ph-habit-name { flex: 1; font-weight: 600; }
.ph-check { display: grid; place-content: center; width: 18px; height: 18px; border: 1.5px solid var(--ph-border); border-radius: 50%; font-size: 10px; font-weight: 800; }
.ph-check.is-done { border-color: var(--ph-gold); background: var(--ph-gold); color: var(--ph-ink); }

.ph-pro { display: flex; align-items: center; gap: 9px; padding: 11px; border-radius: 13px; background: var(--ph-header); color: #fff; }
.ph-pro small { color: rgba(255, 255, 255, 0.7) !important; }
.ph-pro-icon { display: grid; place-content: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, 0.15); font-size: 15px; }
.ph-try { padding: 4px 8px; border-radius: 6px; background: var(--ph-gold); color: var(--ph-bg); font-size: 9px; font-weight: 700; }
:root[data-theme="light"] .ph-try { color: var(--ph-ink); }
.ph-row-text { display: grid; flex: 1; gap: 1px; }
.ph-row-text b { font-size: 11.5px; }
.ph-row-text small { color: var(--ph-muted); font-size: 9px; }

.ph-profile { display: flex; align-items: center; gap: 11px; }
.ph-avatar { flex: none; display: grid; place-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ph-gold); color: var(--ph-bg); font-size: 17px; font-weight: 800; }
.ph-profile-text { display: grid; flex: 1; gap: 3px; justify-items: start; }
.ph-profile-text small { color: var(--ph-muted); font-size: 9.5px; }
.ph-name { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 1px 3px; margin: -1px -3px; border-radius: 6px; }
.ph-name b { font-size: 13.5px; }
.ph-edit { padding: 1px 6px; border-radius: 5px; background: var(--ph-surface-alt); color: var(--ph-info); font-size: 8.5px; font-weight: 700; }
.ph-name-edit { display: flex; align-items: center; gap: 6px; width: 100%; }
.ph-input { flex: 1; padding: 3px 0; border-bottom: 2px solid var(--ph-gold); font-size: 12.5px; font-weight: 600; }
.ph-caret { display: inline-block; width: 1.5px; height: 13px; margin-left: 1px; vertical-align: -2px; background: var(--ph-gold); animation: ph-blink 1s steps(1) infinite; }
.ph-save { position: relative; padding: 4px 9px; border-radius: 7px; background: var(--ph-gold); color: var(--ph-bg); font-size: 10px; font-weight: 700; }
:root[data-theme="light"] .ph-save, :root[data-theme="light"] .ph-avatar { color: var(--ph-ink); }
.ph-tag { padding: 2px 6px; border-radius: 5px; background: var(--ph-surface-alt); color: var(--ph-muted); font-size: 8.5px; }
.ph-sync { display: inline-flex; align-items: center; gap: 4px; color: var(--ph-muted); font-size: 8.5px; }
.ph-sync i { width: 5px; height: 5px; border-radius: 50%; background: var(--ph-success); }

.ph-section { padding: 6px 3px 0; color: var(--ph-muted); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ph-rows { padding: 0 12px; }
.ph-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; }
.ph-row + .ph-row { border-top: 1px solid var(--ph-surface-soft); }
.ph-row-icon { font-size: 13px; }
.ph-chevron { color: var(--ph-muted); font-size: 13px; }

.ph-keyboard { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 7px; padding: 8px 3px 26px; background: var(--ph-key-bg); }
.ph-keyboard div { display: flex; justify-content: center; gap: 4px; }
.ph-keyboard span { display: grid; place-content: center; width: 23px; height: 30px; border-radius: 5px; background: var(--ph-key); color: var(--ph-key-text); font-size: 12px; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); }
.ph-keyboard .ph-key-wide { width: 52px; font-size: 10px; }
.ph-keyboard .ph-key-space { width: 128px; font-size: 10px; }
.ph-keyboard .ph-key-done { background: var(--ph-info); color: #fff; }

/* Shared parts (assets/js/phone.js) */
.ph-header-top:only-child { margin-bottom: 0; }
.ph-nav { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; padding: 8px 22px 10px 12px; border-bottom: 1px solid var(--ph-surface-soft); text-align: center; font-size: 12.5px; }
.ph-nav-side { justify-self: start; color: var(--ph-gold); font-size: 20px; line-height: 1; }
.ph-nav-action { position: relative; justify-self: end; font-size: 11px; font-weight: 700; }
.ph-modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 22px 12px 14px; border-bottom: 1px solid var(--ph-surface-soft); font-size: 12.5px; }
.ph-link { color: var(--ph-muted); font-weight: 600; }
.ph-gold-pill { position: relative; display: inline-grid; place-content: center; padding: 8px 16px; border-radius: 999px; background: var(--ph-gold); color: var(--ph-ink); font-weight: 800; font-size: 11px; }
.ph-gold-pill.ph-small { padding: 5px 12px; font-size: 10.5px; }
.ph-button { position: relative; display: grid; place-content: center; padding: 10px; border-radius: 999px; background: var(--ph-gold); color: var(--ph-ink); font-weight: 800; }
.ph-button.is-ghost { background: transparent; border: 1px solid var(--ph-border); color: var(--ph-text); }
.ph-row.is-danger b { color: #f85149; }
:root[data-theme="light"] .ph-row.is-danger b { color: #dc2626; }
.ph-row { position: relative; }
.ph-row[data-spot] { border-radius: 10px; }
.ph-card[data-spot] { border-radius: 13px; }
.ph-row-value { color: var(--ph-muted); font-size: 10px; }
.ph-toggle { position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; background: var(--ph-surface-soft); border: 1px solid var(--ph-border); }
.ph-toggle i { position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.ph-toggle.is-on { background: var(--ph-gold); border-color: var(--ph-gold); }
.ph-toggle.is-on i { left: 13px; }
.ph-field, .ph-choice { position: relative; display: grid; gap: 4px; }
.ph-field[data-spot] { border-radius: 10px; }
.ph-field small, .ph-choice small { color: var(--ph-muted); font-size: 8.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.ph-field-box { display: block; min-height: 30px; padding: 7px 10px; border: 1px solid var(--ph-border); border-radius: 10px; background: var(--ph-surface); font-size: 11.5px; font-weight: 600; }
.ph-field-box.is-multiline { min-height: 48px; font-weight: 400; }
.ph-field-box.is-typing { border-color: var(--ph-gold); }
.ph-placeholder { color: var(--ph-muted); font-weight: 400; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ph-chip { position: relative; padding: 4px 9px; border: 1px solid var(--ph-border); border-radius: 999px; background: var(--ph-surface); font-size: 10px; font-weight: 600; }
.ph-chip.is-selected { background: var(--ph-gold); border-color: var(--ph-gold); color: var(--ph-ink); }
.ph-chips.is-segmented { flex-wrap: nowrap; gap: 0; padding: 2px; border-radius: 10px; background: var(--ph-surface-soft); }
.ph-chips.is-segmented .ph-chip { flex: 1; text-align: center; border: 0; border-radius: 8px; background: transparent; }
.ph-chips.is-segmented .ph-chip.is-selected { background: var(--ph-gold); }
.ph-bar { display: block; height: 7px; border-radius: 999px; background: var(--ph-surface-soft); overflow: hidden; }
.ph-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ph-gold); }
.ph-bar.is-over i { background: #f85149; }
.ph-muted { color: var(--ph-muted); }
.ph-big { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.ph-gold { color: var(--ph-gold); }
.ph-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ph-stack { display: grid; gap: 8px; }

.ph-numpad { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 8px 6px 24px; background: var(--ph-key-bg); }
.ph-numpad span { display: grid; place-content: center; height: 30px; border-radius: 6px; background: var(--ph-key); color: var(--ph-key-text); font-size: 14px; }
.ph-numpad .ph-numpad-done { position: relative; grid-column: 1 / -1; background: var(--ph-gold); color: var(--ph-ink); font-size: 11px; font-weight: 800; border-radius: 999px; }

.ph-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.ph-sheet { position: absolute; left: 8px; right: 8px; bottom: 22px; display: grid; gap: 7px; }
.ph-sheet-group { display: grid; overflow: visible; border-radius: 13px; background: var(--ph-surface); text-align: center; }
.ph-sheet-group small { padding: 9px; color: var(--ph-muted); font-size: 9px; border-bottom: 1px solid var(--ph-surface-soft); }
.ph-sheet-group span { position: relative; padding: 10px; color: var(--ph-info); font-size: 12.5px; border-bottom: 1px solid var(--ph-surface-soft); }
.ph-sheet-group span:last-child { border-bottom: 0; }
.ph-sheet-group span[data-spot] { border-radius: 10px; }
.ph-sheet-group .is-danger { color: #f85149; }
.ph-sheet-cancel span { font-weight: 700; }
.ph-alert { position: absolute; left: 36px; right: 36px; top: 34%; overflow: visible; border-radius: 14px; background: var(--ph-surface); text-align: center; }
.ph-alert > b { display: block; padding: 14px 12px 4px; font-size: 12px; }
.ph-alert > p { padding: 0 12px 12px; color: var(--ph-muted); font-size: 9.5px; }
.ph-alert-buttons { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ph-surface-soft); }
.ph-alert-buttons.is-stacked { grid-template-columns: 1fr; }
.ph-alert-buttons span { position: relative; padding: 9px 6px; color: var(--ph-info); font-size: 11.5px; }
.ph-alert-buttons span + span { border-left: 1px solid var(--ph-surface-soft); }
.ph-alert-buttons.is-stacked span + span { border-left: 0; border-top: 1px solid var(--ph-surface-soft); }
.ph-alert-buttons .is-bold { font-weight: 700; }
.ph-alert-buttons .is-danger { color: #f85149; }
.ph-alert-buttons span[data-spot] { border-radius: 8px; }

/* The control a step is about: a gold ring and the step's number. */
[data-spot] { position: relative; border-radius: 999px; outline: 2px solid var(--ph-gold); outline-offset: 3px; box-shadow: 0 0 0 7px var(--spot-glow); animation: spot-pulse 2s ease-in-out infinite; }
.ph-header [data-spot], .ph-name[data-spot] { border-radius: 8px; }
[data-spot]::after { content: attr(data-spot); position: absolute; top: -13px; right: -13px; z-index: 2; display: grid; place-content: center; width: 20px; height: 20px; border: 2px solid var(--ph-bg); border-radius: 50%; background: var(--ph-gold); color: var(--ph-ink); font-size: 10px; font-weight: 800; line-height: 1; }
.ph-tabs:has([data-spot]) { padding-top: 14px; }

@keyframes spot-pulse { 50% { box-shadow: 0 0 0 11px transparent; } }
@keyframes ph-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  [data-spot], .ph-caret { animation: none; }
}

@media (max-width: 800px) {
  .guide-grid { grid-template-columns: 1fr; }
  .guide-page { padding: 48px 0 76px; }
  .guide-step { grid-template-columns: 1fr; gap: 30px; padding: 48px 0; scroll-margin-top: 16px; }
  .guide-step:nth-of-type(even) .guide-step-text { order: 0; }
  .guide-notes, .guide-help, .quick-steps { padding: 22px; }
}
.ph-greeting[data-spot] { margin-bottom: 6px !important; }
/* On small top-bar actions, keep the step number clear of the word. */
.ph-nav-action[data-spot]::after, .ph-modal-bar [data-spot]::after { top: -17px; right: -19px; }
