/* HomeCloud console theme — dark chrome + dark sidebar + light content (AWS console layout) */
[data-md-color-scheme="console"] {
  color-scheme: light;

  --hc-chrome: #1c2533;
  --hc-chrome-fg: #f1f5f9;
  --hc-chrome-muted: #94a3b8;
  --hc-chrome-border: rgba(255, 255, 255, 0.12);
  --hc-chrome-input: #243044;

  --hc-sidebar: #2f3f54;
  --hc-sidebar-fg: #e8edf4;
  --hc-sidebar-muted: #a8b6c8;
  --hc-sidebar-active: #3d5168;
  --hc-sidebar-border: rgba(255, 255, 255, 0.1);

  --hc-bg: #f4f7f9;
  --hc-content-fg: #1f2937;
  --hc-content-muted: #64748b;

  /* Height of the sticky chrome (account bar + section tabs) */
  --hc-chrome-h: 5.4rem;
  --hc-primary: #e87722;
  --hc-primary-hover: #f08a38;
  --hc-code-bg: #eef2f6;
  --hc-scrollbar: rgba(30, 41, 59, 0.22);

  --md-default-bg-color: var(--hc-bg);
  --md-default-fg-color: var(--hc-content-fg);
  --md-default-fg-color--light: var(--hc-content-muted);
  --md-default-fg-color--lighter: #94a3b8;
  --md-default-fg-color--lightest: #cbd5e1;

  --md-primary-fg-color: var(--hc-primary);
  --md-primary-fg-color--light: var(--hc-primary-hover);
  --md-primary-fg-color--dark: #c96518;
  --md-primary-bg-color: var(--hc-primary);

  --md-accent-fg-color: var(--hc-primary);
  --md-accent-fg-color--transparent: rgba(232, 119, 34, 0.12);
  --md-accent-bg-color: var(--hc-primary);

  --md-code-bg-color: var(--hc-code-bg);
  --md-code-fg-color: #1e293b;

  --md-footer-bg-color: var(--hc-chrome);
  --md-footer-fg-color: var(--hc-chrome-muted);

  --md-typeset-a-color: var(--hc-primary);

  --md-shadow-z1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --md-shadow-z2: 0 4px 12px rgba(15, 23, 42, 0.08);
}

:root {
  --md-text-font: "Geist", system-ui, -apple-system, sans-serif;
  --md-code-font: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[lang="he"] {
  --md-text-font: "Noto Sans Hebrew", "Geist", system-ui, sans-serif;
}

body,
.md-typeset {
  font-family: var(--md-text-font);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--hc-scrollbar) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background-color: var(--hc-scrollbar);
  border: 2px solid transparent;
  border-radius: 9999px;
  background-clip: padding-box;
}

/* Hide Material fullscreen search — we use inline console search */
.md-search,
.md-header label[for="__search"],
.md-header__button[for="__search"],
.md-header__option[data-md-component="palette"],
.md-header__option .md-select {
  display: none !important;
}

/* Chrome stack: account bar + section tabs */
.hc-chrome-stack {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--hc-chrome);
  border-bottom: 1px solid var(--hc-chrome-border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.hc-chrome-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.4rem 0.75rem;
  color: var(--hc-chrome-fg);
  font-size: 0.75rem;
  line-height: 1;
}

@media screen and (min-width: 76.25em) {
  .hc-chrome-bar {
    padding: 0.4rem 1rem;
    gap: 0.75rem;
  }
}

.hc-chrome-brand {
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--hc-chrome-fg);
}

.hc-chrome-sep,
.hc-chrome-muted {
  color: var(--hc-chrome-muted);
}

.hc-chrome-muted {
  display: none;
}

@media screen and (min-width: 48em) {
  .hc-chrome-muted {
    display: inline;
  }
}

.hc-chrome-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 42rem;
  margin-inline: 0.25rem;
}

@media screen and (min-width: 60em) {
  .hc-chrome-search-wrap {
    margin-inline: auto;
  }
}

