/* Design mode note — external stylesheet. Copied from the WebMCP note
   (public/posts/webmcp/styles.css); the page is Arabic-first, so the doc is RTL. */

:root {
  --accent: #F26B21;
  --accent-dark: #D2530E;
  --accent-border: #F0DDD0;
  --gold: #B8860B;
  --ink: #1A1B1D;
  --ink-2: #4B4E54;
  --ink-3: #6B6E74;
  --muted: #78797E;
  --muted-2: #93969B;
  --muted-3: #B4B6BA;
  --line: #EDEBE8;
  --surface: #F7F6F4;
  --code-bg: #FAFAFA;
  --code-border: #EFEDEA;
  /* Mirrors .container--wide in public/style.css — see the Chrome note. */
  --measure: min(1968px, calc(94vw - 32px));
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --arabic: 'IBM Plex Sans Arabic', 'Helvetica Neue', sans-serif;
}

html, body { margin: 0; padding: 0; background: #FFFFFF; }
body { -webkit-font-smoothing: antialiased; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(242, 107, 33, 0.35); }
a:hover { color: var(--accent-dark); border-bottom-color: var(--accent-dark); }

::selection { background: rgba(242, 107, 33, 0.16); }

/* Page shell ------------------------------------------------------------- */

.page {
  min-height: 100vh;
  background: #FFFFFF;
  font-family: var(--sans);
  color: var(--ink);
  padding: 0 24px 120px;
  font-size: 15.5px;
}

.langbar {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 28px;
}

/* Served with layout: none, so this link is the only way back to the site. */
.backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--arabic);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-bottom: none;
  padding: 6px 2px;
  transition: color 0.15s ease;
}

.backlink:hover { color: var(--accent); }

.backlink:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.backlink-arrow { font-family: var(--mono); transition: transform 0.15s ease; }
.backlink:hover .backlink-arrow { transform: translateX(-3px); }

/* Arabic face for the Arabic label; the English one uses the mono label style
   of the Chrome note. */
.backlink [data-doc="en"] {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

/* Language switch - the same control as the Chrome note. */
.langswitch {
  display: flex;
  background: #FFFFFF;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.lang-btn {
  appearance: none;
  border: 1px solid transparent;
  background: #FFFFFF;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}

.lang-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
}

/* Article ---------------------------------------------------------------- */

.doc {
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 52px;
}

.doc[hidden] { display: none; }

.doc[dir="rtl"] { font-family: var(--arabic); }

.doc-title {
  font-family: var(--sans);
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 10px;
}

.doc-sub {
  font-size: 17px;
  line-height: 1.85;
  color: var(--muted);
  margin: 0 0 34px;
  max-width: 1000px;
}

/* One page: the sections follow each other, split by a rule. Prose-heavy, so
   each keeps the reading width the Chrome tips use. */
.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1000px;
}

.panel + .panel {
  margin-top: 56px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

/* Sections --------------------------------------------------------------- */

.section-title {
  font-size: 19px;
  line-height: 1.6;
  font-weight: 600;
  color: var(--ink);
  margin: 48px 0 6px;
}

.panel > .section-title:first-child { margin-top: 0; }

.step-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 28px 0 4px;
}

.step-note {
  font-size: 15px;
  line-height: 1.85;
  color: var(--muted-2);
  margin: 0 0 10px;
}

.tip-body {
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-2);
  margin: 10px 0 0;
}

/* Term-then-explanation lists, each item hanging off a thin rule. */
.states {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.states li {
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink-2);
  padding-inline-start: 13px;
  border-inline-start: 2px solid var(--line);
}

.states strong { color: var(--ink); font-weight: 600; }

/* An aside inside a list item: smaller and quieter than the item itself. */
.small-note { font-size: 14px; color: var(--muted); }

/* Code ------------------------------------------------------------------- */

.code--bare {
  font-family: var(--mono);
  font-size: 13.5px;
  background: none;
  padding: 0;
}

.code-block {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 18px;
  margin: 16px 0 0;
  overflow-x: auto;
  color: #383A42;
  text-align: left;
}

