/*
Theme Name: SellerDragon Help
Theme URI: https://help.sellerdragon.com
Author: Epium
Description: Help center theme for help.sellerdragon.com – Emberglass slate dark with the "dayglass" porcelain light toggle. Documentation for the SellerDragon Google Sheets functions.
Version: 1.0.0
Requires PHP: 7.4
License: Proprietary
Text Domain: sellerdragon-help
*/

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-var-latin.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Arial, metric-matched to Inter: same line boxes pre-swap, so no layout shift */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
}

:root {
  /* Emberglass light = "dayglass" porcelain (tokens mirrored from webdash admin.css) */
  --bg: #eceef2;
  --panel: #ffffff;
  --panel-2: #f3f5f8;
  --panel-soft: #eef1f5;
  --input-bg: #ffffff;
  --top-bg: rgba(16, 22, 31, .97);       /* header stays slate in both themes, like the webdash sidebar */
  --line: #dce0e8;
  --line-soft: rgba(22, 30, 48, .09);
  --text: #171a20;
  --text-soft: #454b57;
  --muted: #6d7484;
  --muted-2: #98a0ae;
  --accent: #3b5cc4;
  --accent-strong: #2e49a3;
  --accent-soft: rgba(59, 92, 196, .10);
  --accent-hover: rgba(59, 92, 196, .16);
  --orange: #ff6b2c;
  --primary-bg: #e2580e;
  --primary-text: #ffffff;
  --green: #16845b;
  --good-soft: rgba(22, 132, 91, .1);
  --warn: #c07c18;
  --warn-soft: rgba(192, 124, 24, .11);
  --key-border: rgba(226, 88, 14, .32);
  --key-bg: rgba(226, 88, 14, .07);
  --key-text: #8a4a20;
  --pill-bg: #eef1f5;
  --shadow-sm: 0 1px 2px rgba(23, 26, 32, .06);
  --shadow-soft: 0 4px 14px rgba(23, 26, 32, .08);
  --shadow-popover: 0 18px 42px rgba(23, 26, 32, .16);
  --radius-sm: 6px;
  --radius-md: 8px;
  --sans: "Inter", "Inter Fallback", system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;
}
[data-theme="dark"] {
  /* Emberglass dark = slate (primary surface) */
  --bg: #0f131a;
  --panel: #171e29;
  --panel-2: #1e2735;
  --panel-soft: #1c2431;
  --input-bg: #1e2735;
  --top-bg: rgba(15, 19, 26, .92);
  --line: #2a3548;
  --line-soft: rgba(255, 255, 255, .07);
  --text: #e9ebef;
  --text-soft: #b6bcc7;
  --muted: #8b93a1;
  --muted-2: #6b7280;
  --accent: #7f9ae6;
  --accent-strong: #93abf0;
  --accent-soft: rgba(127, 154, 230, .14);
  --accent-hover: rgba(127, 154, 230, .22);
  --orange: #ff6b2c;
  --primary-bg: #ff6b2c;
  --primary-text: #1a0e06;
  --green: #4cb87b;
  --good-soft: rgba(76, 184, 123, .12);
  --warn: #c79a52;
  --warn-soft: rgba(199, 154, 82, .14);
  --key-border: rgba(255, 107, 44, .35);
  --key-bg: rgba(255, 107, 44, .10);
  --key-text: #ff9a5c;
  --pill-bg: #1e2735;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, .36);
  --shadow-popover: 0 18px 42px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15.5px; line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-md); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }
.lbl { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.tick { position: relative; padding-left: 22px; }
.tick::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 12px; height: 3px; border-radius: 2px; background: var(--orange);
}
code, .code { font-family: var(--mono); font-size: .92em; }

