/* SkyOS — what every page shares on top of its own styles: the tool logos,
   the sign-in screen, the signed-in account in the top bar, and the States
   menu, a small review tool fixed bottom-right that switches the current page
   into any of its states in place (shown only when the pages run locally).
   Colours come from tokens.css. */

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- signed out: the way in -------------------------------------------- */
/* Takes the place of the page until someone signs in: one card, centred. */
/* The card is the whole page: no top bar, centred on the screen. */
.skyos-signed-out .topbar { display: none; }
.skyos-signed-out .page { display: flex; align-items: center; min-height: 100vh; padding: 24px 0; }
.signin {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 36px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.signin-mark { display: block; margin: 0 auto 22px; color: var(--ink); }
.signin h1 { margin-bottom: 8px; font-size: 28px; }
.signin-sub { margin: 0 0 28px; font-size: 15px; color: var(--subtext); }
.signin-sub:last-child { margin-bottom: 0; }
.signin-actions { display: flex; flex-direction: column; gap: 10px; }
.signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: var(--on-ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease;
}
.signin-btn:hover { background: var(--ink-hover); }
.signin-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* One way in for people with an account; the way to make one is a line, so
   the two never look like the same choice twice. */
.signin-new { margin: 16px 0 0; font-size: 14px; color: var(--subtext); }
.signin-new a { color: var(--ink); font-weight: 500; text-underline-offset: 3px; }
.signin-msg { min-height: 21px; margin: 14px 0 0; font-size: 14px; color: var(--subtext); text-wrap: balance; }
/* The message is written once, with the card, so an empty one takes no room. */
.signin-msg:empty { display: none; }
/* What creating an account agrees to, with the pages on skyos.ink. */
.signin-terms { margin: 18px 0 0; font-size: 13px; color: var(--subtext); text-wrap: balance; }
.signin-terms a { color: var(--ink); text-underline-offset: 3px; }

/* Until the first answer from the API, a page that needs an account shows
   nothing, top bar included: then either the welcome card (which has no bar)
   or the page with its bar appears whole, and neither glimpses the other. */
.skyos-checking .topbar, .skyos-checking .page-inner { visibility: hidden; }

/* ---- the signed-in account, at the end of the top bar ------------------- */
/* The email in grey, Sign out in plain ink text: nothing around it and no
   hover change. */
.account { display: flex; align-items: center; gap: 24px; min-width: 0; margin-left: auto; font-size: 14px; }
.account-email { min-width: 0; overflow: hidden; font-size: 12px; color: var(--subtext); text-overflow: ellipsis; white-space: nowrap; }
.account-out { position: relative; flex: none; color: var(--ink); text-decoration: none; }
/* A finger-sized target around the words; the link itself looks the same. */
.account-out::after { content: ""; position: absolute; inset: -12px -8px; }
.account-out:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
/* Signed out on a page anyone can open: the landing's header, Sign in and a
   small Get started, never stretched to full width on a phone. */
.guest { display: flex; align-items: center; gap: 20px; margin-left: auto; font-size: 14px; }
.guest-in { position: relative; color: var(--ink); text-decoration: none; }
.guest-in:hover { text-decoration: underline; text-underline-offset: 3px; }
.guest-in::after { content: ""; position: absolute; inset: -12px -8px; }
.guest-in:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.guest .btn { width: auto; }

/* Other companies' marks in their own colours — the one exception to the
   monochrome palette. Each page sets the size. */
.logo { display: block; flex: none; }
.logo-claude { color: var(--logo-claude); }
.logo-chatgpt { color: var(--logo-openai); }
.logo-codex { color: var(--logo-codex); }

.states {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.states-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--subtext);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 7%, transparent);
  transition: color 0.12s ease, border-color 0.12s ease;
}
.states-toggle svg { color: var(--muted); }
.states-toggle:hover, .states-toggle[aria-expanded="true"] { color: var(--ink); border-color: var(--border-strong); }
.states-toggle:hover svg, .states-toggle[aria-expanded="true"] svg { color: var(--ink); }
.states-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.states-menu {
  display: flex;
  flex-direction: column;
  width: min(260px, calc(100vw - 24px));
  max-height: min(72vh, 480px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--ink) 12%, transparent);
}
.states-label { margin: 6px 10px 4px; font-size: 12px; font-weight: 500; color: var(--subtext); }
.states-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.states-item:hover { background: var(--surface-sunk); }
.states-item:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.states-item[aria-checked="true"] { font-weight: 500; }
.states-tick { display: flex; flex: none; width: 14px; margin-left: auto; }
.states-rule { height: 1px; margin: 6px 4px; background: var(--border); }
.states-reset { color: var(--subtext); }

@media (max-width: 640px) {
  .states { right: 12px; bottom: 12px; }
  /* The email makes way for the nav; Sign out stays, with room beside it. */
  .account-email { display: none; }
  .signin { padding: 32px 20px 22px; }
  .topbar .topbar-inner { column-gap: 12px; }
}

@media (max-width: 400px) {
  .topbar .topbar-inner { column-gap: 10px; }
  .topbar .nav a { padding: 0 7px; }
}

/* The smallest phones have room for the mark, the nav and Sign out, but not
   the word "SkyOS" too: it leaves the screen and stays the link's name for
   screen readers. */
@media (max-width: 360px) {
  .topbar .wordmark {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
