/* SuccessPathGuru Smart Text Summarizer - main styles.
   Brand: orange #E8922A + gold #F5C842, Outfit for reading, Playfair Display for headings.
   Theme: data-theme="dark" | "light" on <html>, saved as "spg-theme" (same key as the blog). */

:root {
  --accent: #E8922A;
  --gold: #F5C842;
  --on-accent: #1A1108;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --wrap: 1120px;
  --read: 68ch;
  --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', 'Noto Naskh Arabic', sans-serif;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

:root,
:root[data-theme="dark"] {
  --bg: #12100E;
  --surface: #1C1815;
  --surface-2: #25201B;
  --line: #3A322A;
  --ink: #F3ECE3;
  --muted: #B9AC9D;
  --link: #F2B360;
  --mark: rgba(245, 200, 66, .28);
  --mark-line: #F5C842;
  --ok: #7BC794;
  --err: #F08A7B;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F5F3EF;
  --surface: #FFFFFF;
  --surface-2: #F1ECE5;
  --line: #DCD3C7;
  --ink: #221C17;
  --muted: #5F554B;
  --link: #9A4F0A;
  --mark: rgba(245, 200, 66, .55);
  --mark-line: #D9A514;
  --ok: #1F7A43;
  --err: #B3261E;
  --shadow: 0 18px 40px -28px rgba(60, 40, 20, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1, h2 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 50;
  background: var(--gold); color: var(--on-accent); padding: .6rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}
.skip:focus { top: 1rem; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}
.header-row { display: flex; align-items: center; gap: .75rem; min-height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap;
}
.brand img { width: 34px; height: 34px; }
.brand span b { color: var(--accent); font-weight: 700; }
.nav-toggle, .theme-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: 0 .85rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem; cursor: pointer;
}
.theme-btn { margin-left: auto; }
.theme-btn svg { width: 18px; height: 18px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .15rem; }
.site-nav a {
  display: block; padding: .55rem .7rem; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-size: .97rem;
}
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); }

