:root {
  --ink: #18151b;
  --muted: #716b75;
  --paper: #f7f1e5;
  --surface: #fffdf8;
  --chrome: #ededE8;
  --line: #c9c5c8;
  --strong-line: #242027;
  --acid: #d7ff3f;
  --pink: #ff73a8;
  --cyan: #58d6ed;
  --violet: #8064f4;
  --danger: #c92d55;
  --shadow: 5px 5px 0 #18151b;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: #deded8;
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

body,
button,
input,
textarea,
select {
  font: 14px/1.35 Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
.button-link {
  min-height: 36px;
  border: 1px solid var(--strong-line);
  border-radius: 4px;
  background: var(--acid);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

button {
  padding: 0 12px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}

button:hover:not(:disabled),
.button-link:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.quiet-button {
  background: #fff;
  border-color: var(--line);
}

.icon-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  font-size: 20px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #aaa5aa;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: #514b53;
  font-size: 12px;
  font-weight: 800;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--pink);
}

.marketing-header,
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--strong-line);
}

.marketing-header nav,
.site-header nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 800;
}

.marketing-header nav form,
.site-header nav form,
.studio-logout {
  display: contents;
  margin: 0;
}

.nav-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: underline;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  background: var(--acid);
  border: 1px solid var(--strong-line);
  border-radius: 4px;
  text-decoration: none;
}

/* Landing */

.landing-body {
  background: var(--surface);
}

.landing-shell {
  min-height: 100vh;
}

.landing-hero {
  position: relative;
  display: grid;
  min-height: max(520px, calc(100svh - 196px));
  overflow: hidden;
  background: #17171a url("/assets/hero-zines.jpg") center / cover no-repeat;
  border-bottom: 2px solid var(--strong-line);
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 54%;
  background: rgba(17, 16, 20, 0.9);
}

.landing-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(51%, 760px);
  padding: 54px 5vw 58px;
  color: #fff;
}

.hero-kicker,
.landing-process header > p,
.landing-proof > div > p {
  margin: 0 0 13px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.landing-hero h1 {
  margin: 0;
  font-size: 72px;
  line-height: 0.9;
  overflow-wrap: anywhere;
}

.hero-summary {
  max-width: 610px;
  margin: 24px 0 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.48;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-actions a,
.landing-cta a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 0 16px;
  border: 1px solid #fff;
  border-radius: 4px;
  font-weight: 900;
  text-decoration: none;
}

.hero-primary {
  background: var(--acid);
  color: var(--ink);
  border-color: var(--acid) !important;
}

.hero-secondary {
  background: rgba(17, 16, 20, 0.72);
  color: #fff;
}

.landing-hero-copy > small {
  margin-top: 14px;
  color: #d8d3da;
}

.landing-process {
  padding: 64px 5vw 70px;
  background: var(--surface);
}

.landing-process header {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(420px, 1.3fr);
  gap: 30px;
  align-items: end;
  margin-bottom: 36px;
}

.landing-process header > p {
  margin: 0;
}

.landing-process h2,
.landing-proof h2,
.landing-cta h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1;
}

.landing-process ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--strong-line);
  border-bottom: 1px solid var(--strong-line);
  list-style: none;
}

.landing-process li {
  min-height: 220px;
  padding: 24px 26px 30px;
  border-right: 1px solid var(--strong-line);
}

.landing-process li:last-child {
  border-right: 0;
}

.landing-process li span {
  font-size: 11px;
  font-weight: 900;
}

.landing-process li h3 {
  margin: 46px 0 10px;
  font-size: 27px;
}

.landing-process li p {
  max-width: 350px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.landing-proof {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 60px;
  align-items: center;
  padding: 62px 5vw;
  background: var(--pink);
  border-top: 2px solid var(--strong-line);
  border-bottom: 2px solid var(--strong-line);
}

.landing-proof ul {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--strong-line);
  list-style: none;
}

.landing-proof li {
  padding: 12px 0;
  border-bottom: 1px solid var(--strong-line);
  font-weight: 850;
}

.landing-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 54px 5vw;
  background: var(--acid);
}

.landing-cta h2 {
  max-width: 780px;
}