.tok-keyword { color: #A626A4; }
.tok-fn      { color: #4078F2; }
.tok-cls     { color: #C18401; }
.tok-prop    { color: #E45649; }
.tok-str     { color: #50A14F; }
.tok-num     { color: #986801; }
.tok-comment { color: #A0A1A7; }
.tok-plain   { color: #383A42; }
.tok-attr    { color: #4078F2; font-weight: 600; }

/* Accordions ------------------------------------------------------------- */

.tip {
  display: block;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.panel > .tip:first-of-type,
.section-title + .tip,
.step-note + .tip,
.states + .tip { margin-top: 20px; border-top: 1px solid var(--line); }

.tip-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.tip-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tip-summary::-webkit-details-marker { display: none; }

.tip-summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-inline-start: auto;
  flex: 0 0 auto;
  border-right: 1.5px solid var(--muted-2);
  border-bottom: 1.5px solid var(--muted-2);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}

.tip[open] > .tip-summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
  border-color: var(--accent);
}

.tip-summary:hover::after { border-color: var(--accent); }

.tip-name {
  font-size: 16.5px;
  line-height: 1.7;
  font-weight: 700;
  color: var(--ink);
}

.tip[open] > .tip-summary .tip-name { color: var(--accent); }

.tip[open] { padding-bottom: 28px; }

.tip > .tip-body:first-of-type { margin-top: 0; }

/* Wrong / right pairs ---------------------------------------------------- */

.callout {
  background: var(--surface);
  border-inline-start: 3px solid var(--accent);
  border-radius: 5px 0 0 5px;
  padding: 12px 15px;
  margin-top: 12px;
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

.callout--bad  { border-inline-start-color: #E45649; }
.callout--good { border-inline-start-color: #50A14F; }

.callout-title { font-size: 17px; font-weight: 600; margin: 0; color: var(--ink); }

/* English use-case stories ----------------------------------------------- */

.ltr-block {
  direction: ltr;
  text-align: left;
  font-family: var(--sans);
}

.ltr-block .tip-body,
.ltr-block .step-note { line-height: 1.65; }

.chat {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 6px;
}

.chat strong { color: var(--ink); font-weight: 600; }

.code-peek { margin-top: 14px; }

.code-peek > summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--accent);
  border-bottom: 1px solid rgba(242, 107, 33, 0.35);
}

.code-peek > summary::-webkit-details-marker { display: none; }

.code-peek > summary:hover {
  color: var(--accent-dark);
  border-bottom-color: var(--accent-dark);
}

.code-peek .code-block { margin-top: 10px; }

.idea-source {
  font-size: 13.5px;
  color: var(--muted-2);
  margin: 14px 0 0;
}

.idea-source a {
  color: var(--ink-2);
  border-bottom-color: var(--muted-3);
}

.idea-source a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink-3);
}

/* References + stamp ----------------------------------------------------- */

.refs {
  max-width: 1000px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.refs .section-title { margin-top: 0; font-size: 16px; }

.refs a { font-family: var(--mono); font-size: 14px; }

.credit {
  font-size: 14px;
  color: var(--muted);
  margin-top: 40px;
}

.credit strong { color: var(--ink); font-weight: 600; }

.credit + .stamp { margin-top: 6px; }

.stamp {
  font-size: 12px;
  color: var(--muted-3);
  margin-top: 40px;
}

/* Glossary tooltips ------------------------------------------------------ */

/* Explanation lives in data-tip; shows on hover, and on focus for keyboard and tap. */
.term {
  position: relative;
  border-bottom: 1px dashed var(--muted-3);
  cursor: help;
}

.term:focus { outline: none; }
.term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.term::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 10;
  width: max-content;
  max-width: min(280px, 70vw);
  padding: 8px 11px;
  border-radius: 6px;
  background: var(--ink);
  color: #FFFFFF;
  font-family: var(--arabic);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.term:hover::after,
.term:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* English ---------------------------------------------------------------- */

/* The sizes above are set for the Arabic copy. Latin text needs less leading,
   and the start edge is on the left. */
.doc[dir="ltr"] .doc-sub,
.doc[dir="ltr"] .step-note,
.doc[dir="ltr"] .tip-body,
.doc[dir="ltr"] .states li,
.doc[dir="ltr"] .card-desc,
.doc[dir="ltr"] .callout { line-height: 1.65; }

.doc[dir="ltr"] .callout { border-radius: 0 5px 5px 0; }

.doc[dir="ltr"] .term::after {
  font-family: var(--sans);
  direction: ltr;
  text-align: left;
}

/* Mobile ----------------------------------------------------------------- */

/* Screen recordings. width/height on each <video> give the browser the ratio
   up front, so nothing below it jumps when the clip loads. */
.figure { margin: 16px 0 0; }

.figure video {
  display: block;
  max-width: 760px;
  width: 100%;
  margin-inline: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

@media (max-width: 640px) {
  .page { padding: 0 16px 72px; }

  .langbar { padding-top: 18px; }

  .doc { padding-top: 34px; }

  .doc-title { font-size: 26px; }

  .doc-sub { font-size: 16px; margin-bottom: 26px; }

  .tabs {
    gap: 0;
    margin-bottom: 32px;
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .tab { font-size: 15px; margin-inline-end: 18px; }
  .tab:last-child { margin-inline-end: 0; }

  .section-title { font-size: 17.5px; margin-top: 36px; }

  .code-block { padding: 14px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