/* ── header — slate in both themes, like the webdash sidebar ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  top: var(--wp-admin--admin-bar--height, 0);
  background: var(--top-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.nav { display: flex; align-items: center; height: 60px; gap: 14px; }
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.logo img { display: block; height: 24px; width: auto; }
.logo img.logo-mark { height: 32px; }
.help-chip {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: #ffb28a; border: 1px solid rgba(255, 107, 44, .45); border-radius: 999px;
  padding: 2px 9px; margin-left: 2px;
}
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 10px; }
.nav-links a {
  color: #aec0cf; font-size: 14px; font-weight: 500; padding: 8px 12px;
  border-radius: var(--radius-md); transition: color 160ms, background 160ms; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: #f4f7fa; background: rgba(255, 255, 255, .08); }
.nav-search { margin-left: auto; position: relative; }
.nav-search input {
  width: 250px; height: 36px; padding: 0 12px 0 34px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius-md); color: #f4f7fa; font-family: var(--sans); font-size: 13.5px;
}
.nav-search input::placeholder { color: #7e8fa0; }
.nav-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); opacity: .55; pointer-events: none; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: var(--radius-md); cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: #aec0cf;
}
.theme-toggle:hover { color: #f4f7fa; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ── footer ── */
.site-footer { border-top: 1px solid var(--line); margin-top: 72px; }
.site-footer .foot {
  display: flex; align-items: center; gap: 18px; padding: 22px 28px 6px;
  color: var(--muted); font-size: 13px; flex-wrap: wrap;
}
.site-footer .foot > span:last-child { margin-left: auto; }
.site-footer .foot a { color: var(--muted); margin-left: 14px; }
.site-footer .foot a:hover { color: var(--text); }
.site-footer .foot a.epium { margin-left: 0; }
.site-footer .foot-legal { padding: 4px 28px 22px; color: var(--muted-2); font-size: 12px; max-width: 1160px; }

/* ── home hero ── */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 { font-size: 34px; font-weight: 650; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 16px; }
.hero-search { position: relative; max-width: 620px; margin: 26px auto 0; }
.hero-search input {
  width: 100%; height: 52px; padding: 0 18px 0 48px;
  background: var(--input-bg); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-family: var(--sans); font-size: 15.5px;
  box-shadow: var(--shadow-soft);
}
.hero-search input::placeholder { color: var(--muted-2); }
.hero-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hero-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }

/* ── collection cards ── */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 26px 0 10px; }
.card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px 22px 20px; color: inherit;
  transition: border-color 160ms, transform 160ms, box-shadow 160ms;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-soft); color: inherit; }
.card .lbl { color: var(--orange); }
.card h3 { font-size: 17px; font-weight: 650; margin-top: 8px; }
.card p { color: var(--muted); font-size: 14px; margin-top: 6px; line-height: 1.55; }
.card .count { color: var(--muted-2); font-size: 12.5px; margin-top: 12px; }

/* card grid inside an article column (e.g. /reference/): two-up, not squeezed three-up */
.article .cards { grid-template-columns: repeat(2, 1fr); padding: 16px 0 4px; }

/* popular list */
.popular { padding: 34px 0 10px; max-width: 760px; margin: 0 auto; }
.popular h2 { font-size: 15px; margin-bottom: 12px; }
.popular a {
  display: flex; justify-content: space-between; gap: 20px;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--panel); color: var(--text); margin-bottom: 8px; font-size: 14.5px;
}
.popular a:hover { border-color: var(--accent); }
.popular a span { color: var(--muted-2); font-size: 13px; white-space: nowrap; }

/* ── page head band ── */
.page-head { padding: 40px 0 8px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted-2); font-size: 13px; margin-bottom: 18px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.page-head h1 { font-size: 28px; font-weight: 650; letter-spacing: -.01em; }
.page-head .lede { color: var(--text-soft); margin-top: 8px; max-width: 720px; }

/* ── functions hub ── */
.group-section { padding: 26px 0 4px; }
.group-section > .lbl { color: var(--orange); margin-bottom: 12px; display: block; }
.fn-list { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.fn-row {
  display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: baseline;
  padding: 13px 18px; border-top: 1px solid var(--line-soft); color: inherit;
}
.fn-row:first-child { border-top: 0; }
.fn-row:hover { background: var(--panel-2); color: inherit; }
.fn-row .code { color: var(--accent); font-weight: 600; font-size: 13.5px; }
.fn-row p { color: var(--muted); font-size: 14px; }

/* ── article layout ── */
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 56px; padding-top: 6px; }
.article { max-width: 780px; }
.toc { position: sticky; top: 92px; align-self: start; font-size: 13.5px; }
.toc .lbl { color: var(--muted-2); margin-bottom: 10px; display: block; }
.toc a { display: block; color: var(--muted); padding: 5px 0 5px 14px; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--text); }
.toc a.here { color: var(--text); border-left-color: var(--orange); }

