/* Chrome built-in AI docs — external stylesheet */

: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 - min(2000px, 94vw) less its
     32px of horizontal padding - so text starts at the same x as on /notes and
     the gutters stay proportional on a wide monitor. Keep the two in sync. */
  --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;
}

/* Back to the site. This page is served with layout: none, so it gets no site
   nav - without this link it is a dead end. The langbar is chrome rather than
   content, so it keeps its LTR order in both languages: the link stays on the
   left and the switch on the right, and only the label swaps. */
.backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: 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;
}

/* JetBrains Mono carries no Arabic, and its letter-spacing is wrong for the
   script - the Arabic label uses the page's Arabic face instead. */
.backlink [data-doc="ar"] {
  font-family: var(--arabic);
  font-size: 13px;
  letter-spacing: 0;
}

.backlink-arrow { transition: transform 0.15s ease; }

.backlink:hover .backlink-arrow { transform: translateX(-3px); }

.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-title {
  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.65;
  color: var(--muted);
  margin: 0 0 34px;
}

/* Tabs ------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 44px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  white-space: nowrap;
  flex: 0 0 auto;
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 15.5px;
  font-weight: 400;
  padding: 0 2px 12px;
  margin-bottom: -1px;
  margin-inline-end: 22px;
  cursor: pointer;
  transition: color 0.15s ease, border-bottom-color 0.15s ease;
}

.tab:hover { color: var(--ink-3); }

/* A crown riding on the corner of the label: after the text in English,
   which puts it on the left in Arabic, where "after" flips. The glyph is a
   Font Awesome icon, so the font-family must stay theirs — do not set one here.
   Gold whether or not the tab is selected: it marks the tab as the notable one,
   which is a fact about the tab, not about which one you are reading. */
.tab-crown {
  font-size: 10px;
  line-height: 1;
  vertical-align: super;
  margin-inline-start: 3px;
  color: var(--gold);
}

/* The active tab is marked by colour and the accent rule alone. Bolding it
   would widen the label, and since .tabs is a flex row that shoves every tab
   after it sideways on each switch — a jump no transition can smooth, because
   font-weight does not interpolate. */
.tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.panel[hidden] { display: none; }

/* One page: with no tab strip the sections follow each other, split by a rule
   and headed by what used to be the tab label. */
.panel + .panel {
  margin-top: 56px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

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

/* Setup panel ------------------------------------------------------------ */

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

/* The picker follows the reader down to the code it controls. The -1px top
   is what lets the observer in app.js notice the row has stuck. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  position: sticky;
  top: -1px;
  z-index: 2;
  background: #FFFFFF;
  padding: 10px 0;
  margin-bottom: 42px;
}

/* Inserted by app.js directly above each picker; it has no visual presence,
   it only reports when the row above it has scrolled out of view. */
.chips-sentinel { height: 1px; margin-bottom: -1px; }

.chips.is-stuck {
  box-shadow: 0 1px 0 var(--line), 0 6px 12px -10px rgba(26, 27, 29, 0.35);
}

/* The chips are the model picker: the code below follows the active one. */
.chip {
  appearance: none;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 5px 9px;
  cursor: pointer;
}

.chip:hover { color: var(--accent-dark); border-color: var(--accent-border); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.steps {
  display: grid;
  gap: 10px;
  margin-bottom: 52px;
}

.steps p {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0;
}

/* Only shown for models still in an origin trial. */
.steps .install-note {
  font-size: 15px;
  color: var(--muted);
}

.steps .install-note[hidden] { display: none; }

/* A footnote to the line above it, not an item of its own in the list. */
.steps .install-note--sub { margin-top: -5px; }

.code {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--surface);
  padding: 2px 5px;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

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

.syntax-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.syntax-head .eyebrow { margin-bottom: 0; }

.model-select {
  appearance: none;
  border: 1px solid var(--accent-border);
  background: #FFFFFF;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  direction: ltr;
}

.step-title {
  font-size: 15.5px;
  font-weight: 600;
  margin: 0 0 8px;
}

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

/* Closes a step instead of introducing one, so it needs the gap a code block
   would have left behind it. */
.step-note--tail { margin-bottom: 32px; }

/* The four answers of availability(), each with what it asks of you. */
.states {
  list-style: none;
  margin: -20px 0 26px;
  padding: 0;
  display: grid;
  gap: 8px;
}

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

.doc[dir="rtl"] .states li { line-height: 1.85; }

.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: 0 0 32px;
  overflow-x: auto;
  color: #383A42;
}

.code-block:last-child { margin-bottom: 0; }

/* Syntax colors ---------------------------------------------------------- */

.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; }

/* Tips panel ------------------------------------------------------------- */

.tips {
  display: grid;
  /* minmax(0,…) keeps a long code line from widening its row past the others */
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  max-width: 1000px;
}

