/* Homepage, direction A (owner, 2026-11-29): the homepage's own sections on top of site.css, which every page loads.
   This file is loaded by index.html only. Gradients are allowed here and in site.css only (tests/test_site_style.py).
   The request box comes first (A-48, A-58). Motion stops for reduced motion. */

/* The band is taller here: it holds the headline. */
.home .top-band { margin-bottom: 8px; padding-bottom: 28px; }
.home .top-band h1 { margin: 24px 0 8px; font-size: clamp(1.75rem, 5vw, 2.75rem); line-height: 1.15; color: #ffffff; }
.home-hero-lead { margin: 0; max-width: 40rem; color: #ffffff; }

/* The thread takes no room until the chat starts. */
.home .chat:empty { margin: 0; }

/* The chips and the request box. Three show; the rest wait behind More ideas. */
.home .example-chip {
  border: 2px solid transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(90deg, var(--fb-pink), var(--fb-violet), var(--fb-cyan)) border-box;
  transition: transform 0.15s ease, background 0.15s ease;
}
.home .example-chip:hover { transform: translateY(-2px) rotate(-1deg); background: var(--fb-lime); color: var(--fb-night); }
.more-ideas > summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--accent); text-decoration: underline; cursor: pointer; }
.more-ideas[open] { flex-basis: 100%; }
.home .create-menu > summary { font-size: 0.875rem; }
/* The open Make menu reaches below the band, so the band sits above the box while it is open. */
.home .top-band:has(.create-menu[open]) { z-index: 6; }
.home .composer { padding: 6px; border: 2px solid var(--fb-pink); border-radius: 16px; background: var(--panel); }
/* The price strip under the box (BACKLOG 18): the figures are the code's (tests/test_price_strip.py). */
.price-strip { margin: 0; }
.price-strip a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--ink); }

/* A file dragged over any part of the page: one overlay says where it goes. It never catches the pointer. */
.drop-overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; color: #ffffff; background: rgba(31, 17, 71, 0.86); border: 4px dashed var(--fb-lime); font-size: 1.5rem; font-weight: 700; }

/* The plan, once the chat has one, gets the pink frame. */
.home .msg.assistant:has(.step-list) { border: 2px solid var(--fb-pink); }

/* What you can make: one card per feature. */
.home .home-features { padding: 0; background: none; border: 0; margin-top: 32px; }
.home .home-features ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.home .home-features li { padding: 16px; border: 2px solid var(--fb-violet); border-radius: 16px; background: var(--panel); transition: transform 0.2s ease; }
.home .home-features li:nth-child(3n + 1) { border-color: var(--fb-pink); }
.home .home-features li:nth-child(3n) { border-color: var(--fb-cyan); }
.home .home-features li:hover { transform: translateY(-4px) rotate(-0.5deg); }
.home .home-features strong { display: block; margin-bottom: 4px; font-size: 1.125rem; }

/* How it works: three numbered steps. */
.home-steps { margin-top: 32px; }
.home-steps ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.home-steps h3 { margin: 8px 0 4px; }
.home-steps p { margin: 0; }
.home-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-weight: 700;
  color: var(--fb-night);
  background: linear-gradient(135deg, var(--fb-pink), var(--fb-sun));
}
.home-steps li:nth-child(2) .home-step-num { background: linear-gradient(135deg, var(--fb-lime), var(--fb-cyan)); }
.home-steps li:nth-child(3) .home-step-num { background: linear-gradient(135deg, var(--fb-sun), var(--fb-lime)); }

/* The samples: a grid of tiles that lift and zoom on hover. */
.home .home-samples { margin-top: 32px; }
.home #samples-title { font-size: 1.5rem; color: var(--ink); }
.home .sample-row { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 16px; }
.home .sample-figure { position: relative; overflow: hidden; border: 2px solid transparent; border-radius: 16px; background: var(--panel); transition: transform 0.2s ease, border-color 0.2s ease; }
.home .sample-figure:hover, .home .sample-figure:focus-within { transform: translateY(-4px); border-color: var(--fb-pink); }
.home .sample-figure video, .home .sample-figure img { aspect-ratio: 1 / 1; object-fit: cover; border-radius: 0; transition: transform 0.3s ease; }
.home .sample-figure:hover video, .home .sample-figure:hover img { transform: scale(1.04); }
.home .sample-frame { overflow: hidden; }
.home .sample-card { padding: 10px 12px; margin-top: 0; }

/* Predis-style grid (BACKLOG 16): pills filter by kind; every frame is square, and a tile that is not square shows
   whole inside it, so the tall reel leaves no gap in its row. A badge names the format, read from the media's size. */
