/*
 * YORU-Explain — theme tokens and components.
 *
 * The colours are the application's own (src/yoru_explain/gui/theme.py):
 * YORU's DearPyGui theme (navy window, YORU blue tabs) with YORU-Explain's
 * accent, the hot pink #FF69B4 of the default occlusion baseline.  Dark is
 * the default, as the window is; the light variant keeps the same hues.
 */

/* ------------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------------- */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --font-sans: "PT Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "PT Serif", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, "Liberation Mono", monospace;

  /* The window */
  --bg: #12182a;              /* WindowBg (18, 24, 42) */
  --bg-elev: #161e34;         /* ChildBg (22, 30, 52) */
  --bg-input: #1e2a44;        /* FrameBg (30, 42, 68) */
  --bg-zebra: #151c31;
  --border: #26375a;          /* FrameBgHovered (38, 55, 88) */
  --separator: #32558c;       /* Separator (50, 85, 140) */
  --text: #e6e6e6;            /* Text (230, 230, 230) */
  --text-strong: #ffffff;
  --text-muted: #96a5be;      /* TEXT_MUTED (150, 165, 190) */
  --heading: #ffffff;
  --heading-accent: #ffa0d2;  /* TEXT_HEADER (255, 160, 210): section headers */

  /* YORU-Explain's accent */
  --link: #ff69b4;            /* ACCENT (255, 105, 180), hot pink */
  --link-hover: #ff96cd;      /* SliderGrabActive (255, 150, 205) */
  --accent: #ff69b4;
  --accent-dim: #842e62;      /* ACCENT_DIM (132, 46, 98): buttons, the active tab */
  --accent-hover: #aa3e7e;    /* ACCENT_HOVER (170, 62, 126) */
  --accent-active: #6c2450;   /* ACCENT_ACTIVE (108, 36, 80) */
  --primary: #c4408a;         /* primary button (196, 64, 138) */
  --primary-hover: #e256a2;   /* (226, 86, 162) */
  --primary-active: #a03270;  /* (160, 50, 112) */
  --on-primary: #fff8fc;
  --select: #582852;          /* Header (88, 40, 82): a selected row */
  --table-head: #282646;      /* TableHeaderBg (40, 38, 70) */

  /* YORU's blue */
  --yoru-blue: #194682;       /* TitleBg / Tab (25, 70, 130) */
  --yoru-blue-hover: #3273b9; /* TabHovered (50, 115, 185) */

  /* Text states and the boxes on the frame */
  --ok: #82dca0;              /* TEXT_OK */
  --warn: #ffbe6e;            /* TEXT_WARN */
  --error: #ff7878;           /* TEXT_ERROR */
  --box: #ffdc00;             /* detections */
  --box-selected: #ff3c3c;    /* the selected detection */
  --box-imported: #78c8ff;    /* boxes of an attached YORU CSV */

  --code-bg: #0e1323;
  --code-text: #e6e6e6;
  --code-inline: #c9dcff;
  --shadow: rgba(0, 0, 0, .45);

  /* Code, in the window's text colours */
  --syn-comment: #8a9ab6;
  --syn-keyword: #ff8cc6;
  --syn-string: #82dca0;
  --syn-number: #ffbe6e;
  --syn-func: #78c8ff;
  --syn-class: #f2d84f;
  --syn-builtin: #ffa0d2;
  --syn-op: #c9d3e6;
  --syn-prompt: #96a5be;
}