.hc-chrome-search {
  width: 100%;
  height: 2rem;
  padding: 0 0.65rem 0 2rem;
  border: 1px solid var(--hc-chrome-border);
  border-radius: 0.375rem;
  background: var(--hc-chrome-input);
  color: var(--hc-chrome-fg);
  font: inherit;
  font-size: 0.8rem;
  outline: none;
}

.hc-chrome-search::placeholder {
  color: var(--hc-chrome-muted);
}

.hc-chrome-search:focus {
  border-color: var(--hc-primary);
  box-shadow: 0 0 0 2px rgba(232, 119, 34, 0.25);
}

.hc-chrome-search-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 0.65rem;
  transform: translateY(-50%);
  width: 0.9rem;
  height: 0.9rem;
  color: var(--hc-chrome-muted);
  pointer-events: none;
}

.hc-chrome-search-kbd {
  position: absolute;
  top: 50%;
  inset-inline-end: 0.45rem;
  transform: translateY(-50%);
  display: none;
  gap: 0.15rem;
  color: var(--hc-chrome-muted);
  font-size: 0.62rem;
}

@media screen and (min-width: 60em) {
  .hc-chrome-search-kbd {
    display: inline-flex;
  }

  .hc-chrome-search {
    padding-inline-end: 3.5rem;
  }
}

.hc-chrome-search-kbd kbd {
  font-family: var(--md-code-font);
  padding: 0.08rem 0.28rem;
  border-radius: 0.2rem;
  border: 1px solid var(--hc-chrome-border);
  background: rgba(255, 255, 255, 0.06);
}

.hc-search-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  inset-inline: 0;
  z-index: 20;
  max-height: 18rem;
  overflow: auto;
  border: 1px solid var(--hc-chrome-border);
  border-radius: 0.375rem;
  background: #fff;
  color: var(--hc-content-fg);
  box-shadow: var(--md-shadow-z2);
}

.hc-search-dropdown[hidden] {
  display: none;
}

.hc-search-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.hc-search-item:hover,
.hc-search-item.is-active {
  background: rgba(232, 119, 34, 0.1);
}

.hc-search-item-title {
  display: block;
  font-weight: 500;
}

.hc-search-item-path {
  display: block;
  margin-top: 0.1rem;
  color: var(--hc-content-muted);
  font-size: 0.68rem;
  direction: ltr;
  text-align: start;
}

.hc-search-empty {
  padding: 0.75rem;
  color: var(--hc-content-muted);
  font-size: 0.8rem;
}

.hc-chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
  flex-shrink: 0;
}

.hc-lang-switch {
  display: inline-flex;
  border: 1px solid var(--hc-chrome-border);
  border-radius: 0.375rem;
  overflow: hidden;
}

.hc-lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--hc-chrome-muted);
  font: inherit;
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}

.hc-lang-btn:hover {
  color: var(--hc-chrome-fg);
  background: rgba(255, 255, 255, 0.06);
}

.hc-lang-btn.is-active {
  color: #fff;
  background: var(--hc-primary);
}

.hc-github-link {
  display: none;
  align-items: center;
  gap: 0.35rem;
  color: var(--hc-chrome-muted);
  font-size: 0.7rem;
  text-decoration: none;
  white-space: nowrap;
}

.hc-github-link:hover {
  color: var(--hc-chrome-fg);
}

@media screen and (min-width: 60em) {
  .hc-github-link {
    display: inline-flex;
  }
}

/* Section tabs — second chrome row */
.hc-chrome-stack .md-tabs {
  background: var(--hc-chrome);
  color: var(--hc-chrome-muted);
  border-top: 1px solid var(--hc-chrome-border);
  border-bottom: 0;
}

.hc-chrome-stack .md-tabs__link {
  opacity: 0.8;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--hc-chrome-muted);
}

.hc-chrome-stack .md-tabs__link:hover {
  color: var(--hc-chrome-fg);
  opacity: 1;
}

.hc-chrome-stack .md-tabs__item--active .md-tabs__link {
  color: var(--hc-primary);
  opacity: 1;
}

