/* The home page's interactive demo (media/demo.js). Plain CSS: the Tailwind build only sees
   classes written in the Rust sources, and the script builds most of this markup. Colors are
   the site's tokens (styles.css). */

.wd-bleed {
  position: relative;
  left: 50%;
  translate: -50% 0;
  /* Wider than the page column, and short enough that the display and its controls fit a
     laptop screen. */
  width: min(calc(100vw - 2rem), 76rem, calc((100svh - 15rem) * 2));
  min-width: min(calc(100vw - 2rem), 40rem);
}

.wd {
  border: 1px solid #262a31;
  border-radius: 1.1rem;
  background: #15171b;
  box-shadow: 0 30px 120px #0008;
  padding: 0.6rem;
}

.wd-screen {
  position: relative;
  aspect-ratio: 2 / 1;
  border-radius: 0.7rem;
  overflow: hidden;
  background:
    radial-gradient(110% 90% at 12% 0%, #1c2a46 0%, transparent 55%),
    radial-gradient(90% 80% at 95% 100%, #2b1d40 0%, transparent 60%),
    #0d0f13;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.wd-screen:focus-visible {
  box-shadow: 0 0 0 3px #d5dce6;
}
.wd[data-layout="scrolling"] .wd-screen { cursor: grab; }
.wd-screen.is-dragging { cursor: grabbing; }
.wd-fallback { display: block; width: 100%; height: 100%; object-fit: cover; }

.wd-menubar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 1.1em;
  padding: 0 0.9em;
  font-size: 11px;
  color: #c9ced6;
  background: #0b0c0ebb;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.wd-menu-app { color: #e8eaed; font-weight: 700; }
.wd-menu-right { margin-left: auto; display: flex; align-items: center; gap: 0.8em; font-weight: 600; }
.wd-menu-right img { width: 15px; height: 15px; border-radius: 4px; }

.wd-layer { position: absolute; inset: 0; }

.wd-win {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #2b3038;
  border-radius: 9px;
  background: #1a1d22;
  box-shadow: 0 12px 34px #0007;
  cursor: pointer;
  will-change: transform, width, height, opacity;
}
.wd-win.is-focus {
  border-color: #d5dce6;
  box-shadow: 0 0 0 1px #d5dce6, 0 0 26px #d5dce633, 0 12px 34px #0007;
}
.wd[data-layout="scrolling"] .wd-win { cursor: inherit; }

.wd-title {
  position: relative;
  flex: none;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-bottom: 1px solid #262a31;
  background: #1f2329;
  font-size: 11px;
  color: #9aa1ab;
}
.wd-title span {
  position: absolute;
  inset: 0 40px;
  overflow: hidden;
  text-align: center;
  line-height: 22px;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
  pointer-events: none;
}
.wd-win.is-focus .wd-title span { color: #e8eaed; }
.wd-dot {
  position: relative;
  flex: none;
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #3a404a;
}
.wd-win.is-focus .wd-dot { background: #febc2e; }
.wd-win.is-focus .wd-dot:nth-child(3) { background: #28c840; }
.wd-close { cursor: pointer; }
.wd-win.is-focus .wd-close, .wd-close:hover { background: #ff5f57; }
.wd-close::after { content: ""; position: absolute; inset: -7px; }
.wd-close[hidden] { display: block; visibility: hidden; }

/* Window contents: abstract, so they stay legible at any size. */
.wd-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
  padding: 10px;
}
.wd-l {
  flex: none;
  width: var(--w, 70%);
  height: 6px;
  margin-left: var(--x, 0);
  border-radius: 3px;
  background: #2a2f38;
}
.wd-l.a { background: var(--c); opacity: 0.6; }
.wd-l.k { background: #c792ea; opacity: 0.55; }
.wd-l.s { background: #c3e88d; opacity: 0.45; }
.wd-gap { flex: none; height: 4px; }

.wd-url { flex: none; height: 14px; border-radius: 7px; background: #23272e; }
.wd-hero {
  flex: none;
  height: 26%;
  border-radius: 7px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 50%, transparent), color-mix(in srgb, var(--c) 8%, transparent));
}
.wd-cards { flex: none; display: flex; gap: 7px; height: 16%; }
.wd-cards i { flex: 1; border-radius: 6px; background: #23272e; }

.wd-editor { flex-direction: row; gap: 0; padding: 0; }
.wd-side {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 22%;
  max-width: 96px;
  padding: 10px 8px;
  border-right: 1px solid #262a31;
  background: #16181c;
}
.wd-side i { height: 5px; border-radius: 3px; background: #2a2f38; }
.wd-side i:nth-child(2) { background: var(--c); opacity: 0.5; }
.wd-code { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 10px; }

.wd-h { flex: none; width: 46%; height: 11px; border-radius: 4px; background: var(--c); opacity: 0.75; }
.wd-notes { background: #1c1b17; }

.wd-mail { gap: 0; padding: 0; }
.wd-mrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #23272e; }
.wd-mrow.is-on { background: color-mix(in srgb, var(--c) 14%, transparent); }
.wd-mrow b { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--c); opacity: 0.5; }
.wd-mrow span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }

.wd-terminal {
  gap: 2px;
  background: #0e1013;
  font: 10.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #7ee2a0;
  white-space: nowrap;
}
.wd-terminal p { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.wd-terminal .dim { color: #6b727c; }
.wd-caret { display: inline-block; width: 6px; height: 11px; vertical-align: -1px; background: #7ee2a0; animation: wd-blink 1.1s steps(1) infinite; }

.wd-chat { justify-content: flex-end; }
.wd-bub { flex: none; width: var(--w); height: 16px; border-radius: 9px; background: #262a31; }
.wd-bub.me { align-self: flex-end; background: var(--c); opacity: 0.6; }
.wd-type { flex: none; height: 20px; margin-top: 4px; border-radius: 10px; border: 1px solid #2b3038; }

.wd-grid { flex: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.wd-grid i { aspect-ratio: 4 / 3; border-radius: 3px; background: #1f2329; }
.wd-grid i.on { background: var(--c); opacity: 0.5; }

.wd-art { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; align-content: start; overflow: hidden; }
.wd-art i { aspect-ratio: 1; border-radius: 6px; background: linear-gradient(135deg, var(--c), #4c8dff); opacity: 0.5; }
.wd-art i:nth-child(2n) { filter: hue-rotate(70deg); }
.wd-art i:nth-child(3n) { filter: hue-rotate(160deg); }
.wd-player { flex: none; height: 16px; border-radius: 8px; background: #262a31; }

/* The hint on the display, until someone drags or swipes. */
.wd-hint {
  position: absolute;
  left: 50%;
  bottom: 7%;
  z-index: 4;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55em 1.05em;
  border: 1px solid #3a404a;
  border-radius: 999px;
  background: #0b0c0ee8;
  box-shadow: 0 10px 30px #0009;
  color: #e8eaed;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s, translate 0.3s;
}
.wd-hint.is-gone, .wd:not([data-layout="scrolling"]) .wd-hint { opacity: 0; translate: -50% 8px; }
.wd-fingers { position: relative; display: flex; gap: 3px; animation: wd-swipe 1.6s ease-in-out infinite; }
.wd-fingers i { width: 7px; height: 7px; border-radius: 50%; background: #e8eaed; }

@keyframes wd-swipe { 0%, 100% { transform: translateX(6px); } 50% { transform: translateX(-6px); } }
@keyframes wd-blink { 50% { opacity: 0; } }

/* The strip in miniature, under the display. */
.wd-mini { position: relative; height: 12px; margin: 0.6rem 0.25rem 0; cursor: pointer; }
.wd-mini i { position: absolute; top: 3px; height: 6px; border-radius: 3px; background: var(--c); opacity: 0.4; }
.wd-mini i.is-focus { opacity: 0.95; }
.wd-mini-view { position: absolute; top: 0; height: 12px; border: 1.5px solid #d5dce6; border-radius: 6px; pointer-events: none; }
.wd:not([data-layout="scrolling"]) .wd-mini { visibility: hidden; }

.wd-controls { display: grid; gap: 0.75rem; padding: 0.75rem 0.3rem 0.3rem; }
.wd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
:where(.wd) button { font: inherit; }
.wd button:focus-visible { outline: 3px solid #d5dce6; outline-offset: 2px; }

.wd-seg { display: flex; gap: 0.2rem; padding: 0.22rem; border: 1px solid #262a31; border-radius: 0.75rem; background: #0b0c0e; }
.wd-seg button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  border: 0;
  border-radius: 0.55rem;
  background: none;
  color: #9aa1ab;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}
.wd-seg button:hover { color: #e8eaed; }
.wd-seg button[aria-pressed="true"] { background: #262a31; color: #e8eaed; }
.wd-seg svg { flex: none; width: 24px; height: 12px; fill: currentColor; }
.wd-seg em {
  padding: 0.08rem 0.32rem;
  border: 1px solid #3a404a;
  border-radius: 0.3rem;
  color: #9aa1ab;
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wd-widths { display: flex; align-items: center; gap: 0.2rem; margin-left: auto; color: #9aa1ab; font-size: 0.8rem; font-weight: 650; }
.wd-widths span { margin-right: 0.3rem; }
.wd-widths button {
  min-width: 2.4rem;
  min-height: 2.4rem;
  border: 1px solid #262a31;
  border-radius: 0.55rem;
  background: #0b0c0e;
  color: #9aa1ab;
  font-size: 0.95rem;
  font-weight: 650;
  cursor: pointer;
}
.wd-widths button:hover { color: #e8eaed; }
.wd-widths button[aria-pressed="true"] { border-color: #d5dce6; color: #e8eaed; }
.wd:not([data-layout="scrolling"]) .wd-widths { display: none; }

.wd-add {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.95rem;
  border: 1px solid #3a404a;
  border-radius: 0.65rem;
  background: #262a31;
  color: #e8eaed;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}
.wd-add:hover { border-color: #9aa1ab; }
.wd-add:disabled { opacity: 0.5; cursor: default; }
.wd-add svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.wd:not([data-layout="scrolling"]) .wd-add { margin-left: auto; }

.wd-windows { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.wd-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.2rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid #262a31;
  border-radius: 0.55rem;
  background: #0b0c0e;
  color: #e8eaed;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.wd-chip:hover { border-color: #3a404a; }
.wd-chip i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--c); }
.wd-chip.is-off { color: #9aa1ab; }
.wd-chip.is-off i { opacity: 0.5; }
.wd-chip[aria-pressed="true"] { border-color: #d5dce6; }
.wd-chip small { color: #9aa1ab; font-size: 0.68rem; font-weight: 650; }

.wd-tip { margin: 0; color: #9aa1ab; font-size: 0.82rem; line-height: 1.55; }
.wd-reset { padding: 0; border: 0; background: none; color: #9aa1ab; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.wd-reset:hover { color: #e8eaed; }
.wd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1023px) {
  .wd-screen { aspect-ratio: 16 / 10; }
}

@media (max-width: 639px) {
  .wd { padding: 0.4rem; border-radius: 0.9rem; }
  .wd-screen { aspect-ratio: 4 / 3; border-radius: 0.6rem; }
  .wd-menubar > span:not(.wd-menu-right) { display: none; }
  .wd-hint { font-size: 12px; }
  .wd-seg { width: 100%; }
  .wd-seg button { flex: 1; justify-content: center; padding: 0.35rem 0.4rem; }
  .wd-seg svg { display: none; }
  .wd-widths { margin-left: 0; }
  .wd-windows { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -0.3rem; padding: 0 0.3rem; }
  .wd-body { padding: 7px; gap: 5px; }
  .wd-terminal { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .wd-fingers, .wd-caret { animation: none; }
  .wd-hint { transition: none; }
}
