/*
 * The sign-in pages' one stylesheet. Tokens first, with the application's
 * names and values (Malachite and Gold, apps/web-shell/app/globals.css), light
 * and dark; nothing below the token blocks names a colour. The frame matches
 * the application's sign-in frame (components/auth/auth-frame.tsx).
 */

@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/assets/fonts/schibsted-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --background: 126 12% 96.5%;
  --foreground: 144 18% 11%;
  --card: 0 0% 100%;
  --primary: 159 68% 25%;
  --primary-foreground: 0 0% 100%;
  --muted-foreground: 136 8% 39%;
  --accent: 148 33% 92%;
  --accent-foreground: 158 70% 17%;
  --border: 128 14% 89%;
  --input: 129 15% 82%;
  --ring: 159 68% 25%;
  --destructive: 4 61% 44%;
  --destructive-soft: 4 70% 95%;
  --kbs-gold: 40 61% 45%;
  --kbs-panel: 158 62% 11%;
  --kbs-panel-foreground: 140 24% 95%;
  --panel-muted: 149 18% 81%;
  --panel-line: 157 33% 26%;
  --cta: 41 70% 60%;
  --info: 213 40% 40%;
  --radius: 0.5rem;
  --radius-control: 0.375rem;
  --font-sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 150 14% 8%;
    --foreground: 140 12% 92%;
    --card: 150 12% 11%;
    --primary: 157 42% 52%;
    --primary-foreground: 152 30% 8%;
    --muted-foreground: 140 7% 62%;
    --accent: 156 24% 19%;
    --accent-foreground: 150 35% 80%;
    --border: 150 9% 19%;
    --input: 150 9% 23%;
    --ring: 157 42% 52%;
    --destructive: 4 55% 60%;
    --destructive-soft: 4 35% 15%;
    --kbs-gold: 42 60% 55%;
    --kbs-panel: 156 28% 12%;
    --kbs-panel-foreground: 140 12% 92%;
    --panel-muted: 140 9% 74%;
    --panel-line: 150 12% 22%;
    --info: 213 45% 65%;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul, ol { margin: 0; }

a { color: hsl(var(--primary)); text-underline-offset: 0.18em; }
a:hover { color: hsl(var(--accent-foreground)); }

:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.help :focus-visible { outline-color: hsl(var(--cta)); }

.skip {
  position: absolute;
  left: 1rem;
  top: -100px;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-control);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
}
.skip:focus { top: 1rem; }

/* ── the frame ── */

.frame { min-height: 100vh; }

@media (min-width: 1024px) {
  .frame { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}

.task {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
}

@media (min-width: 640px) { .task { padding: 2rem 2.5rem; } }
@media (min-width: 1024px) { .task { min-height: 100vh; padding: 2.5rem 3.5rem; } }

.top, .content { width: 100%; max-width: 28rem; margin-inline: auto; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.content { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 1.5rem; }

.brand { display: inline-flex; align-items: center; gap: 0.625rem; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-control);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 700;
}

.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-suite { font-weight: 500; color: hsl(var(--muted-foreground)); }

.lang { font-size: 0.875rem; font-weight: 600; text-decoration: none; padding: 0.5rem 0; }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--primary));
}
.eyebrow-gold { color: hsl(var(--cta)); }

h1 { font-size: 1.875rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.01em; }

.subtitle { color: hsl(var(--muted-foreground)); }

/* ── the help half ── */

.help {
  background: hsl(var(--kbs-panel));
  color: hsl(var(--kbs-panel-foreground));
  padding: 2.5rem 1.5rem;
}

@media (min-width: 1024px) {
  .help { display: flex; align-items: center; padding: 3.5rem; }
}

.help-inner { width: 100%; max-width: 32rem; margin-inline: auto; display: flex; flex-direction: column; gap: 1rem; }
.help h2 { font-size: 1.5rem; line-height: 1.25; text-wrap: balance; }
.help-text { color: hsl(var(--panel-muted)); }

.points { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.points li {
  padding: 0.875rem 1rem;
  border: 1px solid hsl(var(--panel-line));
  border-radius: var(--radius);
  color: hsl(var(--panel-muted));
  font-size: 0.9375rem;
}

/* ── forms ── */

.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.375rem; }
label { font-size: 0.875rem; font-weight: 600; }

input {
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-control);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 0.9375rem;
}
input:focus-visible { outline-offset: 0; }

.hint { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: hsl(var(--accent-foreground)); color: hsl(var(--primary-foreground)); }

.button-quiet { background: transparent; border-color: hsl(var(--input)); color: hsl(var(--foreground)); }
.button-quiet:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.button-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: hsl(var(--primary));
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.inline-form { display: inline; }
.row-links { display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: 0.9375rem; }
.aside-link { font-size: 0.875rem; }

.notice {
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--border));
  border-left: 3px solid hsl(var(--primary));
  border-radius: var(--radius-control);
  background: hsl(var(--card));
  font-size: 0.9375rem;
}
.notice-error { border-left-color: hsl(var(--destructive)); background: hsl(var(--destructive-soft)); }
.notice p + p { margin-top: 0.25rem; }

.rules { padding: 0.75rem 1rem; border-radius: var(--radius-control); background: hsl(var(--accent)); font-size: 0.875rem; }
.rules-title { font-weight: 600; color: hsl(var(--accent-foreground)); }
.rules ul { margin-top: 0.25rem; padding-left: 1.125rem; color: hsl(var(--accent-foreground)); }

/* ── two-step ── */

.steps { padding-left: 1.25rem; display: flex; flex-direction: column; gap: 1.5rem; }
.steps li { display: flex; flex-direction: column; gap: 0.75rem; }
.qr { width: 11rem; height: 11rem; border-radius: var(--radius-control); border: 1px solid hsl(var(--border)); }
.secret, .codes code, .error-detail { font-family: var(--font-mono); font-size: 0.9375rem; }
.secret { word-break: break-all; }

.codes { padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.codes li { padding: 0.5rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius-control); background: hsl(var(--card)); text-align: center; }

/* ── the chooser ── */

.place-group { display: flex; flex-direction: column; gap: 0.5rem; }
.place-kind { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.places { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.place-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.125rem 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  text-decoration: none;
}
.place-link:hover { border-color: hsl(var(--primary)); color: hsl(var(--foreground)); }
/* A company this browser used: a form, so choosing it needs no script. */
.place-form { margin: 0; }
button.place-link { width: 100%; font: inherit; text-align: left; cursor: pointer; }
button.place-link:focus-visible, a.place-link:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.place-name { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.place-roles { grid-column: 1; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.place-open { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 0.875rem; font-weight: 600; color: hsl(var(--primary)); }

/* The marks every environment carries (ADR-036): production a dot, the
   sandbox a diamond, staging a square. The shape says it as well as the colour. */
.mark { display: inline-block; width: 0.625rem; height: 0.625rem; flex: none; }
.mark-production { border-radius: 50%; background: hsl(var(--primary)); }
.mark-sandbox { transform: rotate(45deg); background: hsl(var(--kbs-gold)); }
.mark-staging { border-radius: 2px; background: hsl(var(--info)); }

.panel-section { display: flex; flex-direction: column; gap: 0.75rem; padding-top: 1.25rem; border-top: 1px solid hsl(var(--border)); }

.error-detail {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-control);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  white-space: pre-wrap;
  word-break: break-word;
}

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