/*
   cTuning.ai layout (2026-10-31): a thin top bar (the menu button, the mark, where the reader is, the
   theme, the account), a left menu (the site, then the pages of the project the reader is in, grouped as the
   project lists them) and the content beside it. The menu folds away on a wide screen and slides over the page
   on a narrow one. Light and dark themes; the colours and fonts of ctuning_server.css.
*/

:root {
  --ctp-bar-h: 56px;
  --ctp-side-w: 268px;
  --ctp-radius: 12px;

  --ctp-bg: #f6f7fb;
  --ctp-panel: #ffffff;
  --ctp-side-bg: #ffffff;
  --ctp-ink: #1c1e21;
  --ctp-muted: #667085;
  --ctp-line: #e4e7ef;
  --ctp-line-2: #eef0f5;
  --ctp-accent: #2f5fd0;
  --ctp-accent-press: #1f3f9c;
  --ctp-accent-tint: #edf2fe;
  --ctp-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
}

html[data-ctp-theme="dark"] {
  --ctp-bg: #0b0e14;
  --ctp-panel: #12161f;
  --ctp-side-bg: #0e121a;
  --ctp-ink: #e7eaf0;
  --ctp-muted: #98a2b3;
  --ctp-line: #232a36;
  --ctp-line-2: #1a202b;
  --ctp-accent: #7aa2ff;
  --ctp-accent-press: #a3bfff;
  --ctp-accent-tint: rgba(110, 150, 255, .13);
  --ctp-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .35);
}

/* ---- the page ---- */
html, body.ctp { height: 100%; }
body.ctp {
  margin: 0;
  background: var(--ctp-bg) !important;
  color: var(--ctp-ink);
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}
body.ctp a { color: var(--ctp-accent); }
body.ctp a:hover { color: var(--ctp-accent-press); }

/* ---- the top bar ---- */
.ctp-bar {
  position: sticky; top: 0; z-index: 40;
  height: var(--ctp-bar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--ctp-panel) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--ctp-line);
}
.ctp-brand {
  display: flex; align-items: center; gap: 8px;
  color: var(--ctp-ink) !important; text-decoration: none;
  font-weight: 650; font-size: 17px; letter-spacing: -.01em;
  margin-right: 6px;
}
.ctp-crumbs {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--ctp-muted); font-size: 14px;
  white-space: nowrap; overflow: hidden;
}
.ctp-crumbs a { color: var(--ctp-muted) !important; text-decoration: none; }
.ctp-crumbs a:hover { color: var(--ctp-ink) !important; }
.ctp-crumbs .sep { opacity: .5; margin-right: 6px; }
.ctp-crumb { display: inline-flex; align-items: center; min-width: 0; }
.ctp-crumbs .now { color: var(--ctp-ink); overflow: hidden; text-overflow: ellipsis; }
.ctp-bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ctp-bar-link { color: var(--ctp-ink) !important; text-decoration: none; font-size: 14px; }

.ctp-icon-btn {
  width: 36px; height: 36px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--ctp-ink); cursor: pointer;
}
.ctp-icon-btn:hover { background: var(--ctp-accent-tint); color: var(--ctp-accent); }

.ctp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: 9px;
  background: var(--ctp-accent); color: #fff !important;
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
html[data-ctp-theme="dark"] .ctp-btn { color: #0b0e14 !important; }
.ctp-btn:hover { background: var(--ctp-accent-press); }
.ctp-btn-wide { width: 100%; }

/* ---- the menu and the content side by side ---- */
.ctp-body { display: flex; align-items: stretch; min-height: calc(100% - var(--ctp-bar-h)); }

.ctp-side {
  position: sticky; top: var(--ctp-bar-h);
  height: calc(100vh - var(--ctp-bar-h));
  width: var(--ctp-side-w); flex: none;
  display: flex; flex-direction: column;
  background: var(--ctp-side-bg);
  border-right: 1px solid var(--ctp-line);
  transition: margin-left .18s ease, transform .18s ease;
}
html[data-ctp-side="closed"] .ctp-side { margin-left: calc(-1 * var(--ctp-side-w)); }

.ctp-side-nav { flex: 1; overflow-y: auto; padding: 14px 10px 10px; }
.ctp-side-group { margin-bottom: 14px; }
.ctp-side-head {
  padding: 6px 10px 4px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ctp-muted);
}
.ctp-side-project-title {
  padding: 4px 10px 8px; margin-top: 4px;
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 19px; font-weight: 600; line-height: 1.2; color: var(--ctp-ink);
}
.ctp-side-project-title a { color: inherit !important; text-decoration: none; }
.ctp-side-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--ctp-ink) !important; text-decoration: none;
  font-size: 14px; line-height: 1.3;
}
.ctp-side-link:hover { background: var(--ctp-accent-tint); }
.ctp-side-link.is-active {
  background: var(--ctp-accent-tint); color: var(--ctp-accent) !important; font-weight: 600;
  box-shadow: inset 3px 0 0 var(--ctp-accent);
}
.ctp-side-group-small .ctp-side-link { font-size: 13px; color: var(--ctp-muted) !important; padding: 5px 10px; }
.ctp-ico { width: 18px; text-align: center; color: var(--ctp-muted); flex: none; }
.ctp-ext { font-size: 11px; color: var(--ctp-muted); margin-left: auto; }
.ctp-side-foot { padding: 12px; border-top: 1px solid var(--ctp-line); display: grid; gap: 4px; }