/* The chrome -- masthead, tab bar, sidebar, footer -- is the window in both themes. */
:root {
  --chrome-band: #0f1424;
  --chrome-bg: #12182a;
  --chrome-panel: #161e34;
  --chrome-border: rgba(150, 165, 190, .16);
  --chrome-line: #32558c;
  --chrome-text: #e6e6e6;
  --chrome-text-muted: #96a5be;
  --chrome-header: #ffa0d2;
  --chrome-select: #582852;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #ffffff;
  --bg-elev: #f6f7fb;
  --bg-input: #eef1f7;
  --bg-zebra: #f8f9fc;
  --border: #e0e5ef;
  --separator: #b9c9e4;
  --text: #384052;
  --text-strong: #011b43;     /* YORU's navy (the logo) */
  --text-muted: #5f6b85;
  --heading: #011b43;
  --heading-accent: #a62b70;

  --link: #b02e78;
  --link-hover: #84205a;
  --accent: #c4408a;
  --select: #f7dcea;
  --table-head: #ece9f4;

  --ok: #1f7a45;
  --warn: #9a5800;
  --error: #b42318;

  --code-bg: #f6f7fb;
  --code-text: #1f2a44;
  --code-inline: #1b3f78;
  --shadow: rgba(1, 27, 67, .16);

  --syn-comment: #66728c;
  --syn-keyword: #a62b70;
  --syn-string: #1f7a45;
  --syn-number: #9a5800;
  --syn-func: #1d5fa8;
  --syn-class: #6f5600;
  --syn-builtin: #84205a;
  --syn-op: #384052;
  --syn-prompt: #66728c;
}

::selection {
  color: #fff;
  background: var(--accent-dim);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.only-light { display: none !important; }
:root[data-theme="light"] .only-light { display: block !important; }
:root[data-theme="light"] .only-dark { display: none !important; }


/* ------------------------------------------------------------------------
 * Masthead and the tab bar (the window's menu and tabs)
 * ---------------------------------------------------------------------- */

.masthead {
  margin-bottom: 2.25rem;
  padding-top: .8rem;
  font-family: var(--font-sans);
  background: var(--chrome-band);
  border-bottom: 1px solid var(--chrome-line);
}
.masthead .container {
  padding-left: 3.9rem;
  padding-right: 3.9rem;
}
@media (min-width: 64em) {
  .masthead .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
.masthead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .9rem;
  min-height: 2.3rem;
  padding-bottom: .7rem;
}
.masthead-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
}
.masthead-brand:hover,
.masthead-brand:focus {
  color: #fff;
  text-decoration: none;
}
.masthead-icon {
  width: 34px;
  height: 34px;
  margin: 0;
  border-radius: 7px;
}
.masthead-tagline {
  font-size: .85rem;
  color: var(--chrome-text-muted);
}
@media (max-width: 48em) {
  .masthead-row {
    justify-content: center;
  }
  .masthead-tagline {
    display: none;
  }
}
/* With the menu open, its button moves to the menu's edge: make room for it
   where that edge meets the page's column (Home opens the menu there). */
.masthead-row {
  transition: padding-left .3s ease-in-out;
}
@media (min-width: 64em) and (max-width: 94em) {
  #sidebar-checkbox:checked ~ .wrap .masthead-row {
    padding-left: 2.75rem;
  }
}

.tabs {
  display: flex;
  gap: 3px;
  margin-bottom: -1px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  flex: none;
  padding: .3rem .85rem .28rem;
  font-size: .82rem;
  color: var(--chrome-text);
  background: var(--yoru-blue);
  border-radius: 4px 4px 0 0;
}
.tab:hover,
.tab:focus {
  color: #fff;
  text-decoration: none;
  background: var(--yoru-blue-hover);
}
.tab.active {
  color: #fff;
  background: var(--accent-dim);
  box-shadow: inset 0 -2px 0 var(--accent);
}
@media (max-width: 48em) {
  .tabs {
    justify-content: flex-start;
  }
}


/* ------------------------------------------------------------------------
 * The other toggle: dark / light
 * ---------------------------------------------------------------------- */

.theme-toggle {
  position: absolute;
  top: .7rem;
  right: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  color: #fff;
  background: var(--yoru-blue);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}
@media (min-width: 30.1em) {
  .theme-toggle {
    position: fixed;
  }
}
.theme-toggle:hover {
  background: var(--yoru-blue-hover);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.theme-toggle .icon-moon {
  fill: currentColor;
  stroke: none;
}
:root[data-theme="dark"] .theme-toggle .icon-moon,
:root:not([data-theme]) .theme-toggle .icon-moon {
  display: none;
}
:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}


/* ------------------------------------------------------------------------
 * Pages
 * ---------------------------------------------------------------------- */