.landing-cta a {
  flex: 0 0 auto;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Authentication */

.auth-body {
  min-height: 100vh;
  background: var(--surface);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(400px, 1.05fr) minmax(440px, 0.95fr);
  min-height: 100vh;
}

.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  overflow: hidden;
  background: #18151b url("/assets/hero-zines.jpg") center / cover no-repeat;
  color: #fff;
  border-right: 2px solid var(--strong-line);
}

.auth-art::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 48%;
  background: rgba(17, 16, 20, 0.88);
}

.auth-art > * {
  position: relative;
  z-index: 1;
}

.auth-art .brand-mark {
  align-self: flex-start;
}

.auth-art > div {
  padding: 34px 24px;
}

.auth-art p,
.auth-kicker {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-art h1 {
  margin: 0;
  font-size: 52px;
  line-height: 0.94;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 42px 8vw;
}

.auth-form-wrap {
  width: min(100%, 430px);
}

.auth-form-wrap > h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1;
}

.auth-form-wrap > p:not(.auth-kicker):not(.auth-error):not(.auth-switch) {
  margin: 15px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-error {
  margin: 18px 0 0;
  padding: 11px 12px;
  background: #fff0f3;
  color: #8f1737;
  border: 1px solid #d7486d;
  font-weight: 750;
}

.auth-form {
  display: grid;
  gap: 15px;
  margin-top: 26px;
}

.auth-form input {
  min-height: 44px;
}

.auth-form button {
  min-height: 46px;
  margin-top: 4px;
}

.auth-form > small {
  margin-top: -7px;
  color: var(--muted);
}

.auth-switch {
  margin: 20px 0 0;
}

.auth-switch a,
.auth-home {
  font-weight: 850;
}

.auth-home {
  display: inline-block;
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
}

/* Studio */

.studio-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.studio-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  height: 100%;
  background: var(--chrome);
}

.studio-topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(170px, auto) minmax(500px, 1fr);
  align-items: center;
  gap: 20px;
  min-width: 0;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--strong-line);
}

.studio-topbar .brand-mark {
  justify-self: start;
}

.document-title {
  display: grid;
  justify-items: center;
  min-width: 0;
  line-height: 1.1;
}

.document-title strong {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-title span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.user-chip {
  max-width: 120px;
  overflow: hidden;
  padding: 6px 8px;
  background: #ece8ef;
  border-radius: 4px;
  color: #514b53;
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-logout button {
  min-height: 34px;
}

.studio-workspace {
  display: grid;
  grid-template-columns: 82px 340px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.tool-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 9px 7px;
  gap: 4px;
  background: #29252c;
  border-right: 1px solid var(--strong-line);
}

.tool-rail button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  min-height: 61px;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  color: #cbc5cd;
  font-size: 11px;
}

.tool-rail button span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 25px;
  border: 1px solid #77717b;
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.tool-rail button:hover,
.tool-rail button.is-active {
  background: #413b46;
  color: #fff;
  transform: none;
}

.tool-rail button.is-active span {
  background: var(--acid);
  border-color: var(--acid);
  color: var(--ink);
}

.control-panel {
  min-width: 0;
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.panel-view {
  display: none;
  min-height: 100%;
}

.panel-view.is-active {
  display: block;
}

.panel-heading {
  padding: 20px 20px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-heading p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.panel-heading h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
}

.panel-section {
  display: grid;
  gap: 13px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: grid;
  gap: 2px;
}

.section-heading strong {
  font-size: 13px;
}

.section-heading span,
.help-copy,
.upload-zone p,
.media-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-list button {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 92px;
  padding: 10px;
  background: #fff;
  border-color: var(--line);
  text-align: left;
}

.template-list button:nth-child(2) {
  background: #f6efff;
}

.template-list button:nth-child(3) {
  background: #eafaff;
}

.template-list button:nth-child(4) {
  background: #fff0f5;
}

.template-list button span,
.template-list button small {
  color: var(--muted);
  font-size: 10px;
}

.template-list button b {
  font-size: 13px;
}

.account-zines {
  display: grid;
  gap: 7px;
}

.account-zines > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-zines article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
}

.account-zines article > button {
  display: grid;
  justify-items: start;
  gap: 3px;
  min-height: 52px;
  padding: 8px 10px;
  overflow: hidden;
  background: #fff;
  border-color: var(--line);
  text-align: left;
}

.account-zines article > button b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-zines article > button small {
  color: var(--muted);
  font-size: 10px;
}

.account-zines article > a {
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 17px;
  font-weight: 900;
  text-decoration: none;
}

.page-list {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.page-list-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  min-height: 60px;
  padding: 8px 10px;
  background: #fff;
  border-color: var(--line);
  text-align: left;
}

.page-list-item > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 26px;
  height: 34px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 10px;
}

