/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --brand:        #009fe3;
  --brand-deep:   #0079ad;
  --navy:         #001e31;

  --bg:           #f6f8fa;
  --surface:      #ffffff;
  --surface-2:    #f0f4f8;
  --border:       #dbe3ec;
  --border-soft:  #e8eef4;
  --text:         #16232e;
  --text-dim:     #5b6c7d;
  --text-faint:   #8695a4;
  --accent-wash:  #e3f4fa;
  --code-bg:      #f2f6f9;
  --shadow:       0 1px 2px rgba(0,30,49,.06), 0 8px 24px rgba(0,30,49,.06);
  --shadow-lg:    0 2px 4px rgba(0,30,49,.08), 0 24px 56px rgba(0,30,49,.14);

  --sidebar-w:    262px;
  --topbar-h:     58px;
  --radius:       10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg:           #0b141c;
  --surface:      #101b25;
  --surface-2:    #16232e;
  --border:       #223343;
  --border-soft:  #1a2836;
  --text:         #e4ecf3;
  --text-dim:     #9fb1c1;
  --text-faint:   #6d8093;
  --accent-wash:  #0c2b3a;
  --code-bg:      #0d1922;
  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg:    0 2px 4px rgba(0,0,0,.5), 0 24px 56px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* Daikin logo, masked so it inherits currentColor */
.logo-mask {
  display: inline-block;
  background: currentColor;
  -webkit-mask: url("daikin-logo.svg") no-repeat center / contain;
  mask: url("daikin-logo.svg") no-repeat center / contain;
}

/* ── Login gate ──────────────────────────────────────────────────── */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 32px 20px;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(0,159,227,.30), transparent 70%),
    linear-gradient(168deg, var(--navy) 0%, #003552 52%, #00253c 100%);
}

.gate__card {
  width: 100%;
  max-width: 396px;
  padding: 38px 36px 32px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: rise .45s cubic-bezier(.2,.7,.3,1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.gate__logo {
  display: block;
  width: 138px;
  height: 30px;
  margin-bottom: 26px;
  color: var(--navy);
  background: currentColor;
  -webkit-mask: url("daikin-logo.svg") no-repeat left center / contain;
  mask: url("daikin-logo.svg") no-repeat left center / contain;
}
:root[data-theme="dark"] .gate__logo { color: var(--text); }

.gate__title {
  margin: 0 0 4px;
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.gate__sub {
  margin: 0 0 26px;
  color: var(--text-dim);
  font-size: 14px;
}

.field { display: block; margin-bottom: 15px; }

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .01em;
}

.field input {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .16s, box-shadow .16s, background .16s;
}

.field input::placeholder { color: var(--text-faint); }

.field input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,159,227,.18);
}

.gate__error {
  margin: 0 0 14px;
  padding: 9px 12px;
  font-size: 13.5px;
  color: #b4232b;
  background: #fdeced;
  border: 1px solid #f7ccce;
  border-radius: 8px;
}
:root[data-theme="dark"] .gate__error {
  color: #ff9ba1; background: #33161a; border-color: #55232a;
}

