:root {
  --bg: #f3ede4;
  --bg-elevated: rgba(255, 252, 245, 0.76);
  --panel: rgba(255, 250, 240, 0.84);
  --panel-solid: #fff8ee;
  --text: #1f2925;
  --muted: #5a665f;
  --line: rgba(31, 41, 37, 0.09);
  --shadow: 0 22px 50px rgba(43, 54, 42, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 999px;
  --sidebar-width: 320px;
  --content-width: 1380px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(197, 169, 109, 0.16), transparent 34%),
    radial-gradient(circle at 85% 8%, rgba(89, 116, 107, 0.18), transparent 28%),
    linear-gradient(180deg, #f6efe7 0%, #eee4d6 100%);
  color: var(--text);
  font-family: "Instrument Sans", sans-serif;
  line-height: 1.55;
}

body.reader-open {
  overflow: hidden;
}

button {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: auto;
  width: 32rem;
  height: 32rem;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
}

.ambient-left {
  top: -9rem;
  left: -10rem;
  background: #d9b67f;
}

.ambient-right {
  right: -10rem;
  bottom: -8rem;
  background: #7d9589;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(280px, var(--sidebar-width)) minmax(0, 1fr);
  gap: 1.75rem;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.5rem;
}

.sidebar {
  position: sticky;
  top: 1.5rem;
  align-self: start;
}

.sidebar-card,
.hero,
.gallery-status,
.story-card,
.reader-panel,
.prompt-box {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar-card,
.hero,
.gallery-status {
  border-radius: var(--radius-xl);
  padding: 1.4rem;
}

.sidebar-card + .sidebar-card {
  margin-top: 1rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6d5a34;
}

.sidebar h1,
.hero h2,
#reader-title {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  line-height: 0.96;
}

.sidebar h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
}

.hero h2 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  max-width: 13ch;
}

.sidebar-copy,
.hero p,
.sidebar-note p {
  margin: 1rem 0 0;
  color: var(--muted);
}

.sidebar-meta {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.meta-label,
.section-head span,
.gallery-status span,
.story-meta,
.prompt-label,
.copy-feedback {
  color: var(--muted);
  font-size: 0.9rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.section-head h2,
.sidebar-note h2 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-button,
.tag-pill,
.ghost-button {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 41, 37, 0.12);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

.filter-button {
  cursor: pointer;
  padding: 0.78rem 1rem;
}

.filter-button:hover,
.filter-button:focus-visible,
.story-card:hover,
.story-card:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-2px);
}

.filter-button.is-active {
  background: #1f2925;
  border-color: #1f2925;
  color: #f8f3ea;
}

.main-panel {
  min-width: 0;
}

.gallery-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.story-grid {
  column-width: 20rem;
  column-gap: 1.4rem;
  margin-top: 1.4rem;
}

.story-card {
  position: relative;
  display: inline-block;
  width: 100%;
  margin: 0 0 1.4rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  break-inside: avoid;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease;
}

.story-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.story-cover,
.reader-cover {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(var(--card-angle, 145deg), var(--card-start), var(--card-end)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.44), transparent 35%);
}

.story-cover {
  min-height: 15rem;
}

.story-cover::before,
.reader-cover::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  opacity: 0.55;
}

.story-cover::after,
.reader-cover::after {
  content: "Nomad Aesthetic";
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  padding: 0.42rem 0.68rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-card h3 {
  margin: 1rem 0 0.45rem;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  line-height: 0.96;
}

.story-card p {
  margin: 0;
  color: var(--muted);
}

.story-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.story-tags,
.reader-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag-pill {
  padding: 0.42rem 0.75rem;
}

.reader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.reader.is-open {
  opacity: 1;
  pointer-events: auto;
}

.reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 35, 33, 0.55);
}

.reader-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  max-height: min(92vh, 980px);
  overflow: auto;
  border-radius: 30px;
  background: rgba(251, 247, 240, 0.94);
}

.reader-close {
  position: sticky;
  top: 1rem;
  float: right;
  margin: 1rem 1rem 0 0;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(31, 41, 37, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  z-index: 2;
}

.reader-cover {
  min-height: 18rem;
  margin: 1rem;
}

.reader-inner {
  padding: 0 1.4rem 1.6rem;
}

.reader-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

#reader-title {
  font-size: clamp(2.8rem, 6vw, 4.8rem);
  margin-top: 0.4rem;
}

.reader-excerpt {
  margin: 0.8rem 0 0;
  max-width: 46rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.2rem 0 1.4rem;
}

.ghost-button {
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.reader-body {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.38rem, 2vw, 1.6rem);
  line-height: 1.55;
}

.reader-body p {
  margin: 0 0 1.1rem;
}

.prompt-box {
  margin-top: 1.8rem;
  border-radius: 22px;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 252, 245, 0.8);
}

.prompt-box p:last-child {
  margin-bottom: 0;
}

.prompt-label {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 1rem;
    gap: 1rem;
  }

  .sidebar-card,
  .hero,
  .gallery-status,
  .story-card {
    border-radius: 22px;
  }

  .gallery-status,
  .reader-meta,
  .reader-actions {
    flex-direction: column;
    align-items: start;
  }

  .story-grid {
    column-width: 100%;
  }

  .reader {
    padding: 0.4rem;
  }

  .reader-panel {
    border-radius: 22px;
  }

  .reader-cover {
    min-height: 13rem;
  }
}