.page-kicker {
  margin: 0 0 .35rem;
  font-family: var(--font-sans);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--heading-accent);
}
.page-title {
  font-size: 2rem;
}
.content h2 {
  padding-bottom: .3rem;
  color: var(--heading-accent);
  border-bottom: 1px solid var(--separator);
}
.content h2 code,
.content h3 code {
  font-size: 80%;
}

/* "On this page", built by script.js on long pages */
.toc {
  margin: 0 0 2rem;
  padding: .75rem 1rem .8rem;
  font-family: var(--font-sans);
  font-size: .85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.toc-title {
  margin: 0 0 .35rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--heading-accent);
}
.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: 2rem;
}
.toc li {
  break-inside: avoid;
}
@media (max-width: 40em) {
  .toc ol {
    columns: 1;
  }
}

/* Previous / next */
.pager {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  font-family: var(--font-sans);
  border-top: 1px solid var(--border);
}
.pager-item {
  flex: 1 1 0;
  display: block;
  padding: .65rem .9rem;
  color: var(--text-strong);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.pager-item small {
  display: block;
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pager-next {
  text-align: right;
}
a.pager-item:hover,
a.pager-item:focus {
  color: var(--text-strong);
  text-decoration: none;
  border-color: var(--accent);
}
.pager-empty {
  visibility: hidden;
}


/* ------------------------------------------------------------------------
 * Content components
 * ---------------------------------------------------------------------- */

/* Figures and screenshots */
figure {
  margin: 1.5rem 0 1.75rem;
}
figure img {
  margin: 0 auto;
  border: 1px solid var(--border);
}
figure.screenshot img {
  border-color: #32558c;
  box-shadow: 0 .6rem 1.6rem var(--shadow);
}
figcaption {
  margin-top: .55rem;
  font-family: var(--font-sans);
  font-size: .82rem;
  line-height: 1.5;
  color: var(--text-muted);
}
figcaption strong {
  color: var(--text);
}
/* Callouts (```<div class="callout warning" markdown="1">```) */
.callout {
  margin: 1.25rem 0 1.5rem;
  padding: .8rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
}
.callout > :last-child {
  margin-bottom: 0;
}
.callout-title {
  margin-bottom: .3rem;
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--heading-accent);
}
.callout.warning {
  border-left-color: var(--warn);
}
.callout.warning .callout-title {
  color: var(--warn);
}
.callout.ok {
  border-left-color: var(--ok);
}
.callout.ok .callout-title {
  color: var(--ok);
}
.callout.info {
  border-left-color: var(--yoru-blue-hover);
}
.callout.info .callout-title {
  color: var(--text-strong);
}

/* Buttons, as in the window */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1.25rem 0;
}
.button {
  display: inline-block;
  padding: .42rem 1rem;
  font-family: var(--font-sans);
  font-size: .9rem;
  color: #fff;
  background: var(--accent-dim);
  border-radius: 5px;
}
.button:hover,
.button:focus {
  color: #fff;
  text-decoration: none;
  background: var(--accent-hover);
}
.button.primary {
  color: var(--on-primary);
  background: var(--primary);
}
.button.primary:hover,
.button.primary:focus {
  background: var(--primary-hover);
}
.button.blue {
  background: var(--yoru-blue);
}
.button.blue:hover,
.button.blue:focus {
  background: var(--yoru-blue-hover);
}

/* A small colour sample (box colours, baselines) */
.swatch {
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-right: .3em;
  vertical-align: -.08em;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 2px;
}
:root[data-theme="light"] .swatch {
  border-color: rgba(1, 27, 67, .25);
}

/* Text in the window's state colours */
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-error { color: var(--error); }
.text-muted { color: var(--text-muted); }

