/*
 * PLAN 9
 * Rio/Acme-inspired research workstation.
 *
 * The original Pellucida and Lucida files are deliberately not bundled.
 * IBM Plex Sans/Mono preserve the compact humanist/monospace relationship
 * using the project's existing redistributable webfonts.
 */

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

  --font-ui: "IBM Plex Sans", Arial, sans-serif;
  --font-copy: "IBM Plex Sans", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --font-terminal: "IBM Plex Mono", monospace;
  --font-display: "IBM Plex Sans", Arial, sans-serif;

  --weight-normal: 400;
  --weight-medium: 400;
  --weight-strong: 500;
  /* Optical scale: designed to feel like the former 110% browser view. */
  --text-xxs: 10px;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --line-tight: 1.05;
  --line-ui: 1.15;
  --line-copy: 1.48;
  --tracking-ui: 0;
  --tracking-label: 0;
  --tracking-display: 0;

  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 10px;
  --space-6: 12px;
  --space-7: 16px;
  --space-8: 20px;
  --radius-window: 0;
  --radius-control: 0;
  --border-width: 1px;
  --titlebar-height: 25px;
  --titlebar-button-size: 17px;
  --menubar-height: 31px;
  --front-panel-height: 68px;
  --statusbar-height: 22px;
  --dockapp-size: 97px;
  --window-gap: 13px;
  --dockapp-gap: 9px;
  --scrollbar-size: 13px;
  --meter-height: 4px;

  --desktop-bg: #777777;
  --desktop-bg-alt: #686868;
  --surface-window: #ffffe8;
  --surface-window-alt: #ffffe8;
  --surface-raised: #e8e8d0;
  --surface-sunken: #d9d9c2;
  --surface-input: #ffffe8;
  --surface-menubar: #e8e8d0;
  --surface-titlebar: #9eb6c3;
  --surface-titlebar-inactive: #d5d5bd;
  --surface-statusbar: #e8e8d0;
  --surface-dockapp: #e8e8d0;
  --surface-terminal: #ffffe8;
  --surface-selection: #9eb6c3;

  --text-primary: #111111;
  --text-secondary: #292929;
  --text-muted: #555555;
  --text-disabled: #777777;
  --text-titlebar: #101010;
  --text-titlebar-inactive: #555555;
  --text-menubar: #111111;
  --text-statusbar: #111111;
  --text-terminal: #111111;
  --text-terminal-dim: #555555;

  --accent-primary: #4d7184;
  --accent-secondary: #111111;
  --accent-tertiary: #8d6e3a;
  --accent-warning: #8d6e3a;
  --accent-danger: #8b3030;
  --accent-ok: #526d42;
  --link: #264f66;
  --link-hover: #000000;
  --selection-bg: #9eb6c3;
  --selection-fg: #000000;
  --focus-color: #000000;

  --border-outer: #111111;
  --border-inner: #777777;
  --border-muted: #a7a78f;
  --bevel-highlight: transparent;
  --bevel-light: transparent;
  --bevel-dark: transparent;
  --bevel-shadow: transparent;
  --separator: #777777;
  --window-outline: #111111;
  --titlebar-rule: 1px solid #111111;
  --shadow-window: 2px 2px 0 #222222;
  --shadow-raised: none;
  --shadow-sunken: inset 0 0 0 1px #777777;
  --shadow-focus: inset 0 0 0 1px #000000;
  --glow-text: none;
  --glow-accent: none;
  --glow-terminal: none;

  --meter-track: #c5c5ac;
  --meter-fill: #4d7184;
  --meter-fill-alt: #526d42;
  --meter-fill-warn: #8d6e3a;
  --graph-grid: #b2b29c;
  --graph-line: #3e687d;
  --graph-line-alt: #526d42;
  --graph-baseline: #777777;
  --led-off: #aaa993;
  --led-on: #526d42;
  --led-warn: #8d6e3a;
  --dock-label: #444444;
  --dock-value: #111111;

  --terminal-prompt: #264f66;
  --terminal-user: #264f66;
  --terminal-path: #526d42;
  --terminal-command: #111111;
  --terminal-cursor: #111111;
  --terminal-error: #8b3030;
  --terminal-warning: #8d6e3a;
  --workspace-active-bg: #9eb6c3;
  --workspace-active-fg: #000000;
  --workspace-inactive-bg: #e8e8d0;
  --workspace-inactive-fg: #111111;
  --workspace-border: #111111;

  --scanline-opacity: 0;
  --scanline-size: 0;
  --noise-opacity: 0;
  --vignette-opacity: 0;
  --phosphor-blur: 0;
  --image-filter: grayscale(.35) contrast(.95) saturate(.72);
  --icon-opacity: 1;
  --avatar-bg: #ffffe8;
  --avatar-filter: grayscale(1) contrast(1.15);
  --avatar-opacity: 1;
}

