/* Owns design tokens, base accessibility, shell layout and feed foundations. Import order preserves the existing cascade. */
:root {
  color-scheme: light;
  --shell-height: 60px;
  --radius-card: 24px;
  --radius-control: 12px;
  --radius-navigation: 20px;
  --radius-segment: 14px;
  --radius-toolbar: 16px;
  --radius-group: 18px;
  --section-space: 48px;
  --choice-gap: 8px;
  --compact-choice-gap: 4px;
  --content-width: 1100px;
  --bg: #f4f5f8;
  --surface: #fff;
  --ink: #141416;
  --muted: #596273;
  --line: #e0e3e9;
  --control-line: #8591a3;
  --accent: #0057ff;
  --on-accent: #fff;
  --neutral: #eceef3;
  --violet: #703cff;
  --pink: #e00075;
  --focus: #0057ff;
  --shadow: 0 8px 30px #00000008;
  --selection-bg: var(--ink);
  --selection-ink: var(--surface);
  --hover-surface: color-mix(in srgb, var(--ink) 5%, var(--surface));
  --navigation-width: 232px;
  --dock-width: 64px;
  --space-control: 8px;
  --content-inset: 16px;
  --control-highlight: rgba(255, 255, 255, 0.72);
  --control-shadow: 0 5px 16px #15213a20;
  --glass: rgba(255, 255, 255, 0.82);
  --story-bg: #111;
  --story-ink: #fff;
  --game-ink: #f8f4ed;
  --game-muted: #b9c5d1;
  --game-night: #102b38;
  --game-glass: #ffffff0d;
  --game-line: #ffffff28;
  --game-neutral: #294959;
  --game-colour-0: #00d9b0;
  --game-colour-1: #ff5b47;
  --game-colour-2: #b75cff;
  --game-colour-3: #ffce32;
  --game-colour-4: #00baff;
  --game-colour-5: #ff4fa0;
  --game-colour-6: #a6f52e;
  --game-colour-7: #ff961f;
  --bob-turquoise: #26d5ce;
  --bob-coral: #ff735c;
  --bob-sunshine: #ffda55;
  --bob-deep-teal: #123e4a;
  --bob-ocean: #216174;
  --bob-cream: #fff9e9;
  --craft-night: #072637;
  --craft-cyan: #9cfff4;
  --craft-gold: #ffe297;
  --craft-white: #f2fffb;
  --craft-blue: #27517d;
  --craft-aqua: #34c7cf;
  --craft-plum: #291736;
  --craft-rose: #ff83bd;
  --craft-brass: #d3b67a;
  --craft-glass: color-mix(in srgb, var(--craft-night) 93%, transparent);
  --craft-line: color-mix(in srgb, var(--craft-cyan) 40%, transparent);
  --craft-shadow: color-mix(in srgb, var(--craft-night) 74%, transparent);
  --brook-wood: #a7683b;
  --brook-wood-light: #ffd49a;
  --brook-wood-dark: #482918;
  --arcade-night: #171335;
  --arcade-neutral: #30245c;
  --arcade-colour-0: #16f79a;
  --arcade-colour-1: #ff393f;
  --arcade-colour-2: #bb55ff;
  --arcade-colour-3: #fff02e;
  --arcade-colour-4: #20ddff;
  --arcade-colour-5: #ff3bb7;
  --orchard-ink: #253867;
  --orchard-muted: #44567b;
  --orchard-panel: #f4fbff;
  --orchard-tile-light: #bfe6ff;
  --orchard-tile-deep: #92c9f3;
  --orchard-frame: #5363c5;
  --orchard-sun: #ffdc62;
  --orchard-leaf: #3bd5af;
  --orchard-apple: #ff725c;
  --orchard-blossom: #9b91f3;
  --orchard-acorn: #f1b647;
  --orchard-dewdrop: #42bcec;
  --orchard-berries: #e76eaa;
  --game-paper: #f5eddd;
  --game-paper-ink: #243d49;
  --game-paper-muted: #526572;
  --game-pond: #123f50;
  --game-wood: #bf8e63;
  --game-sky: #9ad9ef;
  --game-soil: #335949;
  --game-success: #85e6bd;
  --game-shadow: #071b29aa;
  --game-white: #ffffff;
  --story-muted: #ddd;
  --story-track: #ffffff45;
  --story-control: #ffffff15;
  --story-line: #ffffff35;
  --story-overlay: #000d;
  --story-status: #000b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  min-height: 44px;
  color: inherit;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

button,
a,
input {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.skip {
  position: absolute;
  left: 20px;
  top: -100px;
  background: var(--surface);
  padding: 12px;
  z-index: 10;
}

.skip:focus {
  top: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 max(24px, 4vw);
  background: var(--surface);
  gap: 24px;
}

.brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  width: 40px;
  height: 40px;
  font-family: inherit;
  font-size: 31px;
  font-style: normal;
}

.brand-dot {
  color: var(--accent);
  margin-left: -12px;
}

.global-search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  max-width: 420px;
  flex: 1;
  margin: 0 24px;
}