/* Material header — mobile only */
@media screen and (min-width: 76.25em) {
  .md-header {
    display: none;
  }
}

@media screen and (max-width: 76.24em) {
  .md-header {
    background: var(--hc-chrome);
    color: var(--hc-chrome-fg);
    box-shadow: none;
    border-bottom: 1px solid var(--hc-chrome-border);
  }

  .md-header__button {
    color: var(--hc-chrome-fg);
  }

  .md-header__title {
    font-size: 0;
  }
}

/* Sidebar — dark like console */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    background: var(--hc-sidebar);
    border-inline-end: 1px solid var(--hc-sidebar-border);
  }

  .md-sidebar--primary .md-sidebar__scrollwrap {
    background: var(--hc-sidebar);
  }
}

.md-sidebar--primary .md-nav__title {
  position: static !important;
  top: auto !important;
  background: var(--hc-sidebar);
  color: var(--hc-sidebar-muted);
  font-weight: 600;
  box-shadow: none !important;
}

/* Section headers (e.g. "GETTING STARTED") — labels in normal flow, not floating overlays */
.md-sidebar--primary .md-nav__item--section > .md-nav__link {
  color: var(--hc-sidebar-muted);
  font-weight: 600;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

/*
  Material sticks the active section label (lifted nav) and paints a box-shadow "halo"
  that covers the page items underneath while scrolling. Kill that sticky overlay so
  "GETTING STARTED" stays a normal label above Overview / Accounts / Access Keys.
*/
.md-sidebar--primary
  .md-nav--lifted
  > .md-nav__list
  > .md-nav__item--active
  > .md-nav__link {
  position: static !important;
  top: auto !important;
  z-index: auto;
  margin-top: 0;
  background: transparent;
  box-shadow: none !important;
  color: var(--hc-sidebar-muted);
}

.md-nav__link {
  color: var(--hc-sidebar-muted);
}

.md-nav__link:hover {
  color: var(--hc-sidebar-fg);
}

.md-nav__link--active {
  color: var(--hc-sidebar-fg);
  background: var(--hc-sidebar-active);
  font-weight: 600;
  border-radius: 0.375rem;
}

.md-nav__icon {
  color: var(--hc-sidebar-muted);
}

/* TOC sidebar */
@media screen and (min-width: 76.25em) {
  .md-sidebar--secondary {
    background: var(--hc-bg);
  }
}

/* TOC title — normal flow label (Material sticky + halo caused "Table of contents"
   to float over TOC links). */
.md-sidebar--secondary .md-nav__title {
  position: static !important;
  top: auto !important;
  z-index: auto;
  background: transparent;
  color: var(--hc-content-muted);
  font-weight: 600;
  box-shadow: none !important;
}

.md-sidebar--secondary .md-nav__link {
  color: var(--hc-content-muted);
}

.md-sidebar--secondary .md-nav__link--active {
  color: var(--hc-primary);
  background: transparent;
}

/* Main content — light workspace */
.md-main {
  background: var(--hc-bg);
}

/*
  Sidebars are pinned by JS (`.md-sidebar__scrollwrap` → position:fixed) so they
  never "unstick" at the end of `.md-main__inner` the way sticky does.

  Material's `html { overflow-x: hidden }` also creates a scrollport that breaks
  sticky; keep clip for horizontal overflow without that side effect.
*/
html {
  overflow-x: clip;
}

@media screen and (min-width: 60em) {
  .md-main__inner {
    height: auto !important;
    min-height: calc(100dvh - var(--hc-chrome-h));
    align-items: flex-start;
  }

  /* Layout spacer only — the scrollwrap is fixed by pinSidebars(). */
  .md-sidebar--secondary {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    align-self: stretch !important;
    padding-top: 0;
    overflow: visible;
  }

  .md-sidebar--secondary .md-sidebar__scrollwrap {
    margin: 0;
    padding-top: 0.9rem;
    box-sizing: border-box;
    background: var(--hc-bg);
  }
}

@media screen and (min-width: 76.25em) {
  .md-main__inner {
    position: relative;
    margin-top: 0;
  }

  .md-sidebar {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    align-self: stretch !important;
    padding-top: 0;
    overflow: visible;
  }

  .md-sidebar__scrollwrap {
    /* Metrics captured once; JS sets position:fixed — do not reset to static here. */
    margin: 0;
    padding-top: 0.9rem;
    box-sizing: border-box;
  }

  /* Continuous dark rail behind the primary sidebar (logical inset for RTL). */
  .md-main__inner::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 12.1rem;
    background: var(--hc-sidebar);
    border-inline-end: 1px solid var(--hc-sidebar-border);
    z-index: 0;
  }

  .md-sidebar--primary {
    z-index: 1;
    background: transparent;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap {
    background: var(--hc-sidebar);
  }
}

.md-content__inner {
  padding-block: 1.5rem 1rem;
  margin-bottom: 0;
}

.md-typeset h1 {
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--hc-content-fg);
}