[data-theme="plan9"] body {
  background-color: var(--desktop-bg);
  background-image:
    linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(0 0 0 / 3%) 1px, transparent 1px);
  background-size: 4px 4px;
}

[data-theme="plan9"] .menubar {
  border: 0;
  border-bottom: 1px solid #111;
  box-shadow: none;
}

[data-theme="plan9"] .menubar__brand {
  font-family: var(--font-mono);
  font-weight: 500;
}

[data-theme="plan9"] .menubar__avatar {
  display: none;
}

[data-theme="plan9"] .menubar__plan9 {
  display: block;
  width: 22px;
  height: 19px;
  margin-left: 2px;
  overflow: hidden;
}

[data-theme="plan9"] .menubar__plan9 img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

[data-theme="plan9"] .menubar__nav a:hover,
[data-theme="plan9"] .front-panel__launchers a:hover {
  outline: 1px solid #111;
  outline-offset: -1px;
}

[data-theme="plan9"] .menubar__theme select,
[data-theme="plan9"] .menubar__language button,
[data-theme="plan9"] .menubar__menu summary,
[data-theme="plan9"] .front-panel__restore,
[data-theme="plan9"] .ws {
  box-shadow: none;
}

[data-theme="plan9"] .menubar__menu-panel {
  box-shadow: 2px 2px 0 #222;
}

[data-theme="plan9"] .window {
  box-shadow: var(--shadow-window);
}

[data-theme="plan9"] .window__titlebar {
  font-family: var(--font-mono);
}

[data-theme="plan9"] .window__titlebar::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 1px solid #111;
  background: #ffffe8;
}

[data-theme="plan9"] .window__controls i {
  width: 7px;
  height: 7px;
  border: 0;
  background: #111;
  box-shadow: none;
}

[data-theme="plan9"] .window__hide {
  border: 0;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-mono);
}

[data-theme="plan9"] .window__hide:hover {
  outline: 1px solid #111;
}

[data-theme="plan9"] .terminal,
[data-theme="plan9"] .notes-editor,
[data-theme="plan9"] .filemanager {
  background: #ffffe8;
}

[data-theme="plan9"] .notes-editor__head,
[data-theme="plan9"] .filemanager__path,
[data-theme="plan9"] .terminal__input-row {
  background: #e8e8d0;
  box-shadow: none;
}

[data-theme="plan9"] .notes-editor__doc {
  font-family: var(--font-ui);
}

[data-theme="plan9"] .dockapp,
[data-theme="plan9"] .front-panel {
  box-shadow: none;
}

[data-theme="plan9"] .front-panel {
  border: 0;
  border-top: 1px solid #111;
}

[data-theme="plan9"] ::selection {
  background: #9eb6c3;
  color: #000;
}

/* Plan 9-only: audio.device is a dry, Acme-like panel. */
[data-theme="plan9"] .audio-device__panel,
[data-theme="plan9"] .audio-device__xterm,
[data-theme="plan9"] .audio-device__intercept {
  display: none;
}
[data-theme="plan9"] .audio-device__plan9 {
  display: flex;
}
[data-theme="plan9"] .w-audio .window__title {
  font-size: 0;
}
[data-theme="plan9"] .w-audio .window__title::before {
  content: "audio";
  font-size: var(--text-sm);
}