/* Each card is a plain block, always open */
.tip {
  display: block;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.tips > .callout { margin-bottom: 28px; }

/* Both tabs (tips and ideas carry .tips) have no title row: each topic
   heading is the only heading (sized like the design-mode note's .section-title). */
.tips .tip { padding: 28px 0; }

.tips .tip-sub {
  font-size: 19px;
  line-height: 1.6;
  font-weight: 600;
  color: var(--ink);
}

.tips .tip > .tip-sub:first-child { margin-top: 0; }

.tip-sub {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 24px 0 6px;
}


/* every topic after the first is separated by a hairline */
.tip-sub ~ .tip-sub {
  border-top: 1px solid var(--line);
  padding-top: 28px;
  margin-top: 32px;
}

.tip .code-block { margin: 12px 0 0; }

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

.tip-name--all {
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

/* UI / UX topic tags ------------------------------------------------------ */

.tag-ui, .tag-ux {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  vertical-align: middle;
  margin-inline-start: 2px;
}

.tag-ui { color: #4078F2; background: rgba(64, 120, 242, 0.03); }
.tag-ux { color: #986801; background: rgba(152, 104, 1, 0.03); }

/* Do / Don't pairs -------------------------------------------------------- */

.dodont { margin-top: 14px; }

.dodont-label {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
}

.dodont--do .dodont-label { color: #3F7A3F; background: rgba(80, 161, 79, 0.035); }
.dodont--dont .dodont-label { color: #B03A2E; background: rgba(228, 86, 73, 0.03); }

.dodont .code-block { margin-top: 8px; }

/* Callouts --------------------------------------------------------------- */

.callout {
  background: #FBFAF9;
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 5px 5px 0;
  padding: 12px 15px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}

.tip .callout { margin-top: 16px; }

.callout--warn { border-inline-start-color: #C18401; }

/* Figures ---------------------------------------------------------------- */

.figure { margin: 16px 0 0; }

.figure img {
  display: block;
  max-width: 640px;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  filter: brightness(1.0625);
  mix-blend-mode: multiply;
}

/* Case-study clips in the Ideas tab. They play from Chrome's own servers, so
   nothing here is a copy — but the paths are undocumented and can move, which
   is why every clip sits beside a link to the post it came from. */
/* width/height on each <video> give the browser the intrinsic ratio up front,
   so the box is the right shape before a single byte of the file arrives and
   nothing below it jumps when the clip loads. */
.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);
}

.figure--video figcaption { text-align: center; }

.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);
}

/* UI mockups: hidden for now — delete this rule to bring them back */
.figure--demo { display: none; }

.figure--demo img {
  max-width: 520px;
  filter: none;
  mix-blend-mode: normal;
}

.figure figcaption {
  font-size: 13.5px;
  color: var(--muted-2);
  margin-top: 8px;
}

.tip-name {
  font-family: var(--mono);
  font-size: 14.5px;
  color: var(--ink);
}

/* A quiet break inside a tip card, where a second heading would have shouted:
   it separates the technique from the measurement without naming the split. */
.tip-rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 32px 0 28px;
}

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

/* Use-case cards --------------------------------------------------------- */

.cards {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.card { background: #FFF; padding: 14px 16px; }

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-desc {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-3);
  margin-top: 3px;
}

.card-api {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

.stamp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-3);
  margin-top: 56px;
}

/* RTL -------------------------------------------------------------------- */

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

.doc[dir="rtl"] .doc-title { font-size: 29px; line-height: 1.35; letter-spacing: 0; }
.doc[dir="rtl"] .doc-sub,
.doc[dir="rtl"] .steps p,
.doc[dir="rtl"] .step-note,
.doc[dir="rtl"] .tip-body,
.doc[dir="rtl"] .card-desc { line-height: 1.85; }

/* Arabic letters join, so the Latin display treatment — mono face, tracking,
   uppercasing — pulls them apart. Opt these labels back into the Arabic face. */
.doc[dir="rtl"] .eyebrow,
.doc[dir="rtl"] .dodont-label,
.doc[dir="rtl"] .stamp,
.doc[dir="rtl"] .tip-name--all {
  font-family: var(--arabic);
  letter-spacing: 0;
  text-transform: none;
}

.doc[dir="rtl"] .eyebrow { font-size: 12.5px; font-weight: 600; }
.doc[dir="rtl"] .dodont-label { font-size: 12px; font-weight: 600; }
.doc[dir="rtl"] .stamp { font-size: 12px; }

/* The picker follows the Arabic reading order: LanguageModel first, so it
   sits on the right. The names themselves are Latin single tokens, so the
   RTL flow leaves each chip's own text alone. */
.doc[dir="rtl"] .chips { justify-content: flex-start; }
.doc[dir="rtl"] .code-block { text-align: left; }
.doc[dir="rtl"] .tip-name { display: block; text-align: right; }
.doc[dir="rtl"] .callout { border-radius: 5px 0 0 5px; }
.doc[dir="rtl"] .figure figcaption { line-height: 1.85; }

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

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

  .langbar { padding-top: 18px; }

  .doc { padding-top: 34px; }

  .doc-title { font-size: 26px; }
  .doc[dir="rtl"] .doc-title { font-size: 24px; }

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

  /* Tabs stay on one line and scroll sideways instead of wrapping. */
  .tabs {
    gap: 0;
    margin-bottom: 32px;
    /* bleed to the page edges so the scroll feels natural */
    margin-inline: -16px;
    padding-inline: 16px;
  }

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

  /* One line that scrolls sideways, like the tabs — a wrapped sticky row
     would eat half the screen on a phone. */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -16px;
    padding-inline: 16px;
    margin-bottom: 32px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }

  .steps { margin-bottom: 36px; }
  .steps p { font-size: 15.5px; }

  /* The eyebrow and the model picker sit on their own rows when tight. */
  .syntax-head { flex-wrap: wrap; gap: 10px; }
  .model-select { flex: 0 0 auto; }

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

  .tips { gap: 22px; }

  .stamp { margin-top: 40px; }
}

/* Anyone who has asked their system to calm motion down gets no transitions. */
@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;
  }
}