/* ---------- breadcrumb + hero ---------- */
.crumbs { padding-top: 1rem; font-size: .9rem; color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.crumbs li + li::before { content: '/'; margin-right: .3rem; opacity: .6; }
.crumbs a { color: var(--muted); }

.hero { padding: 1.4rem 0 1.2rem; }
.hero h1 {
  font-size: clamp(2.1rem, 1.4rem + 3.4vw, 3.6rem);
  margin-bottom: .35rem;
}
.tagline {
  font-family: var(--serif); font-style: italic; font-size: clamp(1.1rem, 1rem + .6vw, 1.45rem);
  color: var(--gold); margin-bottom: .6rem;
}
:root[data-theme="light"] .tagline { color: #8A5A00; }
.hero .lede { max-width: var(--read); color: var(--muted); font-size: 1.1rem; }
.promise { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; margin: .8rem 0 0; padding: 0; list-style: none; font-size: .95rem; }
.promise li::before { content: '✓ '; color: var(--ok); font-weight: 700; }

/* ---------- tool ---------- */
.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}
.tool-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.field-label { font-weight: 600; font-size: 1rem; }
.select-wrap { display: inline-flex; align-items: center; gap: .5rem; font-size: .92rem; color: var(--muted); }
select, textarea, input[type="text"] {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
select { min-height: 44px; padding: 0 .6rem; max-width: 100%; }

.sheet { position: relative; border-radius: var(--radius); }
.sheet textarea {
  display: block; width: 100%; min-height: 15rem; max-height: 70vh; resize: vertical;
  padding: 1rem 1rem 1.1rem; line-height: 1.7; font-size: 1.02rem;
  background:
    linear-gradient(90deg, transparent 0, transparent 2.1rem, rgba(232, 146, 42, .35) 2.1rem, rgba(232, 146, 42, .35) calc(2.1rem + 1px), transparent calc(2.1rem + 1px)),
    var(--bg);
  padding-left: 2.8rem;
}
[dir="rtl"] .sheet textarea { padding-left: 1rem; padding-right: 2.8rem; background: var(--bg); border-right: 3px solid rgba(232, 146, 42, .45); }
.sheet textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(232, 146, 42, .3); }
.sheet textarea[aria-invalid="true"] { border-color: var(--err); }
.sheet.dragging textarea { border-style: dashed; border-color: var(--gold); box-shadow: 0 0 0 3px var(--mark); }

.counts { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .6rem 0 0; font-size: .92rem; color: var(--muted); }
.counts dt { display: inline; }
.counts dd { display: inline; margin: 0 0 0 .25rem; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.counts div { white-space: nowrap; }
.limit { margin: .5rem 0 0; color: var(--err); font-weight: 600; }

.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .9rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.file-hint { font-size: .88rem; color: var(--muted); flex-basis: 100%; margin: 0; }

.choices { border: 0; margin: 1.1rem 0 0; padding: 0; min-width: 0; }
.choices legend { font-weight: 600; margin-bottom: .45rem; padding: 0; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.seg.modes { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt label {
  display: flex; flex-direction: column; justify-content: center; gap: .1rem;
  min-height: 56px; height: 100%; padding: .55rem .75rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.opt label b { font-weight: 600; }
.opt label small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.opt input:checked + label { border-color: var(--accent); background: rgba(232, 146, 42, .12); box-shadow: inset 0 0 0 1px var(--accent); }
.opt input:checked + label b::before { content: '● '; color: var(--accent); }
.opt input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 48px; padding: 0 1.2rem; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 1.08rem; padding: 0 1.8rem; flex: 1 1 14rem; }
.btn-primary:hover { background: #F09E3C; }
.btn-primary[disabled] { opacity: .7; cursor: progress; }
.btn-quiet { background: transparent; }
.btn-small { min-height: 40px; padding: 0 .9rem; font-size: .92rem; }

.status {
  display: flex; gap: .5rem; align-items: flex-start;
  margin: 1rem 0 0; padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 500;
}
.status.error { border-color: var(--err); color: var(--err); }
.status.ok { border-color: var(--ok); color: var(--ok); }
.status-icon { font-weight: 700; }

.history-opt { display: flex; align-items: center; gap: .55rem; margin-top: 1rem; font-size: .93rem; color: var(--muted); }
.history-opt input { width: 20px; height: 20px; accent-color: var(--accent); }
.privacy-line { margin: .9rem 0 0; font-size: .9rem; color: var(--muted); display: flex; gap: .45rem; }
.privacy-line svg { flex: 0 0 18px; width: 18px; height: 18px; margin-top: .2rem; color: var(--ok); }

/* ---------- results ---------- */
.results { margin-top: 1.4rem; }
.results-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); overflow: hidden;
}
.results-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .4rem 1rem;
  padding: 1rem 1.1rem .8rem; border-bottom: 1px solid var(--line);
}
.results-head h2 { margin: 0; font-size: 1.6rem; }
.results-head h2:focus { outline: none; }
.badge {
  display: inline-block; font-size: .8rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px;
  border: 1px solid var(--gold); color: var(--gold);
}
:root[data-theme="light"] .badge { color: #7A4F00; border-color: #D9A514; }
.results-body { padding: .4rem 1.1rem 1rem; }
.r-block { padding: .9rem 0; border-bottom: 1px dashed var(--line); }
.r-block:last-child { border-bottom: 0; }
.r-title { color: var(--accent); margin-bottom: .45rem; }
:root[data-theme="light"] .r-title { color: #9A4F0A; }
.r-summary .summary-text {
  font-size: 1.12rem; line-height: 1.75; max-width: var(--read);
  padding-left: .9rem; border-left: 4px solid var(--gold); margin: 0;
}
[dir="rtl"] .r-summary .summary-text, .r-summary .summary-text[dir="rtl"] { padding-left: 0; padding-right: .9rem; border-left: 0; border-right: 4px solid var(--gold); }
.r-list { margin: 0; padding-left: 1.3rem; max-width: var(--read); }
[dir="rtl"] .r-list { padding-left: 0; padding-right: 1.3rem; }
.r-list li { margin: 0 0 .45rem; }
.r-list li::marker { color: var(--accent); font-weight: 700; }
.kind {
  display: inline-block; font-size: .74rem; font-weight: 600; padding: .05rem .45rem; margin-right: .2rem;
  border-radius: 6px; border: 1px solid var(--line); color: var(--muted); vertical-align: .1em;
}
.kind-main { border-color: var(--accent); color: var(--accent); }
.kind-fact { border-color: var(--gold); color: var(--gold); }
:root[data-theme="light"] .kind-fact { color: #7A4F00; }
.kind-action { border-color: var(--ok); color: var(--ok); }
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.tag {
  padding: .3rem .75rem; border-radius: 999px; font-size: .93rem; font-weight: 500;
  background: var(--mark); border: 1px solid var(--mark-line); color: var(--ink);
}
.facts strong { color: var(--ink); background: var(--mark); padding: 0 .2rem; border-radius: 3px; }
.lead-text { font-size: 1.1rem; font-weight: 600; margin: 0; }
.time-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 0 0 .5rem; }
.time-cell { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .7rem; }
.time-cell dt { font-size: .82rem; color: var(--muted); }
.time-cell dd { margin: 0; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.time-cell:last-child dd { color: var(--ok); }

.results-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-2); }
.share-menu { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1.1rem 1rem; background: var(--surface-2); }
.highlight-wrap { padding: 0 1.1rem 1.1rem; background: var(--surface-2); }
.highlight {
  margin-top: .3rem; padding: 1rem; max-height: 26rem; overflow: auto; line-height: 1.8;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.highlight .skipped { color: var(--muted); }
.highlight mark.picked {
  color: var(--ink); background: linear-gradient(transparent 12%, var(--mark) 12%, var(--mark) 88%, transparent 88%);
  border-bottom: 2px solid var(--mark-line); padding: 0 .1rem;
}
.result-note { font-size: .88rem; color: var(--muted); padding: .8rem 1.1rem 1rem; margin: 0; background: var(--surface-2); }

.history { margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.history h2 { font-family: var(--font); font-size: 1.05rem; margin: 0 0 .5rem; }
.history ul { list-style: none; margin: 0; padding: 0; }
.h-item { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.h-item:first-child { border-top: 0; }
.h-text { min-width: 0; display: flex; flex-direction: column; }
.h-date { font-size: .8rem; color: var(--muted); }
.h-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- AI coming soon ---------- */
.soon {
  margin-top: 1.2rem; padding: 1rem 1.1rem; border-radius: var(--radius);
  border: 1px dashed var(--line); color: var(--muted); display: flex; gap: .8rem; align-items: flex-start;
}
.soon h2 { font-family: var(--font); font-size: 1.05rem; color: var(--ink); margin: 0 0 .2rem; }
.soon p { margin: 0; font-size: .93rem; }
.pill { font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }

/* ---------- server fallback ---------- */
.server-result { margin-top: 1.4rem; }

/* ---------- content ---------- */
.content { padding: 2.2rem 0 1rem; }
.prose { max-width: var(--read); }
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: .8rem; min-height: 2rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--accent); color: var(--accent); font-weight: 700; font-size: .9rem;
}
.users { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0 !important; }
.users li { padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); margin: 0; }
.mode-table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 30rem; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.callout {
  border-left: 4px solid var(--accent); background: var(--surface); padding: .9rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.2rem 0;
}
.callout p:last-child { margin-bottom: 0; }

.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: .9rem 2rem .9rem 0; font-weight: 600; position: relative; min-height: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: .2rem; top: .75rem; font-size: 1.3rem; color: var(--accent); }
.faq details[open] summary::after { content: '–'; }
.faq details > div { padding: 0 0 1rem; color: var(--ink); }

.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .7rem; margin: 1rem 0; padding: 0; list-style: none; }
.related a {
  display: block; height: 100%; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.related a:hover { border-color: var(--accent); }
.related b { display: block; color: var(--accent); }
.related span { font-size: .9rem; color: var(--muted); }

.disclaimer { font-size: .92rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 2rem; }

/* ---------- ads ---------- */
.ad-slot { margin: 1.8rem auto; text-align: center; min-height: 100px; }
.ad-slot ins.adsbygoogle { display: block; }
.ad-label { display: block; font-size: .72rem; color: var(--muted); margin-bottom: .2rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: 2.5rem; border-top: 1px solid var(--line); background: var(--surface); padding: 1.6rem 0 2rem; font-size: .93rem; }
.footer-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.site-footer h2 { font-family: var(--font); font-size: 1rem; margin: 0 0 .5rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .35rem; }
.site-footer a { color: var(--ink); }
.footer-note { margin-top: 1.4rem; color: var(--muted); font-size: .85rem; }

/* ---------- simple pages ---------- */
.page { padding: 1rem 0 2rem; }
.page h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); }

@media (prefers-reduced-motion: no-preference) {
  .results:not([hidden]) .results-card { animation: rise .35s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