.article h2 { font-size: 19px; font-weight: 650; margin: 40px 0 14px; scroll-margin-top: 90px; }
.article h2:first-of-type { margin-top: 28px; }
.article h3 { font-size: 16px; font-weight: 650; margin: 26px 0 10px; }
.article p { margin: 10px 0; color: var(--text-soft); }
.article p strong { color: var(--text); }
.article ul, .article ol { margin: 10px 0; }
.article li { margin: 8px 0 8px 20px; color: var(--text-soft); }
.article img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }

/* syntax block */
.syntax {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; font-family: var(--mono); font-size: 14px; line-height: 1.7;
  overflow-x: auto; white-space: nowrap;
}
.syntax .fn { color: var(--key-text); font-weight: 600; }
.syntax .opt { color: var(--muted); }
.syntax-note { color: var(--muted-2); font-size: 13px; margin-top: 8px; }

/* callout */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--key-border); background: var(--key-bg);
  border-radius: 10px; padding: 14px 16px; margin: 18px 0; font-size: 14px;
}
.callout .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-top: 7px; flex: none; }
.callout code { background: transparent; color: var(--key-text); }

/* tables */
.article table, .tbl table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.article th, .tbl th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.article td, .tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--text-soft); }
.article tr:last-child td, .tbl tr:last-child td { border-bottom: 0; }
.tbl { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); margin: 14px 0 6px; }
.article > table { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); margin: 14px 0 6px; }
td.code { color: var(--accent); font-weight: 600; white-space: nowrap; }
td .req { color: var(--orange); font-weight: 600; font-size: 12.5px; }
td .no { color: var(--muted-2); font-size: 12.5px; }

