/* Almost There — the shell around the phone. The phone's own interior is styled
   with the design system in ds.css plus inline styles carried over from the
   design document, so this file only dresses the frame it sits in. */

body {
  margin: 0;
  background: #c9c7c7;
  color: #201e1d;
  min-height: 100vh;
}

/* ── masthead ─────────────────────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 30px 18px;
  border-bottom: 2px solid var(--color-divider);
  flex-wrap: wrap;
}

.mark { position: relative; width: 44px; height: 44px; flex: none; }
.mark span:nth-child(1) { position: absolute; inset: 0; border: 2px solid var(--color-neutral-400); border-radius: 50%; }
.mark span:nth-child(2) { position: absolute; inset: 8px; border: 2px dashed var(--color-accent-400); border-radius: 50%; }
.mark span:nth-child(3) {
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  margin: -4px 0 0 -4px; background: var(--color-accent);
}

.masthead-titles { margin-right: auto; }
.masthead h1 { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.masthead-sub {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--color-neutral-700);
}

.masthead-actions { display: flex; align-items: center; gap: 12px; }

.account { display: flex; align-items: center; gap: 12px; }
.who { display: flex; flex-direction: column; line-height: 1.25; }
.who-name { font-family: var(--font-heading); font-weight: 800; font-size: 14px; }
.who-email { font-size: 11px; color: var(--color-neutral-700); }

/* ── sign in ──────────────────────────────────────────────────────────────── */

.signin { display: none; padding: 40px 20px 80px; }
body.signed-out .signin { display: block; }
body.signed-out .stage { display: none; }

.auth-card {
  width: min(400px, 100%); margin: 0 auto;
  background: var(--color-bg);
  border: 2px solid var(--color-divider);
  box-shadow: var(--shadow-md);
  padding: 30px 28px 26px;
}

.auth-mark { position: relative; width: 36px; height: 36px; margin-bottom: 18px; }
.auth-mark span:nth-child(1) { position: absolute; inset: 0; border: 2px solid var(--color-neutral-400); border-radius: 50%; }
.auth-mark span:nth-child(2) { position: absolute; inset: 7px; border: 2px dashed var(--color-accent-400); border-radius: 50%; }
.auth-mark span:nth-child(3) {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
  margin: -3.5px 0 0 -3.5px; background: var(--color-accent);
}

.auth-title { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 20px; font-size: 13px; color: var(--color-neutral-700); }

.auth-card .field { margin-bottom: 14px; }
.auth-hint { font-size: 11px; color: var(--color-neutral-600); margin-top: 5px; }
.auth-submit { margin-top: 4px; justify-content: center; text-align: center; }

.auth-error, .auth-notice {
  font-size: 12.5px; padding: 10px 12px; margin-bottom: 16px;
  display: flex; gap: 9px; background: var(--color-surface);
  border-left: 3px solid var(--color-accent);
}
.auth-notice { border-left-color: var(--color-neutral-500); }

.auth-or {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--color-neutral-600);
}
.auth-or::before, .auth-or::after {
  content: ""; flex: 1; height: 1px; background: var(--color-divider);
}

.auth-google { justify-content: center; text-align: center; margin: 0; }
.g-mark {
  width: 18px; height: 18px; flex: none; display: grid; place-items: center;
  background: var(--color-text); color: var(--color-bg);
  font-family: var(--font-heading); font-weight: 800; font-size: 11px;
}

.auth-links {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--color-divider);
}

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--color-accent-700);
  text-align: left;
}
.linkish:hover { text-decoration: underline; }

.auth-demo { margin-top: 20px; padding: 14px; background: var(--color-surface); }
.auth-demo h6 { margin: 0 0 6px; }
.auth-demo p { margin: 0 0 10px; font-size: 11.5px; color: var(--color-neutral-800); }
.auth-demo code { font-size: 11px; background: var(--color-neutral-300); padding: 1px 5px; }
.auth-demo-list { display: flex; flex-direction: column; gap: 5px; }
.auth-demo-list .linkish { display: flex; gap: 8px; width: 100%; }
.auth-demo-list .linkish span { color: var(--color-neutral-600); margin-left: auto; font-size: 11px; }

/* ── stage ────────────────────────────────────────────────────────────────── */

.stage {
  display: grid;
  grid-template-columns: 250px minmax(0, auto) 290px;
  gap: 30px;
  align-items: start;
  padding: 26px 30px 70px;
}

/* ── screen rail ──────────────────────────────────────────────────────────── */

.rail { position: sticky; top: 20px; display: flex; flex-direction: column; }
.rail-group {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-neutral-700);
  padding: 14px 0 6px;
  border-bottom: 2px solid var(--color-divider);
  margin-bottom: 4px;
}
.rail-group:first-child { padding-top: 0; }

