/**
 * Ottoni Platform Architecture 2.0
 * A persistent software shell: compact, human, contextual and mobile-first.
 */

:root {
  --ottoni-os-rail: 224px;
  --ottoni-os-top: 72px;
  --ottoni-os-method: 52px;
  --ottoni-os-ink: #28352c;
  --ottoni-os-muted: #667269;
  --ottoni-os-surface: #fbfaf7;
  --ottoni-os-canvas: #f2f4ef;
  --ottoni-os-line: rgba(42, 57, 47, .12);
  --ottoni-os-sage: #aebdad;
  --ottoni-os-deep: #304c39;
  --ottoni-os-clay: #b8745e;
  --ottoni-os-blush: #efe0d9;
  --ottoni-os-shadow: 0 18px 55px rgba(43, 53, 45, .10);
}

body.ottoni-platform-private {
  background:
    radial-gradient(circle at 84% 8%, rgba(174,189,173,.18), transparent 32rem),
    linear-gradient(145deg, #f7f5f0 0%, var(--ottoni-os-canvas) 72%);
  color: var(--ottoni-os-ink);
}

body.ottoni-platform-private::before {
  content: "";
  position: fixed;
  z-index: 0;
  right: -5rem;
  bottom: -10rem;
  width: 38rem;
  height: 48rem;
  opacity: .055;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 75%, transparent 0 24%, var(--ottoni-os-deep) 25% 27%, transparent 28%),
    radial-gradient(ellipse at 37% 58%, transparent 0 17%, var(--ottoni-os-deep) 18% 20%, transparent 21%),
    radial-gradient(ellipse at 63% 43%, transparent 0 19%, var(--ottoni-os-deep) 20% 22%, transparent 23%);
  transform: rotate(-18deg);
  border-radius: 60% 20% 60% 20%;
}

.ottoni-workbench {
  min-height: 100vh;
  background: transparent !important;
}

.ottoni-workbench-topbar {
  position: fixed !important;
  inset: 0 0 auto 0;
  z-index: 120;
  min-height: var(--ottoni-os-top) !important;
  padding: 10px 24px 10px calc(var(--ottoni-os-rail) + 22px) !important;
  background: rgba(251,250,247,.94) !important;
  border-bottom: 1px solid var(--ottoni-os-line) !important;
  box-shadow: 0 8px 28px rgba(44,55,47,.045);
  backdrop-filter: blur(18px);
}

.ottoni-workbench-brand {
  min-width: 190px;
}

.ottoni-workbench-brand__mark {
  background: linear-gradient(145deg, #f2ded5, #e8efe8) !important;
  border-color: rgba(48,76,57,.22) !important;
  color: var(--ottoni-os-deep) !important;
}

.ottoni-workbench-brand strong {
  color: var(--ottoni-os-ink) !important;
  letter-spacing: .18em !important;
  font-size: .75rem !important;
}

.ottoni-workbench-brand small {
  color: var(--ottoni-os-muted) !important;
  letter-spacing: .105em !important;
  font-size: .58rem !important;
}

.ottoni-platform-nav--desktop {
  position: fixed;
  z-index: 110;
  inset: 0 auto 0 0;
  width: var(--ottoni-os-rail);
  display: flex;
  flex-direction: column;
  padding: 13px 13px 16px;
  background: rgba(250,249,246,.98);
  border-right: 1px solid var(--ottoni-os-line);
  box-shadow: 12px 0 40px rgba(41,54,45,.055);
}

.ottoni-platform-nav__identity {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 11px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ottoni-os-line);
}

.ottoni-platform-nav__identity b {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--ottoni-os-deep);
  background: var(--ottoni-os-blush);
  border: 1px solid rgba(184,116,94,.28);
  font: 600 1rem/1 Georgia, serif;
}

.ottoni-platform-nav__identity span {
  width: 70px;
  height: 7px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--ottoni-os-deep), var(--ottoni-os-sage));
  opacity: .72;
}

.ottoni-platform-nav__items {
  display: grid;
  gap: 5px;
}

.ottoni-platform-nav__items a {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  color: #58645b;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 15px;
  transition: background .18s ease, transform .18s ease, border-color .18s ease, color .18s ease;
}