/* sample output – fake Sheets grid */
.sheet-sample { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); margin: 14px 0 6px; }
.sheet-sample .fx { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; }
.sheet-sample .fx .cell { border: 1px solid var(--line); padding: 1px 8px; border-radius: 4px; color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.sheet-sample .fx .fxi { color: var(--muted-2); font-style: italic; font-family: Georgia, serif; }
.sheet-sample .fx code { color: var(--text-soft); white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.sheet-scroll { overflow-x: auto; }
.sheet-sample table { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 0; }
.sheet-sample th { background: var(--panel-2); color: var(--muted-2); font-weight: 500; font-size: 11px; letter-spacing: 0; text-transform: none; border: 1px solid var(--line-soft); padding: 3px 8px; text-align: center; min-width: 46px; }
.sheet-sample th.rn { min-width: 30px; }
.sheet-sample td { border: 1px solid var(--line-soft); padding: 4px 9px; color: var(--text-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sheet-sample td.hd { font-weight: 600; color: var(--text); }
.sheet-sample td.num { text-align: right; }
.sheet-sample td.more { color: var(--muted-2); font-style: italic; }

/* group chips */
.chip { display: inline-block; font-family: var(--mono); font-size: 12.5px; color: var(--text-soft);
  background: var(--pill-bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; margin: 2px 3px 2px 0; }
.chip-desc { color: var(--muted-2); font-size: 13px; }
.chip-row { margin-bottom: 8px; }

/* examples */
.example { margin: 16px 0; }
.example .formula {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px 10px 0 0;
  padding: 13px 16px; font-family: var(--mono); font-size: 13.5px; overflow-x: auto; white-space: nowrap;
}
.example .formula .fn { color: var(--key-text); font-weight: 600; }
.example .formula .str { color: var(--green); }
.example .caption {
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px;
  background: var(--panel-2); color: var(--muted); font-size: 13.5px; padding: 9px 16px;
}
.example .copy { float: right; color: var(--muted-2); font-size: 12px; cursor: pointer; background: none; border: 0; font-family: var(--sans); }
.example .copy:hover { color: var(--accent); }

/* feedback + related */
.feedback {
  margin-top: 48px; padding: 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.feedback span { color: var(--muted); font-size: 14px; }
.feedback button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-md);
  color: var(--text); font-family: var(--sans); font-size: 13.5px; padding: 7px 14px; cursor: pointer;
}
.feedback button:hover { border-color: var(--accent); }
.feedback .fbtn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-md);
  color: var(--text); font-size: 13.5px; padding: 7px 14px;
}
.feedback .fbtn:hover { border-color: var(--accent); color: var(--text); }

/* Fluent Forms – Emberglass */
.fluentform { max-width: 640px; }
.fluentform .ff-el-form-control, .fluentform textarea.ff-el-form-control {
  background: var(--input-bg); border: 1px solid var(--line); border-radius: var(--radius-md);
  color: var(--text); font-family: var(--sans); font-size: 14.5px; box-shadow: none;
}
.fluentform .ff-el-form-control::placeholder { color: var(--muted-2); }
.fluentform .ff-el-form-control:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.fluentform .ff-el-input--label label { color: var(--text-soft); font-size: 13.5px; font-weight: 600; }
.fluentform .ff-btn-submit {
  background: var(--primary-bg); color: var(--primary-text); border: 0; border-radius: var(--radius-md);
  font-family: var(--sans); font-weight: 600; font-size: 15px; padding: 11px 22px; cursor: pointer;
  transition: transform 160ms ease;
}
.fluentform .ff-btn-submit:hover { transform: translateY(-1px); background: var(--primary-bg); color: var(--primary-text); }
.fluentform .ff-el-is-error .ff-el-form-control { border-color: var(--red); }
.fluentform .error, .fluentform .text-danger { color: var(--red); }
.ff-message-success {
  border: 1px solid var(--green); background: var(--good-soft); color: var(--text);
  border-radius: var(--radius-md); padding: 14px 16px;
}
.related { margin-top: 26px; font-size: 14px; color: var(--muted); }
.related .lbl { margin-right: 10px; }
.related a { font-family: var(--mono); font-size: 13px; margin-right: 14px; }

/* instant search dropdown */
.nav-search, .hero-search { }
.search-pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 150;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-popover); overflow: hidden; text-align: left;
}
.search-pop a {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); color: var(--text);
}
.search-pop a:hover { background: var(--panel-2); }
.search-pop a .code { display: block; color: var(--accent); font-weight: 600; font-size: 13px; }
.search-pop a .desc {
  display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-pop-foot { padding: 8px 14px; color: var(--muted-2); font-size: 12px; background: var(--panel-2); }
.nav-search .search-pop { min-width: 340px; left: auto; }

/* reference page details */
.used-by { margin-top: 4px; font-size: 12.5px; }
.used-by a { font-family: var(--mono); font-size: 11.5px; margin-right: 8px; white-space: nowrap; }
.example-line { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* search results (index.php) */
.search-results { max-width: 760px; padding-top: 10px; }
.search-results .result { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.search-results .result h3 { font-size: 16px; }
.search-results .result p { color: var(--muted); font-size: 14px; margin-top: 4px; }

@media (max-width: 1000px) {
  .cards { grid-template-columns: 1fr; }
  .article-grid { grid-template-columns: 1fr; }
  .toc { display: none; }
  .fn-row { grid-template-columns: 1fr; gap: 2px; }
  .hero h1 { font-size: 27px; }

  /* header collapses to icon + search + toggle, nav becomes a scrollable second row */
  .nav { flex-wrap: wrap; height: auto; padding: 10px 0 0; gap: 10px; }
  .logo img:not(.logo-mark) { display: none; }
  .nav-search { flex: 1; }
  .nav-search input { width: 100%; min-width: 0; }
  .nav-links {
    order: 10; width: 100%; margin: 0; padding: 2px 0 10px;
    overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 10px; font-size: 13.5px; }
}
