:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #edf1f5;
  background: #0d141d;
  --fade-duration: 425ms;
  --fade-easing: cubic-bezier(.4, 0, .2, 1);
  --card-radius: 12px;
  --card-gap: clamp(1rem, 1.7vw, 1.75rem);
  --page-gutter: clamp(1rem, 3.5vw, 4rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 50% 24rem, #17354d40, transparent 65rem),
    radial-gradient(ellipse at 92% 0, #20344738, transparent 40rem);
}
a { color: #a6d9ff; }
button { font: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid #91d4ff; outline-offset: 5px; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 1rem; left: 1rem; z-index: 20; padding: 1rem; background: #0d141d; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #ffffff12;
  background: #0d141ded;
  backdrop-filter: blur(18px);
}
.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 5.75rem;
  max-width: 120rem;
  margin-inline: auto;
  padding: .9rem var(--page-gutter);
}
.wordmark { display: inline-flex; align-items: center; gap: .65rem; color: inherit; font-size: 1.5rem; font-weight: 650; letter-spacing: -.075em; text-decoration: none; }
.wordmark-dot { color: #8ac1e8; }
.brand-mark { display: grid; place-items: center; width: 1.75rem; height: 2rem; padding-bottom: .1rem; border: 1px solid #b6cde065; border-radius: .35rem; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 400; transform: rotate(-9deg); }
.toolbar-note { margin-right: auto; margin-left: 1.25rem; color: #8396a6; font-size: .75rem; letter-spacing: .015em; }
.toolbar-actions { display: flex; align-items: center; gap: .65rem; }
.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: .65rem;
  min-height: 2.9rem;
  padding: .65rem 1.2rem;
  border: 1px solid #bbd8ed;
  border-radius: .65rem .2rem .65rem .2rem;
  background-color: #c8dcec;
  background-image: linear-gradient(140deg, #ffffff55, transparent);
  color: #183044;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 18px #69b8fa12, inset 0 0 0 2px #ffffff25;
  transition: box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
}
.control-button:active:not(:disabled):not([aria-disabled="true"]) { background-color: #accce3; }
.control-button:disabled { cursor: default; opacity: .55; }
.control-button[aria-disabled="true"] { cursor: progress; }
.interaction-button { color: #d4e9fa; background-color: #183348; background-image: linear-gradient(140deg, #96cfff0d, transparent); border-color: #6288a3; }
.interaction-button[aria-pressed="true"] { background-color: #285b7d; border-color: #a6d9ff; box-shadow: 0 0 16px #66baff26, inset 0 0 12px #91d4ff15; }
.interaction-button:active:not(:disabled):not([aria-disabled="true"]) { background-color: #326b8f; }
@media (hover: hover) and (pointer: fine) {
  .control-button:hover:not(:disabled):not([aria-disabled="true"]) { background-color: #e0f1fe; border-color: #d4edff; box-shadow: 0 0 24px #66baff38, inset 0 0 10px #91d4ff55; }
  .interaction-button:hover:not(:disabled):not([aria-disabled="true"]) { background-color: #285575; }
}
.warp-icon, .shield-icon { width: 1.5rem; height: 1.5rem; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.warp-crystal { fill: #4b9cc329; }
.shield-core { fill: #8bcfff25; }
.interaction-button[aria-pressed="true"] .shield-core { fill: #a6d9ff99; }
.shuffle-button[aria-disabled="true"] .warp-icon { animation: warp-turn .9s ease-in-out infinite; }
@keyframes warp-turn { to { transform: rotate(180deg); } }

.demo { max-width: 120rem; margin-inline: auto; padding: 0 var(--page-gutter) 2rem; }
.intro { padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(2rem, 4vw, 3.5rem); }
.eyebrow { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; color: #9bb6cc; font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow > span { width: .3rem; height: .3rem; background: #a6d9ff; box-shadow: 0 0 10px #72baff80; transform: rotate(45deg); }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.6rem); font-weight: 500; letter-spacing: -.055em; line-height: 1.1; }
h1 > span { color: #7eaccb; }
.description { margin: .9rem 0 0; color: #99a6b3; font-size: .9rem; line-height: 1.6; }
.feed-message { margin: 0 0 2rem; color: #a9bac8; line-height: 1.7; }
.card-stage {
  --surface-opacity: 1;
  --frame-opacity: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  align-items: start;
  gap: var(--card-gap);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-anchor: none;
  /* Progressive enhancement for browsers using the CSS-order fallback. */
  reading-flow: grid-rows;
}
.card-stage.is-masonry { position: relative; display: block; }
.card-stage.is-masonry > .post-card {
  position: absolute;
  top: var(--card-y, 0px);
  left: var(--card-x, 0px);
  width: var(--column-width);
  max-width: none;
}
.card-stage:focus { outline: none; }
.card-stage.is-faded { --surface-opacity: 0; --frame-opacity: 1; }
.post-card { min-width: 0; width: 100%; max-width: 550px; justify-self: center; }
.card-shell { position: relative; isolation: isolate; border-radius: var(--card-radius); }
/* Each light frame follows its native embed's actual height and width. */
.card-shell::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  border: 1px solid #a6d9ffcc;
  border-radius: inherit;
  background: linear-gradient(145deg, #2f659519, #0d141d00 55%, #2f65950d);
  box-shadow: 0 0 8px #75bdff38, 0 0 28px #308deb26,
    inset 0 0 10px #6ebaff30, inset 0 0 42px #2079d62b;
  opacity: var(--frame-opacity);
  pointer-events: none;
  transition: opacity var(--fade-duration) var(--fade-easing);
}
.card-surface {
  position: relative;
  z-index: 1;
  border-radius: inherit;
  opacity: var(--surface-opacity);
  transition: opacity var(--fade-duration) var(--fade-easing);
}
.card-surface[inert] { pointer-events: none; user-select: none; }
@media (min-width: 701px) and (pointer: fine) {
  .demo { cursor: grab; }
  .card-stage[data-interactive="true"] .post-card { cursor: auto; }
  body.is-grabbing, body.is-grabbing * { cursor: grabbing !important; user-select: none !important; }
}
.embed-mount { width: 100%; min-width: 0; overflow: hidden; border-radius: var(--card-radius); color-scheme: light; }
.embed-mount iframe { display: block; width: 100%; border: 0; }
/* Some Mastodon servers use dark text on a transparent embed canvas. */
.post-card[data-network="mastodon"] .embed-mount { background-color: #fff; }
.embed-mount .twitter-tweet { width: 100% !important; max-width: 100% !important; margin: 0 !important; }
.post-card:not([data-state="ready"]) .embed-mount { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.post-card[data-state="ready"] .embed-placeholder { display: none; }
.embed-placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  min-height: 20rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border: 1px solid #9abed329;
  border-radius: var(--card-radius);
  background: linear-gradient(145deg, #182a3a, #111d29);
}
.placeholder-network { color: #b4c9d9; font-size: .75rem; }
.placeholder-lines { width: 100%; height: 4rem; background: linear-gradient(#94b2c41a 0 0) 0 0 / 65% 7px no-repeat, linear-gradient(#94b2c412 0 0) 0 24px / 100% 7px no-repeat, linear-gradient(#94b2c412 0 0) 0 48px / 84% 7px no-repeat; }
.placeholder-message { margin: 0; color: #8da4b7; font-size: .8rem; line-height: 1.5; }
.original-link { font-size: .8rem; text-underline-offset: .25em; }
.post-card[data-state="unavailable"] .placeholder-lines { display: none; }
/* Threads doesn't consistently report a new height after a width change.
   A stable inner viewport keeps its native content and videos uncropped. */
.post-card[data-network="threads"] .embed-mount { height: calc(var(--embed-height, 400px) * var(--embed-scale, 1)); }
.post-card[data-network="threads"] iframe { width: 384px; height: var(--embed-height, 400px); transform: scale(var(--embed-scale, 1)); transform-origin: top left; }
.site-footer { display: flex; align-items: center; justify-content: center; gap: .65rem; margin-top: 3rem; padding-block: 1rem; color: #7f94a6; font-size: .72rem; text-align: center; }
.footer-spark { color: #8fbbdb; font-size: 1.2rem; }

@media (max-width: 700px) {
  :root { --page-gutter: 1rem; --card-gap: 1.5rem; --fade-duration: 325ms; }
  .toolbar { transition: transform 220ms ease; }
  .toolbar.is-hidden:not(:has(:focus-visible)) { transform: translateY(-105%); }
  .toolbar-inner { min-height: 4.5rem; gap: 1rem; }
  .toolbar-note { display: none; }
  .wordmark { font-size: 1.35rem; }
  .toolbar-actions { gap: .5rem; }
  .control-button { min-height: 2.75rem; padding: .6rem .85rem; }
  .interaction-button { min-width: 2.75rem; padding: .6rem; }
  .interaction-button .control-label { display: none; }
  .intro { max-width: 550px; margin-inline: auto; padding-block: 2.25rem 1.75rem; }
  .eyebrow { font-size: .56rem; }
  h1 { max-width: 15ch; font-size: clamp(2rem, 7.5vw, 2.8rem); }
  .description { max-width: 28ch; font-size: .82rem; }
  .card-stage { grid-template-columns: minmax(0, 1fr); max-width: 550px; margin-inline: auto; }
  .site-footer { margin-top: 2rem; font-size: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --fade-duration: 0ms; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