.md-typeset h2 {
  font-weight: 600;
  color: var(--hc-content-fg);
  border-bottom: 1px solid #dbe3ea;
  padding-bottom: 0.25rem;
}

.md-typeset table:not([class]) th {
  background: #e8edf2;
  color: var(--hc-content-fg);
}

.md-typeset table:not([class]) tr:hover {
  background: rgba(232, 119, 34, 0.05);
}

.md-typeset .admonition,
.md-typeset details {
  border-color: #dbe3ea;
  box-shadow: none;
}

.md-clipboard.md-icon:hover {
  color: var(--hc-primary);
}

/* RTL */
html[dir="rtl"] .md-nav__icon {
  transform: scaleX(-1);
}

html[dir="rtl"] .md-typeset blockquote {
  border-inline-start: 0;
  border-inline-end: 0.2rem solid var(--hc-primary);
  padding-inline-start: 0;
  padding-inline-end: 0.8rem;
}

html[dir="rtl"] .md-typeset ul,
html[dir="rtl"] .md-typeset ol {
  padding-inline-start: 0;
  padding-inline-end: 1.25em;
}

/* Technical content always LTR */
.md-typeset pre,
.md-typeset code,
.md-typeset .highlight,
.md-typeset .highlighttable,
.md-typeset .linenos,
.md-typeset kbd,
.md-typeset samp,
.md-typeset var,
.md-typeset .arithmatex,
.hc-ltr {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
}

.md-typeset pre code,
.md-typeset pre {
  font-family: var(--md-code-font);
}

.md-typeset table:not([class]) td:has(code),
.md-typeset table:not([class]) th:has(code) {
  direction: ltr;
  text-align: left;
}

html[dir="rtl"] .md-typeset table:not([class]) {
  direction: rtl;
}

html[dir="rtl"] .md-typeset table:not([class]) td,
html[dir="rtl"] .md-typeset table:not([class]) th {
  text-align: start;
}

html[dir="rtl"] .md-typeset table:not([class]) td:has(code),
html[dir="rtl"] .md-typeset table:not([class]) th:has(code),
html[dir="rtl"] .md-typeset table:not([class]) td.hc-ltr,
html[dir="rtl"] .md-typeset table:not([class]) th.hc-ltr {
  direction: ltr !important;
  text-align: left !important;
}

.md-typeset .tabbed-set {
  direction: ltr;
}

html[dir="rtl"] .md-typeset .tabbed-set label {
  direction: rtl;
  text-align: right;
}

/* Footer */
.md-footer {
  background: var(--hc-chrome);
  color: var(--hc-chrome-muted);
  border-top: 1px solid var(--hc-chrome-border);
}

.md-footer-meta {
  background: var(--hc-chrome);
}

.md-footer__link {
  color: var(--hc-chrome-muted);
}

.md-footer__link:hover {
  color: var(--hc-chrome-fg);
}

.md-source {
  display: none;
}

.md-progress {
  background-color: var(--hc-primary);
  height: 2px;
}
