/* TinyOrange demos — the shell around every app's /demo.
   Dark studio, light apps inside it. Tokens are the family's (Control, Marco). */

:root {
  --orange: #ffa500;
  --burnt: #cc5500;
  --deep: #b34a00;
  --bg: #12141a;
  --bg-2: #0d0f14;
  --surface: #1a1d26;
  --surface-2: #222634;
  --border: #2d3140;
  --border-strong: #3b4054;
  --text: #e7ecf3;
  --dim: #97a1b4;
  --faint: #6b7488;
  --good: #34d399;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --bar-h: 56px;
  --foot-h: 34px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
/* A stylesheet `display` on an element beats the browser's own [hidden] rule,
   which is how the "coming" panel stayed painted over a working frame. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.4;
  display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; overflow: hidden;
}
a { color: var(--orange); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---- the bar ---------------------------------------------------------- */
.bar {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  height: calc(var(--bar-h) + var(--safe-top)); padding: var(--safe-top) 14px 0;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--text); white-space: nowrap; }
.wordmark { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.wordmark__tiny { color: #fff; }
.wordmark__orange { color: var(--orange); }
.brand__sub { color: var(--dim); font-size: 13px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 4px 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 6px 12px; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--dim); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.tab__name { font-weight: 700; font-size: 14px; line-height: 1.1; }
.tab__name::first-letter { color: var(--orange); }
.tab__tag { font-size: 11px; color: var(--faint); line-height: 1.1; }
.tab[aria-selected="true"] .tab__tag { color: var(--dim); }
.tab--soon .tab__name { color: var(--faint); }
.tab--soon .tab__name::first-letter { color: var(--deep); }

.you { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--dim); font-size: 13px; }
.you__name { color: var(--text); font-weight: 600; }
.roles { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.role { border: 0; background: none; color: var(--dim); padding: 4px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.role[aria-pressed="true"] { background: var(--burnt); color: #fff; }

.actions { display: flex; gap: 6px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-size: 13px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn--ghost { background: none; }
.btn--ghost[aria-pressed="true"] { background: var(--surface-2); border-color: var(--orange); color: var(--orange); }
.btn--orange { background: var(--burnt); border-color: var(--burnt); color: #fff; }
.btn--orange:hover { background: var(--deep); }

/* ---- the stage -------------------------------------------------------- */
.stage { position: relative; min-height: 0; display: grid; place-items: stretch; background: var(--bg); }
.device { position: relative; width: 100%; height: 100%; display: grid; place-items: stretch; }
.device__screen { position: relative; width: 100%; height: 100%; background: #fff; }
.device__screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.device__screen iframe[hidden] { display: none; }

/* phone framing on a wide screen: a device on a dark ground */
.stage[data-frame="phone"] { place-items: center; padding: 18px; }
.stage[data-frame="phone"] .device {
  width: min(430px, 100%); height: min(930px, 100%); border-radius: 36px; padding: 10px;
  background: #05060a; border: 1px solid var(--border-strong); box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 0 0 1px #1f2330;
}
.stage[data-frame="phone"] .device__screen { border-radius: 27px; overflow: hidden; }

/* a frame that has not reported ready yet gets a quiet shimmer */
.device__screen[data-loading="true"]::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #f3efe9 0%, #ffffff 50%, #f3efe9 100%); background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .device__screen[data-loading="true"]::after { animation: none; } }

/* ---- the landing ------------------------------------------------------- */
body[data-view="home"] .you, body[data-view="home"] #frame-toggle, body[data-view="home"] #reset { display: none; }
.home { position: absolute; inset: 0; overflow-y: auto; background: radial-gradient(70% 45% at 30% 0%, #1e2130 0%, var(--bg) 60%); }
.home__inner { max-width: 1120px; margin: 0 auto; padding: 48px 28px 40px; display: grid; gap: 36px; }
.home__eyebrow { margin: 0 0 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--orange); }
.home__title { margin: 0 0 16px; font-size: clamp(28px, 4vw, 44px); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; max-width: 20ch; text-wrap: balance; }
.home__title::first-letter { color: var(--orange); }
.home__lead { margin: 0 0 22px; font-size: 16px; line-height: 1.55; color: var(--dim); max-width: 62ch; }
.home__lead strong { color: var(--text); font-weight: 600; }
.cast { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 0 0 16px; max-width: 760px; }
.cast__person { padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.cast__person dt { font-size: 13px; color: var(--dim); }
.cast__name { color: var(--text); font-weight: 700; font-size: 15px; }
.cast__person dd { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
.home__note { margin: 0; color: var(--faint); font-size: 13px; max-width: 62ch; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.app-item { display: grid; }
.app-item > .app { width: 100%; }
.app {
  display: grid; align-content: start; gap: 8px; text-align: left; padding: 16px 18px 14px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.app:hover { background: var(--surface-2); border-color: var(--orange); transform: translateY(-1px); }
.app--soon { cursor: default; border-color: var(--border); background: transparent; }
.app--soon:hover { background: transparent; border-color: var(--border); transform: none; }
.app__head { display: flex; align-items: baseline; gap: 10px; }
.app__name { font-weight: 800; font-size: 20px; }
.app__name::first-letter { color: var(--orange); }
.app--soon .app__name { color: var(--dim); }
.app--soon .app__name::first-letter { color: var(--deep); }
.app__tag { font-size: 12px; color: var(--faint); }
.app__what { color: var(--dim); line-height: 1.45; }
.app__who { color: var(--faint); font-size: 12px; }
.app__cta { margin-top: 6px; font-weight: 700; font-size: 13px; color: var(--orange); }
.app--soon .app__cta { color: var(--faint); font-weight: 500; }
.home__foot { margin: 0; color: var(--faint); font-size: 12px; max-width: 90ch; }
@media (prefers-reduced-motion: reduce) { .app, .app:hover { transition: none; transform: none; } }

/* ---- the first-visit card --------------------------------------------- */
.card {
  position: absolute; left: 18px; bottom: 18px; width: min(380px, calc(100% - 36px)); padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.card__eyebrow, .soon__eyebrow { margin: 0 0 4px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.card__title, .soon__title { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.card__title::first-letter, .soon__title::first-letter { color: var(--orange); }
.card__what, .card__who, .card__try, .soon__what { margin: 0 0 6px; color: var(--dim); }
.card__what { color: var(--text); }
.card__try { color: var(--text); }
.card__try::before { content: "Try: "; color: var(--orange); font-weight: 700; }
.card__row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.card__hint { color: var(--faint); font-size: 12px; }

/* ---- coming soon ---------------------------------------------------------- */
.soon {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px;
  background: radial-gradient(60% 50% at 50% 40%, #1c1f2a 0%, var(--bg) 70%);
}
.soon__what { max-width: 46ch; margin: 0 auto 10px; }
.soon__note { color: var(--faint); max-width: 44ch; margin: 0 auto; font-size: 13px; }

/* ---- toast ------------------------------------------------------------------ */
.toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 8px 14px; border-radius: 10px;
  background: #3a2418; border: 1px solid var(--burnt); color: #ffd9c2; font-size: 13px; max-width: calc(100% - 36px);
}

/* ---- footer ----------------------------------------------------------------- */
.foot {
  display: flex; justify-content: space-between; gap: 12px; align-items: center; height: calc(var(--foot-h) + var(--safe-bottom));
  padding: 0 14px var(--safe-bottom); background: var(--bg-2); border-top: 1px solid var(--border); color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden;
}
.foot__item { overflow: hidden; text-overflow: ellipsis; }

/* ---- middling widths: the tabs get their own row, so all six are always in view ---- */
@media (max-width: 1400px) {
  .bar { grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; height: auto; padding-bottom: 6px; row-gap: 2px; }
  .brand { grid-row: 1; }
  .you { grid-row: 1; grid-column: 2; justify-self: end; }
  .actions { grid-row: 1; grid-column: 3; }
  .tabs { grid-row: 2; grid-column: 1 / -1; }
}

/* ---- small screens: the app is the screen ---------------------------------------- */
@media (max-width: 900px) {
  .bar { grid-template-columns: auto 1fr; grid-template-rows: auto auto; height: auto; padding-bottom: 6px; row-gap: 6px; }
  .tabs { grid-column: 1 / -1; order: 3; }
  .you { display: none; }
  .actions { justify-self: end; }
  #frame-toggle, #contact { display: none; }
  .stage[data-frame="phone"] { padding: 0; }
  .stage[data-frame="phone"] .device { width: 100%; height: 100%; border-radius: 0; padding: 0; border: 0; box-shadow: none; }
  .stage[data-frame="phone"] .device__screen { border-radius: 0; }
  .card { left: 10px; right: 10px; bottom: 10px; width: auto; }
  .foot { display: none; }
  .home__inner { padding: 28px 16px 32px; gap: 24px; }
  .apps { grid-template-columns: 1fr; }
}