.ottoni-platform-nav__items a:hover,
.ottoni-platform-nav__items a:focus-visible {
  color: var(--ottoni-os-deep);
  background: #f4f1eb;
  border-color: var(--ottoni-os-line);
  transform: translateX(2px);
  outline: none;
}

.ottoni-platform-nav__items a.is-active {
  color: var(--ottoni-os-deep);
  background: linear-gradient(135deg, #eef2ec, #f7eee9);
  border-color: rgba(48,76,57,.15);
  box-shadow: 0 9px 26px rgba(48,76,57,.07);
}

.ottoni-platform-nav__items a i {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(48,76,57,.10);
  color: var(--ottoni-os-deep);
  font-style: normal;
  font-size: 1.05rem;
}

.ottoni-platform-nav__items a span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ottoni-platform-nav__items strong {
  font: 650 .84rem/1.15 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ottoni-platform-nav__items small {
  color: #7d877f;
  font: 500 .64rem/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ottoni-platform-nav--desktop footer {
  margin-top: auto;
  padding: 14px 9px 3px;
  color: #859087;
  font: 600 .52rem/1.55 system-ui, sans-serif;
  letter-spacing: .13em;
}

.ottoni-workbench-method,
.ottoni-workbench-frame,
.ottoni-workbench-provider-bridge,
.ottoni-command-palette {
  margin-left: var(--ottoni-os-rail) !important;
}

.ottoni-workbench-method {
  display: none !important;
  position: sticky !important;
  top: var(--ottoni-os-top) !important;
  z-index: 80;
  min-height: var(--ottoni-os-method) !important;
  margin-top: var(--ottoni-os-top) !important;
  background: rgba(248,247,243,.94) !important;
  border-bottom: 1px solid var(--ottoni-os-line) !important;
  backdrop-filter: blur(16px);
}

.ottoni-workbench-method.is-contextual {
  display: block !important;
}

.ottoni-workbench-frame {
  position: relative;
  z-index: 1;
  padding: calc(var(--ottoni-os-top) + 20px) 22px 30px !important;
  min-height: 100vh;
  gap: 18px !important;
}

.ottoni-workbench-method.is-contextual + .ottoni-workbench-frame {
  padding-top: 18px !important;
}

.ottoni-workbench-canvas {
  min-width: 0;
  max-width: none !important;
}

.ottoni-workbench-canvas > section,
.otc-os {
  margin-top: 0 !important;
}

.otc-os {
  border-radius: 24px !important;
  border: 1px solid rgba(48,76,57,.10) !important;
  box-shadow: var(--ottoni-os-shadow) !important;
  overflow: clip;
  background: rgba(251,250,247,.94) !important;
}

.otc-session {
  min-height: 82px !important;
  padding: 15px 20px !important;
}

.otc-session__identity h1 {
  font-size: clamp(1.28rem, 2vw, 1.78rem) !important;
}

.otc-workspace {
  grid-template-columns: minmax(0,1fr) minmax(230px,280px) !important;
}

/* The persistent app rail is now the primary navigation. The historical rail
 * remains in the DOM as an interoperability contract, but no longer competes
 * visually with the software chrome. */
.otc-product-rail {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.otc-surface {
  min-width: 0;
  padding: 18px 20px 24px !important;
}

.otc-context {
  min-width: 0;
  background: linear-gradient(180deg, #f1f4ef, #f8f2ee) !important;
  border-left: 1px solid var(--ottoni-os-line) !important;
}

.otc-area__header {
  margin-bottom: 16px !important;
}

.otc-area__header h2 {
  font-size: clamp(1.38rem, 2.2vw, 2.08rem) !important;
  letter-spacing: -.035em;
}

.otc-method-map {
  grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  gap: 1px !important;
  overflow: hidden;
  border: 1px solid var(--ottoni-os-line);
  border-radius: 18px;
  background: var(--ottoni-os-line);
}

.otc-method-map button {
  min-height: 104px !important;
  background: #fcfbf8 !important;
  border: 0 !important;
  text-align: left;
}

.otc-method-map button:hover,
.otc-method-map button:focus-visible {
  background: #f2f5ef !important;
  outline: 2px solid rgba(48,76,57,.25);
  outline-offset: -2px;
}

.ottoni-workbench-modulebar {
  border-radius: 20px 20px 0 0 !important;
}

.ottoni-workbench-provider {
  border-radius: 0 0 20px 20px !important;
  background: rgba(253,252,249,.96) !important;
  box-shadow: var(--ottoni-os-shadow);
}

.ottoni-workbench-provider__content {
  min-width: 0;
}

.ottoni-guided-stage {
  max-width: 920px;
  margin: 0 auto;
}

.ottoni-account-menu__panel {
  z-index: 300 !important;
}

.ottoni-platform-nav--mobile {
  display: none;
}

@media (max-width: 1180px) {
  :root { --ottoni-os-rail: 88px; }
  .ottoni-platform-nav--desktop { width: var(--ottoni-os-rail); padding-inline: 10px; }
  .ottoni-platform-nav__identity { justify-content: center; padding-inline: 0; }
  .ottoni-platform-nav__identity span,
  .ottoni-platform-nav__items a span,
  .ottoni-platform-nav--desktop footer { display: none; }
  .ottoni-platform-nav__items a { grid-template-columns: 1fr; justify-items: center; padding: 8px; }
  .ottoni-workbench-topbar { padding-left: calc(var(--ottoni-os-rail) + 14px) !important; }
}

@media (max-width: 860px) {
  :root { --ottoni-os-top: 64px; --ottoni-os-rail: 0px; }

  body.ottoni-platform-private { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .ottoni-platform-nav--desktop { display: none; }
  .ottoni-workbench-topbar {
    min-height: var(--ottoni-os-top) !important;
    padding: 8px 12px !important;
  }
  .ottoni-workbench-brand { min-width: 0; }
  .ottoni-workbench-brand small { display: none; }
  .ottoni-workbench-context { display: none !important; }
  .ottoni-workbench-tools > button[data-workbench-inspector-toggle] { display: none; }
  .ottoni-workbench-tools > button[data-ottoni-command-open] span { display: none; }

  .ottoni-workbench-method,
  .ottoni-workbench-frame,
  .ottoni-workbench-provider-bridge,
  .ottoni-command-palette {
    margin-left: 0 !important;
  }

  .ottoni-workbench-method {
    margin-top: var(--ottoni-os-top) !important;
    top: var(--ottoni-os-top) !important;
  }

  .ottoni-workbench-frame,
  .ottoni-workbench-method.is-contextual + .ottoni-workbench-frame {
    padding: calc(var(--ottoni-os-top) + 10px) 10px 18px !important;
  }

  .ottoni-workbench-method.is-contextual + .ottoni-workbench-frame {
    padding-top: 10px !important;
  }

  .otc-os { border-radius: 18px !important; }
  .otc-session { padding: 13px 14px !important; }
  .otc-session__telemetry { display: none !important; }
  .otc-workspace { grid-template-columns: minmax(0,1fr) !important; }
  .otc-context { display: none !important; }
  .otc-surface { padding: 14px 12px 18px !important; }
  .otc-method-map { grid-template-columns: 1fr !important; }
  .otc-method-map button { min-height: 86px !important; }

  .ottoni-platform-nav--mobile {
    position: fixed;
    z-index: 220;
    display: block;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 6px;
    border: 1px solid rgba(48,76,57,.14);
    border-radius: 20px;
    background: rgba(250,249,246,.95);
    box-shadow: 0 18px 50px rgba(41,54,45,.20);
    backdrop-filter: blur(18px);
  }

  .ottoni-platform-nav--mobile .ottoni-platform-nav__items {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items::-webkit-scrollbar { display: none; }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items a {
    flex: 1 0 58px;
    min-width: 58px;
    min-height: 56px;
    grid-template-columns: 1fr;
    gap: 3px;
    justify-items: center;
    padding: 5px 3px;
    border-radius: 14px;
  }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items a i {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
  }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items a span { display: block; }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items strong {
    display: block;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .62rem;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .ottoni-workbench-brand strong { font-size: .66rem !important; letter-spacing: .13em !important; }
  .ottoni-workbench-brand__mark { width: 32px !important; height: 32px !important; }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items a { min-width: 54px; }
  .ottoni-platform-nav--mobile .ottoni-platform-nav__items strong { font-size: .58rem; }
  .otc-area__header small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ottoni-platform-nav__items a { transition: none; }
  body.ottoni-platform-private::before { display: none; }
}