.sample-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.sample-pill { min-height: 44px; padding: 0 18px; border: 2px solid var(--fb-violet); border-radius: 999px; font: inherit; font-weight: 600; color: var(--ink); background: var(--panel); cursor: pointer; transition: background 0.15s ease; }
.sample-pill:hover { background: var(--fb-lime); color: var(--fb-night); }
.sample-pill[aria-pressed="true"] { border-color: var(--fb-night); color: #ffffff; background: var(--fb-night); text-decoration: underline; text-underline-offset: 4px; }
.sample-pill:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.home .sample-figure.portrait video, .home .sample-photo img { aspect-ratio: 1 / 1; object-fit: contain; background: var(--fb-night); }
.sample-badge { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 2px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 700; color: #ffffff; background: var(--fb-night); border: 1px solid var(--fb-lime); }

/* On a phone the chips are one row that scrolls sideways, so the box and the chips fit the first screen. */
@media (max-width: 600px) {
  .home .example-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .home .example-chip, .home .more-ideas { flex: 0 0 auto; white-space: nowrap; }
  .home .composer textarea { min-height: 68px; }  /* two lines, so the whole placeholder shows at 390 px */
}

@media (prefers-reduced-motion: reduce) {
  .sample-pill { transition: none; }
  .home .example-chip, .home .home-features li, .home .sample-figure, .home .sample-figure video, .home .sample-figure img { transition: none; transform: none; }
  .home .example-chip:hover, .home .home-features li:hover, .home .sample-figure:hover, .home .sample-figure:hover video, .home .sample-figure:hover img { transform: none; }
}

/* Workspace mode (owner, 2026-11-30): a visitor who is signed in or already has a project gets the chat as an app. The
   html element carries "workspace" (mode.js remembers it, plan.js decides it). Projects sit in a 260 px left column, a
   drawer on a phone; the examples sit above the box until the first message; the box stays at the bottom of the view.
   The homepage's own sections go; the header keeps Samples and Plans. Without the class the homepage is unchanged. */
#ws-side, .ws-toggle { display: none; }
.workspace .home-features, .workspace #home-steps, .workspace:not(.show-samples) #home-samples, .workspace #price-strip,
.workspace #home-credits, .workspace #chat-project, .workspace #your-projects,
.workspace #project-picker, .workspace #project-manage, .workspace .home-hero-lead { display: none; }
.workspace .top-band { margin: 0 -16px; padding: 0 16px; }
.workspace .top-band h1 { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.workspace #chat-main { display: flex; flex-direction: column; max-width: none; min-height: 100vh; min-height: 100dvh; margin: 0; padding: 0 16px; }
.workspace #chat-main > :not(.top-band) { width: 100%; max-width: 48rem; margin-left: auto; margin-right: auto; }
.workspace #thread { flex: 1 0 auto; }
.workspace #thread:empty { flex-grow: 0; }
/* Until plan.js moves the examples into the welcome area, order keeps them there on screen. */
.workspace #example-chips { order: 1; }
.workspace .composer-wrap, .workspace .composer-wrap ~ * { order: 2; }
.workspace .composer-wrap { padding: 8px 0 4px; border-top: 0; }
.workspace .composer-wrap ~ p.small { margin: 0 auto; text-align: center; font-size: 0.8125rem; }

/* Empty: the greeting and the examples sit centred in the room above the box; when they do not fit, they just flow.
   A first visit shows the same welcome and cards above the box, under the headline (owner, 2026-11-30): it shares these
   blocks through :root:not(.workspace), so the workspace itself is unchanged. */
.workspace .welcome, :root:not(.workspace) .welcome { display: flex; flex-direction: column; margin-top: auto; padding: 32px 0 8px; }
.workspace .welcome:has(#example-chips), .workspace #chat-main > #example-chips { margin-bottom: auto; }
.workspace .welcome h2, :root:not(.workspace) .welcome h2 { margin: 0 0 4px; font-size: clamp(1.5rem, 3vw, 2rem); }
.workspace .welcome p, :root:not(.workspace) .welcome p { margin: 0 0 16px; }
.workspace .example-chips, :root:not(.workspace) .welcome .example-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 10px; margin: 0 0 8px; overflow: visible; }
.workspace .example-chip, :root:not(.workspace) .welcome .example-chip { min-height: 64px; padding: 12px 14px; border-radius: 14px; white-space: normal; }
/* Nine examples show in the welcome; More ideas holds the rest, across the whole grid. */
.workspace .more-ideas, :root:not(.workspace) .welcome .more-ideas { grid-column: 1 / -1; }

.workspace #ws-side { display: flex; flex-direction: column; gap: 8px; overflow-x: hidden; padding: 16px 12px; background: var(--panel); border-right: 1px solid var(--line); }
.ws-new { min-height: 44px; border: 2px solid var(--fb-pink); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.ws-new:hover { background: var(--fb-lime); color: var(--fb-night); }
.ws-title { margin: 12px 4px 0; font-size: 0.875rem; color: var(--muted); }
.ws-list { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ws-item { display: flex; flex-direction: column; align-items: stretch; width: 100%; min-height: 44px; padding: 8px 10px; border: 2px solid transparent; border-radius: 10px; background: none; color: var(--ink); font: inherit; line-height: 1.3; text-align: left; cursor: pointer; }
.ws-item:hover { background: var(--bg); }
.ws-item[aria-current="true"] { border-color: var(--fb-pink); background: var(--bg); font-weight: 600; }
.ws-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-status { font-size: 0.8125rem; font-weight: 400; color: var(--muted); }
.ws-manage { align-self: flex-start; min-height: 44px; margin-top: auto; padding: 0 4px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 0.875rem; text-decoration: underline; cursor: pointer; }
.ws-toggle { align-items: center; min-height: 44px; margin-right: 8px; padding: 0 16px; border: 2px solid #ffffff; border-radius: 999px; background: transparent; color: #ffffff; font: inherit; font-weight: 600; cursor: pointer; }
.ws-toggle:focus-visible { outline: 3px solid var(--fb-lime); outline-offset: 2px; }

@media (min-width: 768px) {
  .workspace body { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
  .workspace #ws-side { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
}
/* Phone: the column is a drawer over the page; the dimmed rest of the page is the drawer's outline, so it takes no clicks. */
@media (max-width: 767px) {
  .workspace .ws-toggle { display: inline-flex; }
  .workspace #ws-side { position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(300px, 85vw); overflow-y: auto; visibility: hidden; transform: translateX(-100%); transition: transform 0.2s ease, visibility 0s 0.2s; outline: 100vmax solid rgba(31, 17, 71, 0.55); }
  .workspace #ws-side.open { visibility: visible; transform: none; transition: transform 0.2s ease; }  /* visible at once, so it takes focus */
  .workspace .example-chip { min-height: 44px; padding: 10px 12px; }
  .workspace .welcome { padding-top: 16px; }
}
@media (forced-colors: active) {
  .workspace #ws-side { outline: none; border-right: 2px solid CanvasText; }
  .ws-item[aria-current="true"] { outline: 2px solid Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .workspace #ws-side, .workspace #ws-side.open { transition: none; }
}

/* A first visit (owner, 2026-11-30): the headline, the welcome and its six cards, the box, the price strip, then the
   homepage's sections with room between them. None of these rules reaches the workspace. */
:root:not(.workspace) .home-steps, :root:not(.workspace) .home .home-samples, :root:not(.workspace) .home .home-features { margin-top: 64px; }
/* On a phone the six cards are one row that scrolls sideways and snaps, with the next card's edge in view, so the box
   shows in the first screen. The row reaches the screen's edges inside its own scroller; the page never scrolls
   sideways. More ideas turns the row into a grid of all the cards. */
@media (max-width: 767px) {
  :root:not(.workspace) .home .top-band { padding-bottom: 16px; }
  :root:not(.workspace) .home .top-band h1 { margin: 8px 0 6px; font-size: 1.625rem; }
  :root:not(.workspace) .home-hero-lead { font-size: 0.9375rem; line-height: 1.4; }
  :root:not(.workspace) .welcome { padding: 16px 0 4px; }
  :root:not(.workspace) .welcome h2 { font-size: 1.25rem; }
  :root:not(.workspace) .welcome p { margin-bottom: 8px; }
  :root:not(.workspace) .welcome .example-chips { display: flex; gap: 10px; margin: 0 -16px; padding: 2px 16px 8px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; }
  :root:not(.workspace) .welcome .example-chip { flex: 0 0 74%; min-height: 56px; padding: 10px 12px; scroll-snap-align: start; }
  :root:not(.workspace) .welcome .more-ideas { flex: 0 0 auto; align-self: center; }
  :root:not(.workspace) #example-chips:has(> .more-ideas[open]), :root:not(.workspace) .welcome .more-ideas .example-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0 0 8px; overflow: visible; }
  :root:not(.workspace) .home-steps, :root:not(.workspace) .home .home-samples, :root:not(.workspace) .home .home-features { margin-top: 48px; }
}