.rail button {
  display: flex; align-items: baseline; gap: 9px;
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0;
  border-bottom: 1px solid var(--color-divider);
  padding: 8px 4px;
  font-family: var(--font-body); font-size: 12.5px; color: var(--color-text);
}
.rail button:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.rail button .num {
  font-family: var(--font-heading); font-weight: 800; font-size: 10px;
  letter-spacing: .12em; padding: 3px 5px; flex: none;
  background: var(--color-neutral-400); color: var(--color-bg);
}
.rail button[aria-current="true"] { background: var(--color-text); color: var(--color-bg); }
.rail button[aria-current="true"] .num { background: var(--color-accent); color: #f3f2f2; }

/* ── the phone ────────────────────────────────────────────────────────────── */

.phone-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.phone {
  width: 390px; height: 844px; flex: none;
  display: flex; flex-direction: column; overflow: hidden;
  border: 2px solid var(--color-divider);
  box-shadow: var(--shadow-md);
  background: var(--color-bg); color: var(--color-text);
}

.phone-scroll { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.phone-caption {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-neutral-700);
}

/* The design's two themes, scoped to the phone so the surrounding page keeps its
   own ground. Values lifted from the design document's theme tokens. */
.phone[data-theme="light"] {
  --color-bg: #f3f2f2; --color-surface: #eae9e9; --color-text: #201e1d;
  --color-divider: rgba(32, 30, 29, .4);
  --color-neutral-100: #f8f4f4; --color-neutral-200: #eae7e7; --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6; --color-neutral-500: #9b9797; --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d; --color-neutral-800: #444141; --color-neutral-900: #2d2b2b;
}
.phone[data-theme="dark"] {
  --color-bg: #201e1d; --color-surface: #2d2b2b; --color-text: #f3f2f2;
  --color-divider: rgba(243, 242, 242, .42);
  --color-neutral-100: #2d2b2b; --color-neutral-200: #3a3737; --color-neutral-300: #4d4a4a;
  --color-neutral-400: #7d7979; --color-neutral-500: #9b9797; --color-neutral-600: #bab6b6;
  --color-neutral-700: #d7d3d3; --color-neutral-800: #eae7e7; --color-neutral-900: #f8f4f4;
}

/* ── controls inside the phone ────────────────────────────────────────────── */

.phone input[type=range] {
  -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--color-neutral-300); width: 100%;
}
.phone input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 22px;
  background: var(--color-accent); cursor: pointer;
}
.phone input[type=range]::-moz-range-thumb {
  width: 16px; height: 22px; border: 0; border-radius: 0;
  background: var(--color-accent); cursor: pointer;
}

.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px 5px; font-size: 11px; font-weight: 600;
}
.statusbar .pill {
  display: flex; align-items: center; gap: 5px;
  cursor: pointer; background: none; border: 0; padding: 0;
  color: inherit; font: inherit;
}
.statusbar .dot { width: 6px; height: 6px; }

.tap { cursor: pointer; }
.plain-btn {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%;
}

.scroll-y { flex: 1; overflow-y: auto; min-height: 0; }

/* ── side notes ───────────────────────────────────────────────────────────── */

.notes { position: sticky; top: 20px; font-size: 12px; }
.notes h6 { margin: 0 0 8px; }
.note-body { color: var(--color-neutral-800); line-height: 1.55; }
.note-body p { margin: 0 0 9px; }
.note-body code {
  font-size: 11px; background: var(--color-neutral-200); padding: 1px 4px;
}
.wire {
  margin: 0; font-size: 10.5px; line-height: 1.5; white-space: pre-wrap;
  word-break: break-word; max-height: 320px; overflow: auto;
  background: var(--color-neutral-200); padding: 9px; color: var(--color-neutral-800);
}

/* ── narrow screens ───────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .stage { grid-template-columns: 220px minmax(0, auto); }
  .notes { display: none; }
}

@media (max-width: 820px) {
  .masthead { padding: 16px; }
  .masthead-actions { width: 100%; }
  .stage { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 16px 50px; }
  .rail {
    position: static;
    flex-direction: row; flex-wrap: wrap; gap: 6px;
    max-height: 168px; overflow-y: auto;
    border: 2px solid var(--color-divider); padding: 8px;
  }
  .rail-group { display: none; }
  .rail button { width: auto; border: 1px solid var(--color-divider); padding: 6px 8px; }
  .phone-wrap { align-items: stretch; }
  .phone {
    width: 100%; max-width: 390px; margin: 0 auto;
    height: min(844px, calc(100vh - 220px));
  }
}
