/* Nainuwa theme for DeerFlow (research workspace). Served by deerflow-nginx at /rw-theme/ and appended to every
   HTML <head> (sub_filter), so it only overrides DeerFlow's CSS variables (frontend/src/styles/globals.css at
   fc0d4bd); no DeerFlow source is changed.
   House style: black / grayscale (no colour; destructive stays red), Lato 300/400/700/900, 12px base radius.
   Lato: SIL Open Font License 1.1, files from @fontsource/lato 5.3.0 (fonts/LICENSE-Lato-OFL.txt).

   Specificity: DeerFlow's :root / .dark blocks are unlayered, and Next.js may append its stylesheets after this
   one on client navigation, so the selectors below are doubled (0,2,0) to win regardless of order; the dark block
   comes after the light one with equal specificity, so dark mode still wins on <html class="dark">. */

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/lato-latin-ext-300-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/lato-latin-300-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/lato-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/lato-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/lato-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/lato-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("fonts/lato-latin-ext-900-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: "Lato";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("fonts/lato-latin-900-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: "Lato";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/lato-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: "Lato";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/lato-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root:root {
  --font-sans: "Lato", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
  --radius: 0.75rem;

  --background: #f6f6f6;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --popover: #ffffff;
  --popover-foreground: #0a0a0a;
  --primary: #111111;
  --primary-foreground: #f5f5f5;
  --secondary: #e8e8e8;
  --secondary-foreground: #1b1b1b;
  --muted: #eeeeee;
  --muted-foreground: #5c5c5c;
  --accent: #e4e4e4;
  --accent-foreground: #111111;
  --destructive: oklch(0.577 0.245 27.325);
  --border: #dbdbdb;
  --input: #cccccc;
  --ring: #6b6b6b;
  --chart-1: #111111;
  --chart-2: #474747;
  --chart-3: #767676;
  --chart-4: #a3a3a3;
  --chart-5: #cfcfcf;
  --sidebar: #eeeeee;
  --sidebar-foreground: #0a0a0a;
  --sidebar-primary: #111111;
  --sidebar-primary-foreground: #f5f5f5;
  --sidebar-accent: #e0e0e0;
  --sidebar-accent-foreground: #111111;
  --sidebar-border: #dbdbdb;
  --sidebar-ring: #8a8a8a;
}

:root.dark,
.dark.dark {
  --background: #090909;
  --foreground: #f5f5f5;
  --card: #171717;
  --card-foreground: #f5f5f5;
  --popover: #1b1b1b;
  --popover-foreground: #f5f5f5;
  --primary: #ededed;
  --primary-foreground: #111111;
  --secondary: #262626;
  --secondary-foreground: #f5f5f5;
  --muted: #1e1e1e;
  --muted-foreground: #bdbdbd;
  --accent: #2a2a2a;
  --accent-foreground: #f5f5f5;
  --destructive: oklch(0.704 0.191 22.216);
  --border: #ffffff24;
  --input: #ffffff2e;
  --ring: #9e9e9e;
  --chart-1: #ededed;
  --chart-2: #bdbdbd;
  --chart-3: #8f8f8f;
  --chart-4: #666666;
  --chart-5: #444444;
  --sidebar: #111111;
  --sidebar-foreground: #f5f5f5;
  --sidebar-primary: #ededed;
  --sidebar-primary-foreground: #111111;
  --sidebar-accent: #222222;
  --sidebar-accent-foreground: #f5f5f5;
  --sidebar-border: #ffffff1f;
  --sidebar-ring: #8a8a8a;
}

html,
body {
  font-family: var(--font-sans);
}

/* Headings in the house style: heavy weight, slightly tight tracking. */
h1,
h2 {
  font-weight: 900;
  letter-spacing: -0.015em;
}

/* Native controls (checkboxes, radios, range) follow the grayscale primary instead of the browser's blue. */
:root:root {
  accent-color: var(--primary);
}

/* ── Login / setup: the Nainuwa Nextcloud login look (night-sky photo, white logo, tagline pill) ───────────────
   Scoped by DOM shape so it never matches workspace pages, even when the stylesheet stays loaded across client
   navigation: AUTH = the full-screen wrapper that holds DeerFlow's deer-mask canvas (only /login and /setup at
   fc0d4bd), CARD = its rounded card. Photo and logo: scego_search/img (the vanilla NC theming), see img/README.txt. */
.min-h-screen:has(> [class*="deer.svg"]) {
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 16px;
  background: #0d1f4f url("img/background.jpg") center bottom / cover no-repeat;
  color: #ffffff;
}
/* spacer above the card, same height as the pill below it, keeps the card centred */
.min-h-screen:has(> [class*="deer.svg"])::before {
  content: "";
  display: block;
  height: 34px;
  flex: none;
}
/* tagline pill (NC: "Nainuwa – Give life to your digital treasures.") */
.min-h-screen:has(> [class*="deer.svg"])::after {
  content: "Nainuwa \2013  Give life to your digital treasures.";
  flex: none;
  display: block;
  max-width: calc(100% - 16px);
  padding: 7px 24px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.82);
  color: #222222;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}
/* DeerFlow's flickering deer canvas */
.min-h-screen:has(> [class*="deer.svg"]) > [class*="deer.svg"] {
  display: none;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl {
  margin-block: auto;
  border-color: rgb(255 255 255 / 0.22);
  border-radius: 16px;
  background: rgb(8 18 48 / 0.42);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.35);
  color: #ffffff;
  /* everything inside the card is on the dark glass, whatever the colour scheme */
  --foreground: #ffffff;
  --muted-foreground: #d9e2f2;
  --background: transparent;
  --border: rgb(255 255 255 / 0.28);
  --input: rgb(255 255 255 / 0.35);
  --ring: #ffffff;
  --primary: #ffffff;
  --primary-foreground: #0b1a40;
  --accent: rgb(255 255 255 / 0.16);
  --accent-foreground: #ffffff;
}
/* brand: the white Nainuwa logo + "Research" instead of the "DeerFlow" heading */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl h1 {
  font-size: 0;
  line-height: 0;
  color: transparent;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl h1::before {
  content: "";
  display: block;
  width: 220px;
  height: 27px;
  margin: 0 auto;
  background: url("img/nainuwa-logo-white.svg") center / contain no-repeat;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl h1::after {
  content: "Research";
  display: block;
  margin-top: 14px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.4;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
/* inputs, checkbox text and buttons readable on the glass */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl input:not([type="checkbox"]) {
  background: rgb(255 255 255 / 0.12);
  color: #ffffff;
}
/* "Keep me signed in" (?local=1): the card is dark glass in BOTH schemes, so the light scheme's near-black native box
   had almost no contrast (carry 12). Drawn here instead: white border (>= 3:1 on the glass, 7.9:1 measured against
   the card), white fill with a dark check when checked, the focus ring of the other controls. */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  border: 1.5px solid rgb(255 255 255 / 0.9);
  border-radius: 4px;
  background: transparent center / 12px 12px no-repeat;
  cursor: pointer;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl input[type="checkbox"]:checked {
  border-color: #ffffff;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%230b1a40' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl input[type="checkbox"]:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl input::placeholder {
  color: rgb(255 255 255 / 0.6);
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl button[data-slot="button"] {
  height: 44px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
}
/* "Continue with Nextcloud" is the primary action: solid white like NC's primary buttons on the photo */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl > .space-y-2 > button[data-variant="outline"] {
  border-color: #ffffff;
  background: #ffffff;
  color: #0b1a40;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl > .space-y-2 > button[data-variant="outline"]:hover {
  background: #e6ecf7;
  color: #0b1a40;
}
/* with the local form visible (?local=1) the password "Sign In" is secondary: outlined white */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl form button[type="submit"] {
  border: 1px solid rgb(255 255 255 / 0.7);
  background: transparent;
  color: #ffffff;
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl form button[type="submit"]:hover {
  background: rgb(255 255 255 / 0.14);
}
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl .text-red-500 {
  color: #ffb4b4;
}
/* "← Back to home" (the root only redirects back here) */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl > .text-xs:last-child:has(> a[href="/"]) {
  display: none;
}

/* SSO-first. Only on the login card and only once DeerFlow has rendered an SSO button (if the provider list fails
   to load, the local form stays visible). nginx adds <meta id="rw-login-local"> to the page for /login?local=1,
   which keeps the local form for the admin. The form's error line (e.g. ?error=sso_failed) stays visible. */
html:not(:has(#rw-login-local)) .min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl:has(> .space-y-2 > button[data-variant="outline"]) > form:not(:has(> .text-red-500)),
html:not(:has(#rw-login-local)) .min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl:has(> .space-y-2 > button[data-variant="outline"]) > form > :not(.text-red-500),
html:not(:has(#rw-login-local)) .min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl:has(> .space-y-2 > button[data-variant="outline"]) > .space-y-2 > .relative.my-4,
html:not(:has(#rw-login-local)) .min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl:has(> .space-y-2 > button[data-variant="outline"]) > .text-center.text-sm:has(> button) {
  display: none;
}

/* ── Workspace sidebar: Nainuwa logo + "Research" instead of the "DeerFlow" / "DF" wordmark ───────────────── */
.group\/workspace-header .text-primary.ml-2.font-serif {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0;
  line-height: 0;
  color: transparent;
}
.group\/workspace-header .text-primary.ml-2.font-serif::before {
  content: "";
  display: block;
  width: 112px;
  height: 14px;
  background: url("img/nainuwa-logo.svg") left center / contain no-repeat;
}
.dark .group\/workspace-header .text-primary.ml-2.font-serif::before {
  background-image: url("img/nainuwa-logo-white.svg");
}
.group\/workspace-header .text-primary.ml-2.font-serif::after {
  content: "Research";
  color: var(--sidebar-foreground);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
/* collapsed rail: the Nainuwa icon instead of "DF" */
.group\/workspace-header .text-primary.pt-1.font-serif {
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 0;
  color: transparent;
  background: url("img/icon.png") center / contain no-repeat;
}
/* local form divider: the card is translucent, so the label cannot mask the rule behind it; keep the label only */
.min-h-screen:has(> [class*="deer.svg"]) > .rounded-3xl .relative.my-4 .border-t {
  border-top-color: transparent;
}

/* Memory is off (config.yaml memory.enabled: false; nginx answers /api/memory with 404): hide the Memory tab of the
   settings dialog. Keyed on the tab's lucide icon class (lucide-brain, generated from the icon name, not a hashed
   class) inside the dialog's nav list; at fc0d4bd no other settings tab uses that icon (settings-dialog.tsx). */
[role="dialog"] nav > ul > li:has(> button > svg.lucide-brain) {
  display: none;
}