.gate__request {
  margin: 16px 0 0;
  font-size: 12.5px;
  text-align: center;
  color: var(--text-dim);
}
.gate__request a {
  color: var(--brand-deep);
  text-decoration-color: rgba(0,159,227,.4);
  text-underline-offset: 2px;
}
.gate__request a:hover { color: var(--brand); }
:root[data-theme="dark"] .gate__request a { color: #55c8f5; }

.gate__foot {
  margin: 0;
  font-size: 12.5px;
  color: rgba(255,255,255,.62);
  letter-spacing: .02em;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  position: relative;
  width: 100%;
  padding: 11px 18px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background .16s, transform .06s;
}
.btn:hover:not(:disabled) { background: var(--brand-deep); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .72; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.btn--ghost {
  width: auto;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn__spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin .6s linear infinite;
}
.btn.is-busy .btn__label { visibility: hidden; }
.btn.is-busy .btn__spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.topbar__logo {
  width: 92px; height: 20px;
  color: var(--navy);
  background: currentColor;
  -webkit-mask: url("daikin-logo.svg") no-repeat left center / contain;
  mask: url("daikin-logo.svg") no-repeat left center / contain;
}
:root[data-theme="dark"] .topbar__logo { color: var(--text); }

.topbar__divider { width: 1px; height: 20px; background: var(--border); }

.topbar__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.topbar__spacer { flex: 1; }

#nav-toggle { display: none; }

/* ── Layout ──────────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 12px 40px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.nav__group {
  margin: 0 10px 8px;
  padding-top: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.nav__group:first-child { padding-top: 0; }

.nav a {
  display: block;
  padding: 7px 11px;
  margin-bottom: 1px;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 7px;
  border-left: 2px solid transparent;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.is-active {
  color: var(--brand-deep);
  background: var(--accent-wash);
  border-left-color: var(--brand);
  font-weight: 600;
}
:root[data-theme="dark"] .nav a.is-active { color: #6fd0f7; }

.scrim { display: none; }

.main { min-width: 0; }

.doc {
  max-width: none;
  margin: 0;
  padding: 40px 36px 12px;
  animation: fade .25s ease both;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.doc__foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 32px 56px;
  font-size: 12.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
}

/* ── Markdown typography ─────────────────────────────────────────── */
.doc h1, .doc h2, .doc h3, .doc h4 {
  line-height: 1.28;
  letter-spacing: -.02em;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.doc h1 { margin: 0 0 22px; font-size: 32px; font-weight: 680; }
.doc h2 {
  margin: 44px 0 14px;
  padding-bottom: 8px;
  font-size: 21px;
  font-weight: 640;
  border-bottom: 1px solid var(--border-soft);
}
.doc h3 { margin: 30px 0 10px; font-size: 16.5px; font-weight: 640; }
.doc h4 { margin: 24px 0 8px; font-size: 15px; font-weight: 640; color: var(--text-dim); }

.doc p { margin: 0 0 16px; }
.doc a { color: var(--brand-deep); text-decoration-color: rgba(0,159,227,.4); text-underline-offset: 2px; }
.doc a:hover { color: var(--brand); }
:root[data-theme="dark"] .doc a { color: #55c8f5; }

.doc ul, .doc ol { margin: 0 0 16px; padding-left: 24px; }
.doc li { margin-bottom: 6px; }
.doc li > ul, .doc li > ol { margin-top: 6px; }

.doc strong { font-weight: 640; color: var(--text); }
.doc hr { margin: 34px 0; border: 0; border-top: 1px solid var(--border); }

.doc blockquote {
  margin: 0 0 18px;
  padding: 12px 18px;
  color: var(--text-dim);
  background: var(--accent-wash);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
}
.doc blockquote p:last-child { margin-bottom: 0; }

.doc code {
  padding: .16em .42em;
  font-family: var(--mono);
  font-size: .875em;
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
}

.doc pre {
  margin: 0 0 18px;
  padding: 15px 17px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  line-height: 1.55;
}
.doc pre code {
  padding: 0;
  font-size: 13px;
  background: none;
  border: 0;
}

.doc table {
  width: 100%;
  margin: 0 0 20px;
  border-collapse: collapse;
  font-size: 14px;
}
.doc thead th {
  text-align: left;
  font-weight: 650;
  font-size: 12.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface-2);
}
.doc th, .doc td {
  padding: 9px 13px;
  border: 1px solid var(--border);
}
.doc tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }

.doc img { max-width: 100%; border-radius: var(--radius); }

.doc figure.zoom {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
}
.doc figure.zoom img {
  display: block;
  width: 100%;
  border-radius: 0;
  cursor: zoom-in;
}
.doc figure.zoom.is-zoomed img {
  width: auto;
  max-width: none;
  cursor: zoom-out;
}
.doc figure.zoom figcaption {
  position: sticky;
  left: 0;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}

/* ── Search ──────────────────────────────────────────────────────── */
.topbar__spacer { display: flex; justify-content: center; }

.search {
  position: relative;
  width: 100%;
  max-width: 460px;
}
.search__icon {
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search__input {
  width: 100%;
  padding: 8px 34px 8px 34px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search__input::placeholder { color: var(--text-faint); }
.search__input:focus {
  background: var(--surface);
  border-color: var(--brand);
}
.search__input::-webkit-search-cancel-button { display: none; }

.search__hint {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  pointer-events: none;
}
.search__input:focus ~ .search__hint { display: none; }

.search__results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.search__hit {
  display: block;
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
.search__hit:hover,
.search__hit.is-cursor { background: var(--accent-wash); }

.search__line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.search__where {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search__kind:not(:empty) {
  flex: 0 0 auto;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
}
.search__snippet {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
.search__snippet mark {
  padding: 0 1px;
  color: var(--text);
  background: color-mix(in srgb, var(--brand) 26%, transparent);
  border-radius: 2px;
}
.search__empty {
  margin: 0;
  padding: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

@media (max-width: 860px) {
  .search { max-width: none; }
  .search__hint { display: none; }
}

/* Redoc renders its own left menu and reserves a gutter for it. The site
   already has a sidebar, so the menu is hidden and the gutter reclaimed. */
.spec__render { margin: 28px 0 0; }
.spec__render .menu-content { display: none !important; }
.spec__render .api-content { margin-left: 0 !important; }
.spec__render .redoc-wrap { display: block; }
.spec__error {
  padding: 14px 16px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── API spec panel ──────────────────────────────────────────────── */
.spec {
  margin: 0 0 26px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.spec__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.spec__meta code {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.spec__meta span { font-size: 12.5px; color: var(--text-dim); }

.spec__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.spec__btn {
  padding: 8px 15px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.spec__btn:hover { border-color: var(--brand); }
.spec__btn--primary {
  color: #fff;
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}
.spec__btn--primary:hover { background: var(--brand); border-color: var(--brand); }

.spec__source { margin-top: 14px; }
.spec__source summary {
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.spec__source summary:hover { color: var(--brand-deep); }
.spec__source pre {
  max-height: 460px;
  margin: 12px 0 0;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.55;
}

.table-wrap { overflow-x: auto; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  #nav-toggle { display: inline-grid; }
  .topbar__title { display: none; }
  .topbar__divider { display: none; }

  .shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 25;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2,.7,.3,1);
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }

  .scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 20;
    background: rgba(0,30,49,.42);
  }

  .doc { padding: 30px 18px 12px; }
  .doc__foot { padding: 24px 20px 48px; }
  .doc h1 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