.ctp-scrim { display: none; }

.ctp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ctp-content { flex: 1; width: 100%; max-width: 1180px; padding: 28px 36px 40px; margin: 0 auto; }

/* ---- page headings ---- */
.ctp-page-head { margin: 4px 0 22px; }
.ctp-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ctp-accent); margin-bottom: 6px;
}
.ctp-eyebrow a { text-decoration: none; }
.ctp-title {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: clamp(28px, 3.2vw, 40px); font-weight: 600; line-height: 1.15; letter-spacing: -.01em;
  color: var(--ctp-ink) !important; margin: 0;
}

/* ---- the project index: the intro, then the projects as cards in their groups ---- */
.ctp-project-index#ctp-project-index { max-width: none !important; margin: 0 !important; text-align: left !important; }
.ctp-project-index > div[style] { text-align: left !important; margin-left: 0 !important; max-width: 860px !important; }
.ctp-project-index > div p { color: var(--ctp-ink); font-size: 16px; line-height: 1.65; max-width: 860px; }
.ctp-project-index > br { display: none; }
.ctp-project-index.ctp-has-cards > li { display: none !important; }      /* shown as cards (ctp-layout.js) */

.ctp-groups { margin-top: 26px; display: grid; gap: 28px; }
.ctp-group-title {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ctp-muted); margin: 0 0 10px;
}
.ctp-group-title .n { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .8; }
.ctp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ctp-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px 15px; border-radius: var(--ctp-radius);
  background: var(--ctp-panel); border: 1px solid var(--ctp-line);
  box-shadow: var(--ctp-shadow);
  color: var(--ctp-ink) !important; text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.ctp-card:hover { border-color: var(--ctp-accent); transform: translateY(-1px); }
.ctp-card .t { font-weight: 600; font-size: 15px; line-height: 1.35; }
.ctp-card .d { color: var(--ctp-muted); font-size: 13.5px; line-height: 1.45; }
.ctp-card .ext { position: absolute; top: 12px; right: 14px; font-size: 12px; color: var(--ctp-muted); }

/* ---- a project page: the plugin's own content, given room ---- */
.ctp-project-page { min-width: 0; }

/* ---- the footer ---- */
.ctp-footer {
  padding: 18px 36px 22px; border-top: 1px solid var(--ctp-line);
  color: var(--ctp-muted); font-size: 13px; text-align: center;
}
.ctp-footer a { color: var(--ctp-muted) !important; }
.ctp-footer .powered-by { margin-top: 4px; font-size: 12px; }

/* ---- the top bar with the mark alone (the home page, a homepage): no name, no place ---- */
html[data-ctp-bar="mark"] .ctp-brand span,
html[data-ctp-bar="mark"] .ctp-crumbs { display: none !important; }

/* ---- the plain layout: the top bar alone, the page centred (a homepage, or a page that asks for it) ---- */
html[data-ctp-layout="plain"] .ctp-side,
html[data-ctp-layout="plain"] .ctp-scrim,
html[data-ctp-layout="plain"] #ctp-menu-btn { display: none !important; }

/* ---- narrow screens: the menu slides over the page, closed by default ---- */
@media (max-width: 960px) {
  .ctp-side {
    position: fixed; left: 0; top: var(--ctp-bar-h); z-index: 50;
    margin-left: 0 !important; transform: translateX(-100%);
    box-shadow: var(--ctp-shadow);
  }
  html.ctp-side-open .ctp-side { transform: none; }
  html.ctp-side-open .ctp-scrim {
    display: block; position: fixed; inset: var(--ctp-bar-h) 0 0 0; z-index: 45;
    background: rgba(5, 8, 15, .45);
  }
  .ctp-content { padding: 20px 16px 32px; }
  .ctp-footer { padding: 16px; }
  .ctp-crumbs .hide-narrow { display: none; }
  .ctp-crumbs .ctp-crumb:not(.hide-narrow) .sep { display: none; }
}
@media (max-width: 560px) {
  .ctp-brand span { display: none; }
  .ctp-cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ctp-side, .ctp-card { transition: none; } }