/* Wide tables scroll in their own box */
.table-wrap {
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.table-wrap > table {
  margin-bottom: 0;
}

/* Code blocks get a Copy button (script.js), like the window's log */
.code-block {
  position: relative;
}
.copy-button {
  position: absolute;
  top: .45rem;
  right: .45rem;
  padding: .12rem .55rem;
  font-family: var(--font-sans);
  font-size: .72rem;
  color: #fff;
  background: var(--accent-dim);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease-in-out;
}
.code-block:hover .copy-button,
.copy-button:focus {
  opacity: 1;
}
.copy-button:hover {
  background: var(--accent-hover);
}
@media (hover: none) {
  .copy-button {
    opacity: 1;
  }
}

/* A pipeline drawn as steps (rows of four; a column on phones) */
.flow {
  margin: 1.25rem 0 1.75rem;
  font-family: var(--font-sans);
}
.flow-row + .flow-row {
  margin-top: 1rem;
}
.flow-title {
  margin: 0 0 .4rem;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--heading-accent);
}
.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.35rem;
}
.flow-step {
  position: relative;
  padding: .55rem .7rem;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.flow-step:not(:last-child)::after {
  content: "\2192";
  position: absolute;
  top: 50%;
  right: -1.05rem;
  transform: translateY(-50%);
  font-size: .95rem;
  color: var(--text-muted);
}
.flow-step.key {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.flow-step.end {
  background: var(--bg-input);
}
.flow-step b {
  color: var(--text-strong);
}
@media (max-width: 40em) {
  .flow-steps {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .flow-step:not(:last-child)::after {
    content: "\2193";
    top: auto;
    right: 50%;
    bottom: -1.2rem;
    transform: translateX(50%);
  }
}

/* Definitions of a term next to each other on wide screens */
dl.terms dt {
  font-family: var(--font-sans);
}
dl.terms dd {
  margin-left: 1.25rem;
}


/* ------------------------------------------------------------------------
 * Home
 * ---------------------------------------------------------------------- */

.hero {
  margin: -.5rem 0 2rem;
  text-align: center;
}
.hero-logo {
  width: min(100%, 27rem);
  margin: 0 auto 1rem;
  border-radius: 0;
}
.hero .lead {
  max-width: 35rem;
  margin: 0 auto 1.25rem;
  color: var(--text);
}
.hero .button-row {
  justify-content: center;
}

.family {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}
@media (max-width: 40em) {
  .family {
    grid-template-columns: 1fr;
  }
}
.family-card {
  display: flex;
  flex-direction: column;
  padding: .85rem 1rem .9rem;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-top: 3px solid var(--app-accent, var(--accent));
  border-radius: 6px;
}
.family-card h3 {
  margin: 0 0 .3rem;
  font-size: 1.05rem;
}
.family-card p {
  flex: 1;
  margin: 0 0 .6rem;
  font-size: .86rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.family-card code {
  align-self: flex-start;
  font-size: .74rem;
}
.family-card .family-links {
  margin-top: .55rem;
  font-size: .82rem;
}
.family-card.current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.family-card .badge {
  margin-left: .35rem;
  padding: .05rem .4rem;
  font-size: .68rem;
  font-weight: 700;
  vertical-align: .15em;
  color: #fff;
  background: var(--accent-dim);
  border-radius: 3px;
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}
@media (max-width: 40em) {
  .features {
    grid-template-columns: 1fr;
  }
}
.feature {
  padding: .8rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.feature h3 {
  margin: 0 0 .3rem;
  font-size: .98rem;
  color: var(--heading);
}
.feature p {
  margin: 0;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--text-muted);
}


/* ------------------------------------------------------------------------
 * Footer
 * ---------------------------------------------------------------------- */

.site-footer {
  margin-top: 3rem;
  padding: 1.4rem 0 1.8rem;
  font-family: var(--font-sans);
  font-size: .8rem;
  color: var(--chrome-text-muted);
  background: var(--chrome-band);
  border-top: 1px solid var(--chrome-line);
}
.site-footer p {
  margin: 0 0 .3rem;
}
.site-footer a {
  color: #ff96cd;
}


/* ------------------------------------------------------------------------
 * Print: the content only, dark on white
 * ---------------------------------------------------------------------- */

@media print {
  :root,
  :root[data-theme] {
    --bg: #fff;
    --bg-elev: #fff;
    --text: #222;
    --heading: #011b43;
    --heading-accent: #011b43;
    --link: #011b43;
  }
  .sidebar,
  .sidebar-toggle,
  .theme-toggle,
  .tabs,
  .toc,
  .pager,
  .copy-button,
  .site-footer {
    display: none !important;
  }
  .masthead {
    background: none;
    border: 0;
  }
  .masthead-brand {
    color: #011b43;
  }
}