.global-search input {
  border: 0;
  background: transparent;
  min-width: 0;
  padding: 10px 18px;
  width: 100%;
  font-size: 13px;
}

.global-search button {
  border: 0;
  background: transparent;
  padding: 0 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions .text-button {
  font-size: 12px;
}

.demo-badge {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  background: var(--neutral);
  border-radius: 7px;
  padding: 5px 9px;
}

.avatar {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--neutral);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  border: 0;
}

.avatar.large {
  width: 90px;
  height: 90px;
  font-size: 29px;
  border: 5px solid var(--surface);
}

.avatar.color-1 {
  background: var(--violet);
}

.avatar.color-2 {
  background: var(--pink);
}

.layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 660px) 260px;
  max-width: 1290px;
  margin: 0 auto;
  padding: 40px 32px;
}

.left-rail {
  padding-top: 10px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 2px;
  color: var(--muted);
}

.rail-title {
  font-family: inherit;
  line-height: 1.3;
  margin: 20px 0 25px;
}

.left-rail nav {
  display: grid;
  gap: 5px;
}

.left-rail nav a {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 10px;
  min-height: 44px;
}

.left-rail nav a > span {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.left-rail nav a.active {
  background: var(--neutral);
  font-weight: 650;
}

.left-rail nav small {
  margin-left: auto;
  background: var(--surface);
  border-radius: 8px;
  min-width: 20px;
  text-align: center;
  font-size: 10px;
}

.left-rail .primary-button {
  font-size: 12px;
  margin-top: 25px;
  width: 100%;
}

.rail-note {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 40px;
}

.welcome {
  padding: 28px 32px;
  background: var(--neutral);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}

.welcome h1 {
  font-family: inherit;
  margin: 15px 0;
}

.welcome p {
  margin: 0;
}

.hero-orbit {
  position: absolute;
  right: -64px;
  width: 185px;
  height: 185px;
  transform: rotate(-18deg);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.hero-orbit:before,
.hero-orbit:after {
  content: '';
  position: absolute;
  inset: 0;
  border: inherit;
  border-radius: inherit;
  transform: translateX(24px);
}

.hero-orbit:after {
  transform: translateX(-24px);
}

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 14px;
}

h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.subtle {
  font-size: 12px;
  color: var(--muted);
}

.page-title {
  font-family: inherit;
  line-height: 1.2;
  margin: 10px 0;
}

.page-intro {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 25px;
}

.stories {
  display: flex;
  overflow-x: auto;
  padding: 4px 2px 16px;
  scrollbar-width: thin;
}

.story-button {
  padding: 0;
  background: none;
  border: 0;
  flex: 0 0 72px;
  text-align: center;
}

.story-cover {
  height: 72px;
  width: 72px;
  object-fit: cover;
  border: 3px solid var(--surface);
  outline: 2px solid var(--accent);
  display: block;
}

.story-add {
  height: 72px;
  width: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--neutral);
  font-size: 29px;
  border: 1px dashed var(--accent);
}

.story-name {
  font-size: 11px;
  display: block;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-trigger {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  width: 100%;
  text-align: left;
}

.composer-trigger > span:nth-child(2) {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}

.composer-trigger > span:last-child {
  font-size: 11px;
  color: var(--accent);
}

.feed-controls {
  padding: 4px 0 15px;
}

.modes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modes button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  font-size: 12px;
  padding: 8px 14px;
}

.modes button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.mode-description {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-description p {
  color: var(--muted);
  max-width: 410px;
}

.text-button {
  border: 0;
  background: transparent;
  font-size: 12px;
  padding: 5px 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  flex-shrink: 0;
}

.primary-button,
.secondary-button {
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.icon-button {
  background: transparent;
  border: 0;
  font-size: 23px;
  min-width: 44px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.empty-state {
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.post {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.post-header {
  display: flex;
  align-items: center;
  padding: 19px 22px 0;
}

.post-identity {
  flex: 1;
  min-width: 0;
}

.post-author {
  font-size: 14px;
  display: block;
  text-decoration: none;
}

.post-meta {
  color: var(--muted);
  font-size: 11px;
  display: block;
}

.tone-tag {
  font-size: 10px;
  background: var(--neutral);
  padding: 4px 9px;
  border-radius: 20px;
}

/* Anonymous landing, pack and reading surfaces reuse the application's token owner. */
.public-discovery {
  background: var(--bg);
  color: var(--ink);
}
.public-discovery main,
.public-header,
.public-footer {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding: var(--content-inset);
  padding-left: max(var(--content-inset), env(safe-area-inset-left));
  padding-right: max(var(--content-inset), env(safe-area-inset-right));
}
.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--content-inset);
  min-height: 88px;
}
.public-discovery .brand {
  color: var(--ink);
  font-size: 24px;
  letter-spacing: -1px;
}
.public-discovery .brand-mark {
  border-radius: var(--radius-control);
  background: linear-gradient(135deg, var(--accent), var(--violet));
  flex-shrink: 0;
}
.public-discovery nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--content-inset);
}
.public-discovery a {
  color: var(--accent);
  text-underline-offset: 4px;
}
.public-discovery a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
.public-discovery .public-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--content-inset);
  min-height: 48px;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 600;
}
.public-discovery .public-button-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.public-discovery .public-browse {
  padding: var(--choice-gap);
  color: var(--muted);
  text-decoration: none;
}
.public-discovery h1,
.public-discovery h2,
.public-discovery h3 {
  letter-spacing: -0.04em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.public-discovery h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}