.page-list-item b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-list-item small {
  color: var(--muted);
  font-size: 10px;
  text-transform: capitalize;
}

.page-list-item.is-active {
  background: #effcff;
  border-color: #168aa0;
  box-shadow: inset 3px 0 0 var(--cyan);
}

.compact-actions {
  grid-template-columns: 1fr 1fr;
}

.compact-actions #addPage {
  grid-column: 1 / -1;
}

.page-order {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid,
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-grid button,
.swatch-grid button {
  min-height: 44px;
  background: #fff;
  border-color: var(--line);
  font-size: 12px;
}

.choice-grid button.is-selected,
.swatch-grid button.is-selected {
  border-color: var(--strong-line);
  box-shadow: inset 0 0 0 2px var(--acid);
}

.layout-choices button:last-child {
  grid-column: 1 / -1;
}

.swatch-grid button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.swatch-grid i {
  width: 22px;
  height: 22px;
  border: 1px solid var(--strong-line);
  border-radius: 3px;
}

.swatch-ink { background: #f6f0e4; }
.swatch-acid { background: var(--acid); }
.swatch-paper { background: #fff6d5; }
.swatch-night { background: #20192b; }

.upload-zone {
  justify-items: stretch;
  background: #eefbfe;
}

.media-target {
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  align-items: center;
}

.media-target span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.media-target strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-target button {
  grid-column: 2;
  grid-row: 1 / 3;
}

.media-library {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.media-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.media-item.is-used {
  border-color: #168aa0;
  box-shadow: inset 3px 0 0 var(--cyan);
}

.media-item img {
  grid-row: 1 / 3;
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 3px;
}

.media-item > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.media-item > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.media-item label {
  font-size: 10px;
}

.media-item input {
  padding: 6px 7px;
  font-size: 11px;
}

.media-item > button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

.media-item > .icon-button {
  grid-column: 3;
  width: 30px;
  min-width: 30px;
  padding: 0;
  background: #fff;
  color: var(--danger);
  font-size: 17px;
}

.media-empty {
  padding: 28px 20px;
  text-align: center;
}

.toggle-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.toggle-row span {
  display: grid;
  gap: 5px;
}

.toggle-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.primary-wide {
  width: 100%;
  min-height: 44px;
}

.publish-status {
  min-height: 19px;
  margin: 0;
  color: #4d4750;
  font-size: 12px;
  font-weight: 700;
}

.share-box {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.share-box[hidden] {
  display: none;
}

.export-actions {
  display: grid;
  gap: 7px;
}

/* Canvas */

.canvas-workspace {
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr) 74px;
  min-width: 0;
  min-height: 0;
  background: #d7d7d2;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 16px;
  background: #f4f4f0;
  border-bottom: 1px solid var(--line);
}

.canvas-toolbar > div:first-child {
  display: grid;
  min-width: 0;
}

.canvas-toolbar span {
  font-weight: 850;
}

.canvas-toolbar small {
  max-width: 280px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-actions > span {
  min-width: 48px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.canvas-viewport {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 18px 24px;
  background-color: #d6d6d1;
  background-image:
    linear-gradient(#c9c9c3 1px, transparent 1px),
    linear-gradient(90deg, #c9c9c3 1px, transparent 1px);
  background-size: 24px 24px;
}

.preview-canvas {
  position: relative;
  min-width: 240px;
  max-width: calc(100% - 20px);
  max-height: calc(100vh - 214px);
  background: var(--paper);
  border: 1px solid var(--strong-line);
  box-shadow: 9px 10px 0 rgba(24, 21, 27, 0.22);
  container-type: inline-size;
}

.preview-canvas.shape-portrait {
  width: min(500px, calc((100vh - 214px) * 0.75));
  aspect-ratio: 3 / 4;
}

.preview-canvas.shape-square {
  width: min(590px, calc(100vh - 214px));
  aspect-ratio: 1;
}

.preview-canvas.shape-landscape {
  width: min(720px, calc((100vh - 214px) * 1.333));
  aspect-ratio: 4 / 3;
}

.canvas-page-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 9px 16px;
  background: #f4f4f0;
  border-top: 1px solid var(--line);
}

.canvas-page-strip button {
  display: grid;
  grid-template-columns: 20px 26px;
  align-items: center;
  gap: 4px;
  min-width: 57px;
  min-height: 46px;
  padding: 4px;
  background: #fff;
  border-color: var(--line);
}

.canvas-page-strip button span {
  font-size: 9px;
}

.canvas-page-strip button i {
  width: 24px;
  height: 32px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.canvas-page-strip button.is-active {
  border-color: var(--strong-line);
  box-shadow: 0 0 0 2px var(--cyan);
}

/* Shared zine page styling */

.zine-theme-ink {
  --page-bg: #f7f0e3;
  --page-color: #18151b;
  --page-border: #18151b;
  --page-shadow: #18151b;
}

.zine-theme-acid {
  --page-bg: #d7ff3f;
  --page-color: #18151b;
  --page-border: #18151b;
  --page-shadow: #ff73a8;
}

.zine-theme-paper {
  --page-bg: #fff5cf;
  --page-color: #2d261c;
  --page-border: #5a4b34;
  --page-shadow: #58d6ed;
}

.zine-theme-night {
  --page-bg: #20192b;
  --page-color: #fff8ea;
  --page-border: #fff8ea;
  --page-shadow: #ff73a8;
}

.zine-font-sans {
  --display-font: Arial, Helvetica, sans-serif;
  --body-font: Arial, Helvetica, sans-serif;
}

.zine-font-serif {
  --display-font: Georgia, "Times New Roman", serif;
  --body-font: Georgia, "Times New Roman", serif;
}

.zine-font-mono {
  --display-font: "Courier New", Courier, monospace;
  --body-font: "Courier New", Courier, monospace;
}

.zine-font-grotesk {
  --display-font: "Arial Black", Arial, sans-serif;
  --body-font: Arial, Helvetica, sans-serif;
}

.zine-font-editorial {
  --display-font: Didot, Bodoni 72, Georgia, serif;
  --body-font: Arial, Helvetica, sans-serif;
}

.reader-page {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--page-bg, var(--paper));
  color: var(--page-color, var(--ink));
  border: 2px solid var(--page-border, var(--ink));
  font-family: var(--body-font, Arial, sans-serif);
}

.preview-canvas > .reader-page {
  width: 100%;
  height: 100%;
  border: 0;
}

.page-copy,
.cover-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 8%;
}

.page-copy {
  overflow: auto;
}

.page-copy > span {
  margin-bottom: auto;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 900;
}

.page-copy h2 {
  margin: 12px 0;
  font-family: var(--display-font, Arial, sans-serif);
  font-size: 2.7rem;
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.page-copy p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.align-center .page-copy {
  text-align: center;
}

.align-right .page-copy {
  text-align: right;
}

.page-media,
.cover-media {
  margin: 0;
  overflow: hidden;
}

.page-media img,
.cover-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.layout-text .page-media {
  display: none;
}

.layout-image-top {
  display: grid;
  grid-template-rows: 45% 55%;
}

.layout-image-top .page-media {
  grid-row: 1;
}

.layout-image-top .page-copy {
  grid-row: 2;
  padding: 6%;
}

.layout-image-top .page-copy h2 {
  font-size: 2.2rem;
}

.layout-split {
  display: grid;
  grid-template-columns: 46% 54%;
}

.layout-split .page-media {
  grid-column: 1;
}

.layout-split .page-copy {
  grid-column: 2;
  padding: 9%;
}

.layout-split .page-copy h2 {
  font-size: 2rem;
}

.layout-full-image .page-media {
  position: absolute;
  inset: 0;
}

.layout-full-image .page-copy {
  align-self: flex-end;
  flex: 0 1 auto;
  margin: auto 5% 5%;
  padding: 5%;
  background: color-mix(in srgb, var(--page-bg) 90%, transparent);
  border: 1px solid var(--page-border);
  max-height: 70%;
}

.layout-full-image:not(:has(.page-media)) .page-copy {
  align-self: stretch;
  flex: 1;
  margin: 0;
  padding: 8%;
  border: 0;
}

.layout-quote .page-media {
  display: none;
}

.layout-quote .page-copy {
  justify-content: center;
  text-align: center;
}

.layout-quote .page-copy > span {
  margin-bottom: 20px;
}

.layout-quote .page-copy h2 {
  margin: auto 0 18px;
  font-size: 3.4rem;
}

.accent-pink { box-shadow: inset 0 12px 0 var(--pink); }
.accent-cyan { box-shadow: inset 0 12px 0 var(--cyan); }
.accent-acid { box-shadow: inset 0 12px 0 var(--acid); }
.accent-violet { box-shadow: inset 0 12px 0 var(--violet); }

.page-stamp {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  background: var(--pink);
  color: var(--ink);
  border: 2px solid var(--page-border);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--page-shadow);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 32px;
  line-height: 1;
  transform: rotate(8deg);
}

.stamp-top-left { top: 5%; left: 5%; }
.stamp-top-right { top: 5%; right: 5%; }
.stamp-bottom-left { bottom: 5%; left: 5%; }
.stamp-bottom-right { right: 5%; bottom: 5%; }

.reader-cover {
  display: flex;
}

.cover-copy {
  justify-content: flex-end;
}

.cover-copy > p:first-child {
  margin: 0 0 16px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cover-copy h1 {
  margin: 0;
  font-family: var(--display-font, Arial, sans-serif);
  font-size: 4rem;
  line-height: 0.9;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.reader-summary {
  margin: 18px 0 0;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.35;
}

.has-cover-image .cover-media {
  position: absolute;
  inset: 0;
}

.has-cover-image .cover-media::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.76));
}

.has-cover-image .cover-copy {
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

/* Published reader */

.reader-body {
  min-height: 100vh;
  background: #d9d9d4;
}

.zine-reader {
  width: 100%;
  max-width: 1320px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 26px 24px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.reader-actions button {
  min-height: 34px;
  background: #fff;
  border-color: var(--line);
}

.reader-actions button.is-active {
  background: var(--acid);
  border-color: var(--strong-line);
}

.reader-brand {
  margin-right: auto;
  padding: 0 7px;
  font-weight: 900;
  text-decoration: none;
}

.reader-mode {
  display: flex;
  gap: 4px;
}

.flipbook {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 16px;
  align-items: center;
}

.flip-stage {
  position: relative;
  justify-self: center;
  max-width: 100%;
  perspective: 1500px;
}

.zine-shape-portrait .flip-stage {
  width: min(610px, calc(100vw - 220px), calc((100vh - 188px) * 0.75));
  aspect-ratio: 3 / 4;
}

.zine-shape-square .flip-stage {
  width: min(690px, calc(100vw - 220px), calc(100vh - 188px));
  aspect-ratio: 1;
}

.zine-shape-landscape .flip-stage {
  width: min(850px, calc(100vw - 220px), calc((100vh - 188px) * 1.333));
  aspect-ratio: 4 / 3;
}

.flip-page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  box-shadow: 8px 8px 0 var(--page-shadow);
  transform: translateX(24px) rotateY(-18deg) scale(0.97);
  transform-origin: left center;
  transition: transform 340ms ease, opacity 220ms ease;
  backface-visibility: hidden;
}

.flip-page.is-current {
  opacity: 1;
  transform: translateX(0) rotateY(0) scale(1);
}

.flip-page.is-past {
  opacity: 0;
  transform: translateX(-32px) rotateY(18deg) scale(0.96);
  transform-origin: right center;
}

.flip-nav {
  width: 52px;
  height: 72px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  font-size: 20px;
}

.flip-status {
  grid-column: 2;
  justify-self: center;
  padding: 7px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.reader-thumbs {
  display: flex;
  justify-content: center;
  gap: 7px;
  overflow-x: auto;
  margin-top: 14px;
  padding: 4px 0 8px;
}

.reader-thumbs button {
  min-width: 100px;
  max-width: 160px;
  min-height: 47px;
  overflow: hidden;
  background: #fff;
  border-color: var(--line);
  font-size: 11px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-thumbs button.is-active {
  border-color: var(--strong-line);
  box-shadow: inset 0 -3px 0 var(--cyan);
}

.reader-thumbs span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.zine-reader[data-mode="scroll"] .flipbook {
  display: block;
}

.zine-reader[data-mode="scroll"] .flip-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  width: min(100%, 1100px);
  aspect-ratio: auto;
  perspective: none;
}

.zine-reader[data-mode="scroll"] .flip-page {
  position: relative;
  inset: auto;
  opacity: 1;
  transform: none;
}

.zine-shape-portrait[data-mode="scroll"] .flip-page { aspect-ratio: 3 / 4; }
.zine-shape-square[data-mode="scroll"] .flip-page { aspect-ratio: 1; }
.zine-shape-landscape[data-mode="scroll"] .flip-page { aspect-ratio: 4 / 3; }

.zine-reader[data-mode="scroll"] .flip-nav,
.zine-reader[data-mode="scroll"] .flip-status,
.zine-reader[data-mode="scroll"] .reader-thumbs {
  display: none;
}

/* Directory */

.directory-body {
  min-height: 100vh;
  background: var(--surface);
}

.directory-shell {
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--strong-line);
}

.site-header nav a {
  font-weight: 800;
}

.directory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 520px);
  gap: 28px;
  align-items: end;
  padding: 48px 5vw 34px;
  background: var(--cyan);
  border-bottom: 2px solid var(--strong-line);
}

.directory-hero > p {
  grid-column: 1 / -1;
  margin: 0 0 -14px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.directory-hero h1 {
  margin: 0;
  font-size: 50px;
  line-height: 0.95;
}

.directory-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 28px 5vw 60px;
}

.zine-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 18px;
  background: var(--page-bg);
  color: var(--page-color);
  border: 2px solid var(--strong-line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  text-decoration: none;
}

.zine-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.zine-card > span,
.zine-card small {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.zine-card h2 {
  margin: auto 0 12px;
  font-size: 30px;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.zine-card p {
  margin: 0 0 18px;
  line-height: 1.45;
}

.zine-card[hidden],
.filter-empty[hidden] {
  display: none;
}

.directory-empty,
.filter-empty {
  grid-column: 1 / -1;
  padding: 36px;
  background: #fff0f5;
  border: 1px solid var(--line);
  text-align: center;
}

.directory-empty h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.directory-empty p {
  margin: 0 auto 20px;
  color: var(--muted);
}

.not-found-body {
  min-height: 100vh;
  background: var(--cyan);
}

.not-found {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 8vw;
}

.not-found > p {
  margin: 50px 0 8px;
  font-weight: 900;
}

.not-found h1 {
  max-width: 760px;
  margin: 0 0 28px;
  font-size: 54px;
  line-height: 0.95;
}

@media (max-width: 1120px) {
  .studio-workspace {
    grid-template-columns: 76px 310px minmax(0, 1fr);
  }

  .studio-topbar {
    grid-template-columns: minmax(125px, 1fr) auto minmax(460px, 1fr);
    gap: 10px;
  }

  .landing-hero-copy {
    width: 58%;
  }

  .landing-hero::before {
    width: 61%;
  }

  .preview-canvas.shape-portrait {
    width: min(450px, calc((100vh - 214px) * 0.75));
  }

  .cover-copy h1 {
    font-size: 3.3rem;
  }

  .page-copy h2 {
    font-size: 2.3rem;
  }
}

@media (max-width: 920px) {
  .landing-hero-copy {
    width: 69%;
  }

  .landing-hero::before {
    width: 72%;
  }

  .landing-hero h1 {
    font-size: 62px;
  }

  .landing-process header,
  .landing-proof {
    grid-template-columns: 1fr;
  }

  .landing-process header {
    gap: 12px;
  }

  .auth-shell {
    grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  }

  .auth-art h1 {
    font-size: 42px;
  }

  .studio-body {
    height: auto;
    overflow: auto;
  }

  .studio-shell {
    height: auto;
    min-height: 100vh;
  }

  .studio-topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr auto;
  }

  .document-title {
    display: none;
  }

  .topbar-actions .icon-button,
  .topbar-actions .quiet-button:first-of-type {
    display: none;
  }

  .user-chip,
  .studio-logout {
    display: none;
  }

  .studio-workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .tool-rail {
    position: sticky;
    top: 58px;
    z-index: 15;
    flex-direction: row;
    overflow-x: auto;
    padding: 5px 7px;
    border-right: 0;
    border-bottom: 1px solid var(--strong-line);
    scrollbar-width: none;
  }

  .tool-rail::-webkit-scrollbar {
    display: none;
  }

  .tool-rail button {
    flex: 1 0 74px;
    min-height: 48px;
  }

  .tool-rail button span {
    display: none;
  }

  .control-panel {
    max-height: 58vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .canvas-workspace {
    grid-template-rows: 54px minmax(520px, 70vh) 74px;
  }

  .preview-canvas {
    max-height: calc(70vh - 38px);
  }

  .preview-canvas.shape-portrait {
    width: min(480px, calc((70vh - 38px) * 0.75));
  }

  .preview-canvas.shape-square {
    width: min(540px, calc(70vh - 38px));
  }

  .preview-canvas.shape-landscape {
    width: min(680px, calc((70vh - 38px) * 1.333));
  }

  .directory-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .marketing-header,
  .site-header {
    padding: 10px 12px;
  }

  .marketing-header nav,
  .site-header nav {
    gap: 10px;
    font-size: 12px;
  }

  .marketing-header a[href="#how-it-works"],
  .marketing-header a[href="/directory"] {
    display: none;
  }

  .landing-hero {
    min-height: max(560px, calc(100svh - 170px));
    background-position: 62% center;
  }

  .landing-hero::before {
    width: 100%;
    background: rgba(17, 16, 20, 0.84);
  }

  .landing-hero-copy {
    width: 100%;
    padding: 54px 22px 58px;
  }

  .landing-hero h1 {
    font-size: 48px;
  }

  .hero-summary {
    font-size: 16px;
  }

  .hero-actions {
    display: grid;
  }

  .landing-process {
    padding: 48px 22px;
  }

  .landing-process header {
    grid-template-columns: 1fr;
  }

  .landing-process h2,
  .landing-proof h2,
  .landing-cta h2 {
    font-size: 34px;
  }

  .landing-process ol {
    grid-template-columns: 1fr;
  }

  .landing-process li {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--strong-line);
  }

  .landing-process li:last-child {
    border-bottom: 0;
  }

  .landing-process li h3 {
    margin-top: 28px;
  }

  .landing-proof,
  .landing-cta {
    grid-template-columns: 1fr;
    padding: 44px 22px;
  }

  .landing-cta {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-art {
    display: none;
  }

  .auth-panel {
    min-height: 100vh;
    padding: 36px 22px;
  }

  .auth-form-wrap > h1 {
    font-size: 34px;
  }

  .studio-topbar {
    padding: 9px 10px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button-link {
    display: none;
  }

  .panel-heading,
  .panel-section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .field-row,
  .directory-tools {
    grid-template-columns: 1fr;
  }

  .template-list {
    grid-template-columns: 1fr 1fr;
  }

  .canvas-viewport {
    padding: 16px 10px;
  }

  .cover-copy h1 {
    font-size: 2.6rem;
  }

  .page-copy h2,
  .layout-quote .page-copy h2 {
    font-size: 2rem;
  }

  .page-stamp {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }

  .zine-reader {
    padding: 10px;
  }

  .reader-actions {
    flex-wrap: wrap;
  }

  .reader-brand {
    flex: 1 0 calc(100% - 16px);
  }

  .flipbook {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 5px;
  }

  .flip-nav {
    width: 38px;
    height: 56px;
  }

  .zine-shape-portrait .flip-stage {
    width: min(calc(100vw - 104px), calc((100vh - 240px) * 0.75));
  }

  .zine-shape-square .flip-stage {
    width: min(calc(100vw - 104px), calc(100vh - 240px));
  }

  .zine-shape-landscape .flip-stage {
    width: min(calc(100vw - 104px), calc((100vh - 240px) * 1.333));
  }

  .zine-reader[data-mode="scroll"] .flip-stage {
    grid-template-columns: 1fr;
  }

  .directory-hero {
    padding: 34px 18px 24px;
  }

  .directory-hero h1 {
    font-size: 38px;
  }

  .directory-grid {
    grid-template-columns: 1fr;
    padding: 20px 18px 50px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .reader-actions,
  .reader-thumbs,
  .flip-nav,
  .flip-status {
    display: none !important;
  }

  .zine-reader {
    padding: 0;
  }

  .flipbook,
  .flip-stage {
    display: block !important;
    width: 100% !important;
    aspect-ratio: auto !important;
  }

  .flip-page {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-height: 9in;
    margin: 0 0 0.25in;
    opacity: 1 !important;
    overflow: visible;
    box-shadow: none;
    transform: none !important;
    break-after: page;
  }

  .page-copy {
    overflow: visible;
  }
}