.public-discovery h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.public-discovery p {
  max-width: 72ch;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.public-hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--content-inset);
  padding: calc(var(--content-inset) * 2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.public-hero-copy {
  padding: var(--content-inset) 0;
}
.public-hero h1 {
  font-size: clamp(3rem, 6vw, 4.7rem);
  line-height: 1.02;
  margin: 20px 0;
}
.public-blue {
  color: var(--accent);
}
.public-eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.public-hero-copy > p {
  max-width: 42ch;
  color: var(--muted);
  margin: 0 0 24px;
}
.public-note {
  display: block;
  margin-top: var(--content-inset);
  color: var(--muted);
  font-size: 13px;
}
.public-hero-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--choice-gap);
  min-height: 360px;
}
.public-hero-images a {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--neutral);
}
.public-hero-images a:first-child {
  grid-row: span 2;
}
.public-hero-images a:only-child {
  grid-column: span 2;
}
.public-discovery img {
  display: block;
  width: 100%;
  height: auto;
}
.public-hero-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.public-hero-images span {
  position: absolute;
  inset: auto var(--choice-gap) var(--choice-gap);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: var(--choice-gap);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
}
.public-library-section {
  margin-block: var(--section-space);
  scroll-margin-top: var(--content-inset);
}
.public-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--content-inset);
}
.public-section-heading h2 {
  margin: var(--choice-gap) 0 0;
}
.public-section-heading > a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.public-library-section > p {
  color: var(--muted);
}
.public-pack-grid,
.public-article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--content-inset);
  list-style: none;
  margin: 24px 0;
  padding: 0;
}
.public-pack-grid li,
.public-article-grid li {
  min-width: 0;
}
.public-discovery .public-pack-card,
.public-article-grid a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
}
.public-pack-card:hover,
.public-article-grid a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.public-pack-card > img,
.public-article-grid img {
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  background: var(--surface);
}
.public-course-grid .public-pack-card > img {
  object-fit: contain;
  padding: var(--choice-gap);
}
.public-card-copy {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.public-card-copy h3 {
  margin: 10px 0;
  font-size: 21px;
}
.public-card-copy p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
}
.public-card-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--choice-gap);
  margin-top: auto;
  font-size: 13px;
  color: var(--accent);
}
.public-cover-placeholder {
  display: grid;
  place-content: center;
  aspect-ratio: 4 / 3;
  background: var(--neutral);
  color: var(--accent);
  font-size: 48px;
  font-weight: 650;
  text-align: center;
}
.public-cover-placeholder span {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.public-join {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.public-join h2 {
  margin-top: 0;
}
.public-join p {
  margin-bottom: 0;
  color: var(--muted);
}
.public-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding-block: var(--section-space);
  font-size: 13px;
}
.public-footer p {
  color: var(--muted);
}
.public-footer nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}
.public-page-heading {
  padding-block: 24px;
}
.public-back {
  display: inline-block;
  min-height: 44px;
  padding-block: var(--choice-gap);
}
.public-article-grid h2,
.public-article-grid .public-card-meta {
  padding: 0 20px;
}
.public-article-grid h2 {
  font-size: 21px;
}
.public-article-grid .public-card-meta {
  padding-bottom: 20px;
}
.public-reading {
  max-width: 800px;
  padding: 32px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.public-reading > img {
  border-radius: var(--radius-control);
  max-height: 640px;
  object-fit: contain;
}
.public-skip {
  position: absolute;
  left: var(--content-inset);
  top: -100px;
  z-index: 10;
  padding: var(--content-inset);
  background: var(--surface);
}
.public-skip:focus {
  top: var(--content-inset);
}
@media (max-width: 800px) {
  .public-hero {
    grid-template-columns: 1fr;
  }
  .public-hero-images {
    min-height: 280px;
    max-height: 360px;
  }
  .public-pack-grid,
  .public-article-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .public-header {
    gap: var(--choice-gap);
  }
  .public-discovery .brand {
    font-size: 20px;
    gap: var(--choice-gap);
  }
  .public-discovery .brand-dot {
    margin-left: -8px;
  }
  .public-header .brand-mark {
    width: 32px;
    height: 32px;
  }
  .public-header .public-button {
    padding-inline: 10px;
    font-size: 13px;
  }
  .public-discovery .public-browse {
    display: none;
  }
  .public-hero,
  .public-reading,
  .public-join {
    padding: 20px;
  }
  .public-pack-grid,
  .public-article-grid {
    grid-template-columns: 1fr;
  }
  .public-hero h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }
  .public-hero-images {
    min-height: 240px;
  }
}
