/*--------------------------------------------------------------
Navel World Submissions — Components
Shared UI pieces used across the app. Depends on css/foundation.css
for design tokens. Source: design-reference/*.html

>>> TABLE OF CONTENTS
- Utilities
- Page shell
- App header / back nav
- App footer
- Buttons
- Form fields
- Story status selector
- Cover upload
- Tag chips
- Status badge
- Story card
- Story info (story detail header)
- Chapter list
- Cover placeholder
- Empty state
- Tabs
- Custom checkbox
- Modal
- Chapter editor
- Auth
- Legal page content
--------------------------------------------------------------*/

/*--------------------------------------------------------------
Utilities
--------------------------------------------------------------*/

/*
 * !important on the hidden state only (never the visible state) is
 * deliberate here, not a specificity workaround to avoid touching the
 * "real" rule. These utilities are meant to win over ANY component's own
 * `display` value unconditionally — e.g. `.editor-topbar { display: flex; }`
 * and `.editor-topbar--mobile { display: grid; }` both set `display`
 * with no media query of their own, and being later in this file than
 * these utility rules, they were winning at equal specificity regardless
 * of viewport width. That's why desktop and mobile chapter-editor toolbars
 * were rendering stacked on top of each other at every width. Forcing only
 * the "hide" side wins in both directions while still letting each
 * component's own rule supply the correct visible `display` type
 * (flex vs. grid vs. inline-flex) when it's the active variant.
 *
 * `.u-mobile-only`'s hidden state must be scoped to a min-width query
 * (mirroring `.u-desktop-only`'s max-width-scoped hidden state) rather
 * than left unconditional. An unconditional `!important` hide, undone
 * only by a non-important show inside `max-width: 700px`, can never
 * actually show anything — `!important` always outranks a non-important
 * rule regardless of source order or media query, so the mobile-only
 * elements (chapter editor's whole mobile toolbar/topbar/title row) were
 * permanently hidden at every viewport width. This is what made the
 * mobile Chapter Editor render nothing but the bare typing surface.
 */
.u-desktop-only {
	display: inline-flex;
}

.u-mobile-only {
	display: inline-flex;
}

@media (max-width: 700px) {
	.u-desktop-only {
		display: none !important;
	}
}

@media (min-width: 701px) {
	.u-mobile-only {
		display: none !important;
	}
}

.divider {
	height: 1px;
	background: var(--color-border-subtle);
	margin: 34px 0 26px;
}

.section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
}

/*--------------------------------------------------------------
Page shell

Generic centered app layout used by every app screen: a full-width
header/back-nav (see next section) followed by a max-width, centered
content column. Mockups frame each screen inside a fixed-width "device"
card for presentation; the real page has no such frame — it just sits on
the body background — so these dimensions are the mockup's inner content
paddings only.
--------------------------------------------------------------*/

/*
 * Standard sticky-footer flexbox pattern: `body.nw-app` (the class
 * template-parts/app/app-head.php adds via body_class()) is the flex
 * column, `.app-shell` / `#editor-root` / `.auth-shell` — whichever one
 * a given app screen uses as its main content — grows via `flex: 1` to
 * fill any leftover space, and .app-footer (a sibling, ordinary flex
 * item) is pushed flush to the viewport bottom on short pages while
 * still scrolling to the true end of the document on long ones.
 */
body.nw-app {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.app-shell {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 64px 56px 96px;
}

/*
 * A class-selector `display` always beats the `[hidden]` UA-stylesheet
 * default (same reasoning as .editor-note[hidden] below) — without this,
 * page-chapter-editor.php's `#editor-state-notice` (an .app-shell, hidden
 * by default and only unhidden on a real load error) renders anyway,
 * with its full 64px/96px vertical padding, pushing the real editor
 * content down and creating a large empty gap above it on every load.
 */
.app-shell[hidden] {
	display: none;
}

.app-shell__inner {
	width: 100%;
	max-width: 1200px;
	display: flex;
	flex-direction: column;
	gap: 26px;
}

.page-title-row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.page-title-row__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.state-message {
	padding: 40px 0;
	text-align: center;
}

@media (max-width: 600px) {
	.app-shell {
		padding: 24px 20px 56px;
	}

	.page-title-row {
		flex-direction: column;
		align-items: stretch;
	}

	.page-title-row > .btn {
		width: 100%;
	}
}

.app-shell__inner--narrow {
	max-width: 840px;
}

/*
 * Narrower than --narrow (840px) — long-form policy prose (Privacy
 * Policy, Terms & Conditions; see page-legal.php / .legal-content below)
 * reads better at a tighter measure than the app's other centered
 * screens, which mix in wider elements like the story grid.
 */
.app-shell__inner--legal {
	max-width: 760px;
}

.story-form-grid {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 44px;
	align-items: start;
}

@media (max-width: 760px) {
	.story-form-grid {
		grid-template-columns: 1fr;
	}
}

.form-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 16px;
	margin-top: 36px;
	padding-top: 26px;
	border-top: 1px solid var(--color-border-subtle);
}

@media (max-width: 600px) {
	.form-actions {
		flex-direction: column;
		border-top: none;
		padding-top: 0;
		margin-top: 20px;
	}

	.form-actions .btn {
		width: 100%;
	}

	/*
	 * Story Detail only — pins Save/Cancel to the bottom of the viewport
	 * on mobile rather than scrolling away below a long chapter list.
	 * `sticky`, not `fixed`, matching the same pattern already used for
	 * the Chapter Editor's mobile toolbar (.editor-toolbar--mobile):
	 * .app-shell's own scroll container is what it sticks within.
	 */
	.form-actions--sticky {
		position: sticky;
		bottom: 0;
		margin-left: -20px;
		margin-right: -20px;
		padding: 14px 20px;
		background: var(--color-base);
		border-top: 1px solid var(--color-border-subtle);
		z-index: 5;
	}
}

.form-error {
	color: var(--color-status-active-ink);
	font-size: 13px;
}

/*--------------------------------------------------------------
App header / back nav
--------------------------------------------------------------*/

/*
 * Grid, not flex `justify-content: space-between`, is deliberate: the
 * brand (logo only) and the user cluster (name + avatar) are different
 * widths, so a two-item flex row can't put `.app-header__nav` at a true
 * center — it would center relative to the leftover space, not the
 * viewport. `grid-template-columns: 1fr auto 1fr` gives the nav its own
 * column that's centered regardless of how wide its neighbors are. Works
 * unchanged on mobile too: `.app-header__nav` and `.app-header__user`
 * both hide there (see .u-desktop-only), leaving column 2 empty and only
 * `.app-header__user-mobile` occupying column 3.
 */
.app-header {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: 20px 32px;
	border-bottom: 1px solid var(--color-border-subtle);
}

.app-header__brand {
	grid-column: 1;
	justify-self: start;
	display: flex;
	align-items: center;
	text-decoration: none;
}

.app-header__logo {
	display: block;
	width: auto;
	height: 50px;
}

.app-header__nav {
	grid-column: 2;
	justify-self: center;
	display: flex;
	align-items: center;
	gap: 28px;
}

.app-header__nav-link {
	font-size: 13px;
	color: var(--color-ink-muted);
	text-decoration: none;
	transition: color 0.16s ease;
}

.app-header__nav-link:hover {
	color: var(--color-ink-body);
}

.app-header__user {
	grid-column: 3;
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 12px;
}

.app-header__user-name {
	font-size: 14px;
	color: var(--color-ink-body);
}

.app-header__user-mobile {
	grid-column: 3;
	justify-self: end;
	position: relative;
	display: flex;
}

.app-header__avatar-btn {
	position: relative;
	display: flex;
	background: transparent;
	border: none;
	padding: 0;
	border-radius: 50%;
	cursor: pointer;
}

.app-header__avatar-btn:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

/*
 * Expand/collapse cue for the mobile avatar trigger — otherwise nothing
 * about the avatar itself signals it's tappable. Sized and colored like
 * the .faq-item__icon chevron (muted ink at rest, same rotate-on-expand
 * mechanism keyed off the button's own aria-expanded, no separate JS
 * state to keep in sync). Badged at the avatar's bottom-right corner
 * rather than placed beside it since there's no spare width in the
 * mobile header's user cluster to widen the tap target.
 */
.app-header__avatar-chevron {
	position: absolute;
	right: -2px;
	bottom: -2px;
	width: 15px;
	height: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	color: var(--color-ink-muted);
	transition: transform 0.18s ease;
}

.app-header__avatar-btn[aria-expanded="true"] .app-header__avatar-chevron {
	transform: rotate(180deg);
}

/* Matches the .tag-menu floating-menu pattern already used elsewhere. */
.app-header__dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 20;
	min-width: 190px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 6px;
	box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.85);
}

.app-header__dropdown[hidden] {
	display: none;
}

.app-header__dropdown-name {
	font-size: 13px;
	font-weight: 500;
	color: var(--color-ink-strong);
	padding: 8px 10px 6px;
	margin-bottom: 2px;
	border-bottom: 1px solid var(--color-border-faint);
}

.app-header__dropdown-link {
	font-size: 13.5px;
	color: var(--color-ink-muted);
	text-decoration: none;
	padding: 9px 10px;
	border-radius: 7px;
	transition: background 0.14s ease, color 0.14s ease;
}

.app-header__dropdown-link:hover {
	background: var(--color-row-hover);
	color: var(--color-ink-strong);
}

@media (max-width: 600px) {
	.app-header {
		padding-left: 20px;
		padding-right: 20px;
	}
}

.avatar {
	width: 36px;
	height: 36px;
	flex: none;
	border-radius: 50%;
	background: linear-gradient(145deg, #d3a091, #8f5f6f);
	color: var(--color-accent-ink);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.avatar--sm {
	width: 32px;
	height: 32px;
	font-size: 12px;
}

.nav-back {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 40px;
	border-bottom: 1px solid var(--color-border-subtle);
}

.nav-back__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--color-ink-muted);
	text-decoration: none;
	cursor: pointer;
	transition: color 0.16s ease;
	flex: none;
}

.nav-back__link:hover {
	color: var(--color-ink-strong);
}

/*--------------------------------------------------------------
App footer

Present on every authenticated app screen via
template-parts/app/app-foot.php — Privacy Policy / Terms & Conditions
links (to the real Pages created for them, see page-legal.php) sit in
their own small row just above the copyright line, rather than inline
with it, so the copyright text doesn't have to compete with link
color/hover states on one already-compact line.
--------------------------------------------------------------*/

.app-footer {
	padding: 18px 32px;
	border-top: 1px solid var(--color-border-subtle);
	text-align: center;
}

.app-footer__links {
	display: flex;
	justify-content: center;
	gap: 20px;
	margin-bottom: 8px;
}

.app-footer__link {
	font-size: 12.5px;
	color: var(--color-ink-muted);
	text-decoration: none;
	transition: color 0.16s ease;
}

.app-footer__link:hover {
	color: var(--color-accent-on-dark);
}

.app-footer__copy {
	font-size: 12.5px;
	color: var(--color-ink-faint);
}

@media (max-width: 600px) {
	.app-footer {
		padding: 16px 20px;
	}
}

/*--------------------------------------------------------------
Buttons
--------------------------------------------------------------*/

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: var(--font-sans);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	padding: 12px 22px;
	border-radius: var(--radius-md);
	border: 1px solid transparent;
	cursor: pointer;
	transition: var(--ease-standard);
	text-decoration: none;
}

.btn-primary {
	background: var(--color-accent);
	color: var(--color-accent-ink);
}

.btn-primary:hover {
	background: var(--color-accent-hover);
}

.btn-primary:active {
	background: var(--color-accent-active);
}

.btn-primary:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px var(--color-accent-soft-border);
}

.btn-primary:disabled {
	background: var(--color-surface-hover);
	color: var(--color-ink-faint);
	cursor: not-allowed;
	opacity: 0.75;
}

.btn-ghost {
	background: transparent;
	color: var(--color-ink-strong);
	border-color: var(--color-border-strong);
	font-weight: 500;
}

.btn-ghost:hover {
	background: var(--color-raised);
	border-color: var(--color-border-hover);
}

.btn-ghost:active {
	background: var(--color-surface);
}

.btn-ghost:focus-visible {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-focus-ring);
}

.btn-ghost:disabled {
	color: var(--color-border-strong);
	border-color: var(--color-surface-hover);
	cursor: not-allowed;
}

.btn-plain {
	background: transparent;
	color: var(--color-ink-muted);
	border-color: transparent;
	font-weight: 500;
}

.btn-plain:hover {
	color: var(--color-ink-strong);
	background: var(--color-surface);
}

.btn--sm {
	padding: 9px 16px;
	font-size: 13.5px;
}

.btn--block {
	width: 100%;
}

.btn-icon {
	width: 32px;
	height: 32px;
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 7px;
	color: var(--color-ink-faint);
	cursor: pointer;
	transition: var(--ease-fast);
}

.btn-icon:hover {
	background: var(--color-surface-hover);
	border-color: var(--color-border-strong);
	color: var(--color-accent-on-dark);
}

.btn-icon--lg {
	width: 44px;
	height: 44px;
	background: var(--color-surface);
	border-color: var(--color-surface-hover);
	border-radius: var(--radius-md);
}

.btn-icon--lg:hover {
	border-color: var(--color-border-hover);
}

/*--------------------------------------------------------------
Form fields
--------------------------------------------------------------*/

.field {
	display: flex;
	flex-direction: column;
	gap: 9px;
}

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

.field__hint {
	font-size: 12px;
	color: var(--color-ink-faint);
	font-variant-numeric: tabular-nums;
}

.field__input,
.field__textarea {
	width: 100%;
	background: var(--color-base);
	border: 1px solid var(--color-border);
	color: var(--color-ink-strong);
	border-radius: var(--radius-md);
	padding: 12px 14px;
	font-size: 14px;
	outline: none;
	transition: var(--ease-fast);
}

.field__input:focus,
.field__textarea:focus {
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-focus-ring);
}

.field__textarea {
	font-family: var(--font-content);
	font-size: 16px;
	line-height: 1.75;
	color: var(--color-ink-body);
	padding: 16px 18px;
	border-radius: var(--radius-lg);
	resize: vertical;
}

.field__input--underline {
	background: transparent;
	border: none;
	border-bottom: 1px solid var(--color-border);
	font-family: var(--font-content);
	font-size: 27px;
	font-weight: 500;
	color: var(--color-ink-primary);
	padding: 6px 4px 12px;
	border-radius: 0;
}

.field__input--underline:focus {
	border-bottom-color: var(--color-accent);
	box-shadow: none;
}

@media (max-width: 600px) {
	.field__input--underline {
		font-size: 23px;
	}
}

/*--------------------------------------------------------------
Story status selector

Segmented pill control for the author-facing _story_status field
(Ongoing / On Hiatus / Complete) — distinct from post_status, which
this app has no control for anywhere. Real radio inputs drive the
visible pill via the standard input:checked + label sibling pattern
(same "real native control, custom visuals" approach as the checkbox
below), so it's keyboard/screen-reader accessible for free. Each
option's tone color is supplied via inline custom properties
(--tone-bg/-border/-ink) from the existing --color-status-* tokens,
so this is one shared rule rather than three near-duplicates.

The author-facing _story_language field (English/Hindi/Malayalam/
Bengali/Tamil/Telugu) reuses this exact same component — same
.status-select/.status-select__option/.status-select__input markup,
just wrapped with an extra .language-select class instead of a
per-option inline tone (see the single .language-select checked-state
rule below the status one) and no .status-select__dot, since a
language isn't a workflow state the way a status is.
--------------------------------------------------------------*/

.status-select {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

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

.status-select__option {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 8px 14px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--color-border);
	background: var(--color-surface);
	color: var(--color-ink-muted);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: var(--ease-fast);
}

.status-select__option:hover {
	border-color: var(--color-border-hover);
}

.status-select__dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
	flex: none;
}

.status-select__input:checked + .status-select__option {
	border-color: var(--tone-border);
	background: var(--tone-bg);
	color: var(--tone-ink);
}

.status-select__input:focus-visible + .status-select__option {
	outline: 2px solid var(--color-accent-focus-ring);
	outline-offset: 2px;
}

/*
 * Language pills reuse .status-select/.status-select__option/__input
 * as-is (same component, not a copy) — this is the one addition on top:
 * status pills each carry their own --tone-* via an inline style (Ongoing/
 * On hiatus/Complete each read as a different state), but a language
 * isn't a status — there's no "good/bad" reading across
 * English/Hindi/Malayalam/Bengali/Tamil/Telugu, so every option shares
 * one neutral checked-state tone instead of a per-option inline one.
 */
.language-select .status-select__input:checked + .status-select__option {
	border-color: var(--color-status-neutral-border);
	background: var(--color-status-neutral-bg);
	color: var(--color-status-neutral-ink);
}

/*--------------------------------------------------------------
Cover upload

Wraps a .cover-placeholder (or a chosen-file <img> preview) with a
"Change cover" control overlaid in a bottom scrim.
--------------------------------------------------------------*/

.cover-upload {
	position: relative;
	aspect-ratio: 2 / 3;
	border-radius: var(--radius-lg);
	overflow: hidden;
	border: 1px solid var(--color-border);
	background: var(--color-surface);
}

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

.cover-upload__control {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 14px;
	display: flex;
	justify-content: center;
	background: linear-gradient(0deg, rgba(8, 16, 15, 0.85), rgba(8, 16, 15, 0));
}

.btn-cover-change {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: rgba(14, 13, 12, 0.7);
	backdrop-filter: blur(4px);
	color: var(--color-ink-strong);
	font-size: 12.5px;
	font-weight: 500;
	padding: 8px 14px;
	border-radius: var(--radius-md);
	border: 1px solid rgba(255, 255, 255, 0.14);
	cursor: pointer;
	transition: var(--ease-fast);
}

.btn-cover-change:hover {
	background: rgba(14, 13, 12, 0.92);
	border-color: rgba(255, 255, 255, 0.28);
}

/*--------------------------------------------------------------
Tag chips
--------------------------------------------------------------*/

.tag-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 13px;
	color: var(--color-ink-body);
	background: var(--color-raised);
	border: 1px solid var(--color-border);
	padding: 6px 13px;
	border-radius: var(--radius-pill);
}

.tag-chip--removable {
	padding: 5px 8px 5px 12px;
}

.tag-chip__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--color-border);
	color: var(--color-ink-muted);
	font-size: 12px;
	line-height: 1;
	border: none;
	cursor: pointer;
	transition: var(--ease-fast);
}

.tag-chip__remove:hover {
	background: var(--color-accent-active);
	color: var(--color-accent-ink);
}

.tag-input {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	background: var(--color-base);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 10px 12px;
	transition: var(--ease-fast);
}

.tag-input:focus-within {
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-focus-ring);
}

.tag-input__field {
	flex: 1;
	min-width: 100px;
	background: transparent;
	border: none;
	outline: none;
	font-size: 14px;
	color: var(--color-ink-strong);
	padding: 4px 4px;
}

.tag-menu {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: 5px;
	box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.85);
	display: flex;
	flex-direction: column;
}

.tag-menu__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 9px 11px;
	border-radius: 7px;
	cursor: pointer;
	font-size: 13.5px;
	color: var(--color-ink-body);
	transition: background 0.14s ease;
}

.tag-menu__item:hover,
.tag-menu__item.is-active {
	background: var(--color-accent-soft-bg);
	color: var(--color-ink-strong);
}

.tag-menu__hint {
	font-size: 11px;
	color: var(--color-ink-faint);
}

/*--------------------------------------------------------------
Status badge

Tone-based, not vocabulary-locked: the same tones cover the chapter
workflow (Draft / Under Review / Approved / Needs Revision / Rejected),
the story-level rollup (On Hiatus / Ongoing / Complete), and — as of
the review-workflow refactor — a fourth "danger" tone for Rejected,
the one state qualitatively different from the rest (an outcome,
not an in-progress state).
--------------------------------------------------------------*/

.status-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.05em;
	padding: 5px 12px;
	border-radius: var(--radius-badge);
	white-space: nowrap;
}

.status-badge__dot {
	width: 6px;
	height: 6px;
	flex: none;
	border-radius: 50%;
}

.status-badge--sm {
	gap: 6px;
	font-size: 11px;
	padding: 4px 9px;
}

.status-badge--sm .status-badge__dot {
	width: 5px;
	height: 5px;
}

.status-badge--positive {
	color: var(--color-status-positive-ink);
	background: var(--color-status-positive-bg);
	border: 1px solid var(--color-status-positive-border);
}

.status-badge--positive .status-badge__dot {
	background: var(--color-status-positive);
}

.status-badge--active {
	color: var(--color-status-active-ink);
	background: var(--color-status-active-bg);
	border: 1px solid var(--color-status-active-border);
}

.status-badge--active .status-badge__dot {
	background: var(--color-status-active);
}

.status-badge--neutral {
	color: var(--color-status-neutral-ink);
	background: var(--color-status-neutral-bg);
	border: 1px solid var(--color-status-neutral-border);
}

.status-badge--neutral .status-badge__dot {
	background: var(--color-status-neutral);
}

.status-badge--danger {
	color: var(--color-status-danger-ink);
	background: var(--color-status-danger-bg);
	border: 1px solid var(--color-status-danger-border);
}

.status-badge--danger .status-badge__dot {
	background: var(--color-status-danger);
}

/*--------------------------------------------------------------
Story card
--------------------------------------------------------------*/

.story-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
}

@media (max-width: 900px) {
	.story-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 14px;
	}
}

.story-card {
	display: flex;
	flex-direction: column;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	cursor: pointer;
	transition: var(--ease-standard);
	text-decoration: none;
}

.story-card:hover {
	border-color: var(--color-border-hover);
	transform: translateY(-4px);
	box-shadow: 0 22px 48px -24px rgba(0, 0, 0, 0.85);
}

.story-card__cover {
	position: relative;
	aspect-ratio: 3 / 4;
}

.story-card__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.story-card__body {
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.story-card__title {
	font-family: var(--font-serif);
	font-size: 17px;
	line-height: 1.25;
	color: var(--color-ink-strong);
}

.story-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
}

.story-card__count {
	font-size: 12.5px;
	color: var(--color-ink-muted);
	white-space: nowrap;
}

.story-card--new {
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 260px;
	background: transparent;
	border: 1.5px dashed var(--color-border-dashed);
	color: var(--color-ink-muted);
	cursor: pointer;
	transition: var(--ease-standard);
}

.story-card--new:hover {
	border-color: rgba(207, 148, 132, 0.6);
	color: var(--color-accent-on-dark);
	background: rgba(207, 148, 132, 0.05);
	transform: none;
	box-shadow: none;
}

.story-card--new__icon {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 1.5px dashed currentColor;
	display: flex;
	align-items: center;
	justify-content: center;
}

/*--------------------------------------------------------------
Chapter list
--------------------------------------------------------------*/

.chapter-list {
	background: var(--color-well);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-lg);
	overflow: hidden;
}

.chapter-list__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 22px;
	border-bottom: 1px solid var(--color-border-subtle);
}

.chapter-row {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 22px;
	border-bottom: 1px solid var(--color-border-faint);
	cursor: pointer;
	transition: background 0.16s ease;
	text-decoration: none;
}

.chapter-row:last-child {
	border-bottom: none;
}

.chapter-row:hover {
	background: var(--color-row-hover);
}

.chapter-row__num {
	width: 30px;
	flex: none;
	font-size: 13px;
	color: var(--color-ink-faint);
	font-variant-numeric: tabular-nums;
}

.chapter-row__main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.chapter-row__title {
	font-family: var(--font-serif);
	font-size: 15.5px;
	color: var(--color-ink-strong);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chapter-row__title--untitled {
	font-style: italic;
	color: var(--color-ink-body);
}

.chapter-row__meta-inline {
	display: none;
	font-size: 12.5px;
	color: var(--color-ink-muted);
}

.chapter-row__words,
.chapter-row__date {
	flex: none;
	text-align: right;
	font-size: 13px;
	color: var(--color-ink-muted);
	font-variant-numeric: tabular-nums;
}

.chapter-row__words {
	width: 92px;
}

.chapter-row__date {
	width: 104px;
	color: var(--color-ink-faint);
}

.chapter-row__status {
	width: 116px;
	flex: none;
	display: flex;
	justify-content: flex-end;
}

/*
 * A chapter row carrying an editor's note (_review_state === needs_revision).
 * Unlike the old --locked variant this replaced, the row stays a real,
 * clickable <a> (no more locking at any chapter state) — only the layout
 * (stacked column, note below) and tone (amber, matching the Needs
 * Revision badge) are reused from that pattern.
 */
.chapter-row--noted {
	background: rgba(208, 162, 92, 0.06);
	border-left: 2px solid var(--color-status-active);
	flex-direction: column;
	align-items: stretch;
	padding: 16px 22px 14px;
}

.chapter-row--noted:hover {
	background: rgba(208, 162, 92, 0.1);
}

.chapter-row--noted .chapter-row__top {
	display: flex;
	align-items: center;
	gap: 16px;
}

.chapter-row__note {
	padding-left: 46px;
	margin-top: 8px;
	display: flex;
	align-items: flex-start;
	gap: 7px;
	font-size: 12px;
	line-height: 1.5;
	color: #c9a35f;
}

.chapter-row__note svg {
	flex: none;
	margin-top: 2px;
}

.chapter-row__note strong {
	color: #dcb779;
	font-weight: 600;
}

@media (max-width: 700px) {
	.chapter-row {
		gap: 12px;
		padding: 18px 14px;
		border-radius: var(--radius-lg);
		border-bottom: none;
	}

	.chapter-row__title {
		white-space: normal;
		font-size: 16.5px;
	}

	.chapter-row__meta-inline {
		display: block;
	}

	.chapter-row__words,
	.chapter-row__date {
		display: none;
	}

	.chapter-row__status {
		width: auto;
		justify-content: flex-start;
	}

	.chapter-row__main {
		gap: 10px;
	}

	.chapter-row__main .field__row {
		align-items: center;
	}

	.chapter-row--noted {
		border-radius: var(--radius-lg);
		border: 1px solid rgba(208, 162, 92, 0.18);
	}

	.chapter-row__note {
		padding-left: 0;
	}
}

/*
 * Empty state inside the Chapters section on Story Detail — lighter than
 * the dashboard's full .empty-state (icon + one line only), since the
 * real call to action here is the "+ Add chapter" button below it, not
 * inside this box.
 */
.chapter-list__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 48px 20px;
	color: var(--color-ink-muted);
	font-size: 13px;
}

.chapter-list__empty svg {
	opacity: 0.5;
}

/*--------------------------------------------------------------
Cover placeholder

Generative concentric-circle art for stories without a cover image.
Six fixed palettes selected deterministically (story ID mod 6) by
the cover-placeholder template-part — see that file for the mapping.
--------------------------------------------------------------*/

.cover-placeholder {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.cover-placeholder::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 50% 38%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.4));
}

.cover-placeholder::after {
	content: '';
	position: absolute;
	inset: 14px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 3px;
}

.cover-placeholder--sm::after {
	inset: 8px;
	border-radius: 2px;
}

.cover-placeholder__glyph {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cover-placeholder--1 {
	background: linear-gradient(158deg, #3d2130, #20101a);
}

.cover-placeholder--1 .cover-placeholder__glyph {
	color: #d79ba6;
}

.cover-placeholder--2 {
	background: linear-gradient(158deg, #1c2545, #0e1526);
}

.cover-placeholder--2 .cover-placeholder__glyph {
	color: #8ba1cf;
}

.cover-placeholder--3 {
	background: linear-gradient(158deg, #3d2913, #211407);
}

.cover-placeholder--3 .cover-placeholder__glyph {
	color: #d8ab6a;
}

.cover-placeholder--4 {
	background: linear-gradient(158deg, #2a2a2f, #141416);
}

.cover-placeholder--4 .cover-placeholder__glyph {
	color: #a7a7b0;
}

.cover-placeholder--5 {
	background: linear-gradient(158deg, #17332f, #0b1c1a);
}

.cover-placeholder--5 .cover-placeholder__glyph {
	color: #7fb8ac;
}

.cover-placeholder--6 {
	background: linear-gradient(158deg, #22322e, #152220);
}

.cover-placeholder--6 .cover-placeholder__glyph {
	color: #a9c79c;
}

/*--------------------------------------------------------------
Empty state
--------------------------------------------------------------*/

.empty-state {
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-xl);
	background: linear-gradient(180deg, #131110, #0f0d0c);
	padding: 78px 40px 82px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 26px;
	text-align: center;
}

.empty-state__copy {
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: 400px;
}

.empty-state__title {
	margin: 0;
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 27px;
	color: var(--color-ink-primary);
}

.empty-state__text {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 16px;
	line-height: 1.7;
	color: var(--color-ink-muted);
	font-style: italic;
}

/*--------------------------------------------------------------
Tabs
--------------------------------------------------------------*/

.tabs {
	display: flex;
}

.tabs__tab {
	flex: 1;
	text-align: center;
	padding: 12px 8px;
	font-size: 14px;
	font-weight: 600;
	background: transparent;
	border: none;
	border-bottom: 2px solid var(--color-border-subtle);
	color: var(--color-ink-faint);
	cursor: pointer;
	transition: var(--ease-standard);
}

.tabs__tab.is-active {
	color: var(--color-ink-primary);
	border-bottom-color: var(--color-accent);
}

/*--------------------------------------------------------------
Custom checkbox
--------------------------------------------------------------*/

.checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 11px;
	cursor: pointer;
	padding: 2px 0;
}

/*
 * A real <input type="checkbox"> sits invisibly on top of the visual box
 * and drives it via :checked — no JS needed, and the control keeps its
 * native keyboard/screen-reader semantics (the mockup's version was a
 * div toggled by framework state, which a plain click handler could only
 * approximate).
 */
.checkbox-box {
	position: relative;
	width: 20px;
	height: 20px;
	flex: none;
	margin-top: 1px;
}

.checkbox-native {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.checkbox-custom {
	position: absolute;
	inset: 0;
	border-radius: 5px;
	border: 1.5px solid var(--color-border-strong);
	background: var(--color-page-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-accent-ink);
	transition: var(--ease-fast);
}

.checkbox-custom svg {
	opacity: 0;
	transition: opacity 0.12s ease;
}

.checkbox-native:checked + .checkbox-custom {
	border-color: transparent;
	background: var(--color-accent);
}

.checkbox-native:checked + .checkbox-custom svg {
	opacity: 1;
}

.checkbox-native:focus-visible + .checkbox-custom {
	box-shadow: 0 0 0 3px var(--color-accent-focus-ring);
}

.checkbox-label__text {
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--color-ink-muted);
}

/*--------------------------------------------------------------
Modal
--------------------------------------------------------------*/

.modal-scrim {
	position: fixed;
	inset: 0;
	background: rgba(8, 7, 6, 0.72);
	backdrop-filter: blur(3px);
	z-index: 100;
}

.modal {
	position: fixed;
	inset: 0;
	z-index: 101;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.modal__panel {
	width: 452px;
	max-width: 100%;
	background: var(--color-raised);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-xl);
	padding: 44px 40px 34px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8);
}

.modal__emblem {
	position: relative;
	width: 74px;
	height: 74px;
	margin-bottom: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.modal__emblem-ring {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 1px solid var(--color-accent-soft-border);
	animation: nw-ring 2.6s ease-out infinite;
}

.modal__emblem-core {
	width: 74px;
	height: 74px;
	border-radius: 50%;
	background: radial-gradient(circle at 50% 38%, rgba(207, 148, 132, 0.28), rgba(207, 148, 132, 0.08));
	border: 1px solid var(--color-accent-soft-border);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--color-accent-on-dark);
}

.modal__title {
	margin: 0 0 12px;
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 25px;
	letter-spacing: -0.01em;
	color: var(--color-ink-primary);
}

.modal__text {
	margin: 0 0 30px;
	font-size: 14px;
	line-height: 1.65;
	color: var(--color-ink-muted);
	max-width: 340px;
}

.modal__actions {
	display: flex;
	gap: 12px;
	width: 100%;
}

.modal__actions .btn {
	flex: 1;
}

/*
 * Third, lower-emphasis action on the chapter-submitted modal: dismiss and
 * keep writing right here, rather than navigating away — worth having
 * now that submitting no longer locks the chapter. Deliberately not a
 * .btn (this is a "never mind, close this" action, not a real choice on
 * par with "Back to story"/"Write next chapter").
 */
.modal__dismiss {
	margin-top: 14px;
	background: none;
	border: none;
	padding: 4px;
	font-size: 13px;
	color: var(--color-ink-faint);
	cursor: pointer;
	transition: color 0.16s ease;
}

.modal__dismiss:hover {
	color: var(--color-ink-muted);
}

@keyframes nw-ring {
	from {
		opacity: 0.8;
		transform: scale(1);
	}

	to {
		opacity: 0;
		transform: scale(1.35);
	}
}

@keyframes nw-draw {
	from {
		stroke-dashoffset: 24;
	}

	to {
		stroke-dashoffset: 0;
	}
}

/*--------------------------------------------------------------
Chapter editor

Desktop and mobile are genuinely different layouts here (not just a
reflow of the same elements — the title field moves in/out of the top
bar, the toolbar becomes sticky, Submit moves into the top nav), so each
breakpoint gets its own markup gated by .u-desktop-only / .u-mobile-only
rather than one shared structure. Both write into the same #editor-canvas
mount point in between.
--------------------------------------------------------------*/

/* Chapter Editor's main-content wrapper — see the sticky-footer flex
   rules on body.nw-app / .app-shell in the Page shell section above;
   #editor-root is this template's equivalent (it has no .app-shell of
   its own, since #editor-state-notice already claims that class for
   the error state). */
#editor-root {
	flex: 1;
}

/*
 * Wraps .editor-topbar + .editor-toolbar (desktop) as one sticky unit so
 * both stay pinned to the viewport while scrolling a long chapter — the
 * same reasoning already applied to the mobile top bar and its own sticky
 * bottom toolbar. `display: block` (not the `.u-desktop-only` default of
 * inline-flex) is deliberate: this wrapper only needs to stack its two
 * full-width children vertically, not lay them out itself.
 *
 * The `top` offset accounts for the WP admin bar, which is only ever
 * `position: fixed` (and therefore only ever actually overlaps fixed/sticky
 * content) at viewport widths of 783px and up — WP itself switches the
 * admin bar to `position: absolute` below that (its own breakpoint is
 * max-width: 782px), so it scrolls away with the page instead of staying
 * pinned, and no offset is needed there. `body.admin-bar` is the class core
 * adds automatically via body_class() only when the current user can see
 * the bar, so logged-out visitors (and admins with it disabled in their
 * profile) get `top: 0` with no gap.
 */
.editor-sticky-header {
	display: block;
	position: sticky;
	top: 0;
	z-index: 5;
	background: var(--color-base);
}

@media screen and (min-width: 783px) {
	body.admin-bar .editor-sticky-header {
		top: 32px;
	}
}

.editor-topbar {
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 15px 26px;
	border-bottom: 1px solid var(--color-border-subtle);
}

.editor-topbar__back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13.5px;
	font-weight: 500;
	color: var(--color-ink-muted);
	text-decoration: none;
	white-space: nowrap;
	flex: none;
	transition: color 0.16s ease;
}

.editor-topbar__back:hover {
	color: var(--color-ink-strong);
}

.editor-topbar__title {
	flex: 1;
	min-width: 0;
	background: transparent;
	border: none;
	border-bottom: 1px solid transparent;
	color: var(--color-ink-primary);
	font-family: var(--font-content);
	font-size: 21px;
	font-weight: 500;
	letter-spacing: -0.005em;
	padding: 4px 4px;
	outline: none;
	transition: border-color 0.16s ease;
}

.editor-topbar__title:hover {
	border-bottom-color: var(--color-border-subtle);
}

.editor-topbar__title:focus {
	border-bottom-color: var(--color-accent);
}

.editor-topbar__count {
	font-size: 13px;
	color: var(--color-ink-faint);
	white-space: nowrap;
	flex: none;
	font-variant-numeric: tabular-nums;
}

.editor-toolbar {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 9px 24px;
	border-bottom: 1px solid var(--color-border-subtle);
	background: var(--color-well);
}

.toolbar-btn {
	width: 34px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-radius: 7px;
	color: var(--color-ink-muted);
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.15s ease;
}

.toolbar-btn:hover {
	background: var(--color-raised);
	color: var(--color-ink-strong);
}

.toolbar-btn.is-active {
	background: var(--color-surface-hover);
	color: var(--color-ink-strong);
}

/*
 * Without this, the blockquote/image/video icon SVGs collapse to
 * ~6px wide (height stays correct) while B/I/U/H render at full
 * weight beside them — a flex-item sizing bug, not just a color/size
 * choice: `.toolbar-btn` is `display:flex` with a single SVG child,
 * and a flex item's automatic minimum width for a replaced element
 * can resolve well below its own `width` attribute once the browser
 * treats that attribute as adjustable content size rather than a
 * hard size. `flex-shrink: 0` plus an explicit CSS size (which wins
 * over the HTML attribute) fixes both the collapse and gets these
 * icons closer to the bold text glyphs' visual weight.
 */
.toolbar-btn svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.toolbar-divider {
	width: 1px;
	height: 20px;
	background: var(--color-surface-hover);
	margin: 0 8px;
	flex: none;
}

.toolbar-spacer {
	flex: 1;
}

/*
 * Admin's "needs revision" note, surfaced directly above the first
 * paragraph — only ever shown for that one _review_state (see
 * js/chapter-editor.js's showRevisionNote()). Uses the same active/amber
 * tone Story Detail's chapter-row badge uses for this same state, so the
 * two "editor's note" surfaces read as the same concept wherever an
 * author sees them. Nested inside .editor-canvas-inner (not a sibling of
 * .editor-canvas-wrap) so it shares the canvas's own 660px measure and
 * centering, reading as part of the writing surface rather than a
 * full-width chrome bar spanning the topbar/toolbar's wider area — no
 * horizontal margin of its own, since the parent's padding/max-width
 * already positions it.
 */
.editor-note {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin: 0 0 28px;
	padding: 14px 18px;
	border-radius: var(--radius-md);
	background: var(--color-status-active-bg);
	border: 1px solid var(--color-status-active-border);
}

/*
 * A class-selector `display` always beats the `[hidden]` UA-stylesheet
 * default (author styles win over user-agent styles at equal or lower
 * specificity, regardless of source order) — without this, the `hidden`
 * attribute page-chapter-editor.php sets by default is silently ignored
 * and the note renders on every chapter, including brand-new ones with
 * no _review_state at all. Same class of bug as the earlier
 * .u-desktop-only/.u-mobile-only fix.
 */
.editor-note[hidden] {
	display: none;
}

.editor-note__icon {
	flex: none;
	margin-top: 1px;
	color: var(--color-status-active-ink);
}

.editor-note__body {
	flex: 1;
	min-width: 0;
}

.editor-note__title {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	color: var(--color-status-active-ink);
}

.editor-note__text {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--color-ink-body);
}

.editor-note__close {
	flex: none;
	background: none;
	border: none;
	padding: 2px 4px;
	font-size: 18px;
	line-height: 1;
	color: var(--color-status-active-ink);
	cursor: pointer;
}

.editor-note__close:hover {
	color: var(--color-ink-strong);
}

@media (max-width: 700px) {
	.editor-note {
		margin: 0 0 20px;
	}
}

.editor-canvas-wrap {
	padding: 72px 40px 56px;
}

.editor-canvas-inner {
	max-width: 660px;
	margin: 0 auto;
}

.editor-bottombar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 26px;
	border-top: 1px solid var(--color-border-subtle);
	background: var(--color-well);
}

.editor-bottombar__autosave {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	color: var(--color-ink-faint);
}

.editor-bottombar__autosave-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--color-status-positive);
	box-shadow: 0 0 0 3px rgba(133, 168, 119, 0.16);
}

.editor-bottombar__actions {
	display: flex;
	align-items: center;
	gap: 14px;
}

/* ProseMirror content — the actual TipTap-mounted editable area. */

.editor-canvas-inner .ProseMirror {
	font-family: var(--font-content);
	font-size: 19px;
	line-height: 1.9;
	color: var(--color-ink-body);
	outline: none;
	min-height: 60vh;
}

.editor-canvas-inner .ProseMirror video,
.editor-canvas-inner .ProseMirror img {
	max-width: 100%;
	height: auto;
}

.editor-canvas-inner .ProseMirror p {
	margin: 0 0 26px;
}

.editor-canvas-inner .ProseMirror p:last-child {
	margin-bottom: 0;
}

.editor-canvas-inner .ProseMirror h2 {
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 26px;
	color: var(--color-ink-strong);
	margin: 40px 0 20px;
}

.editor-canvas-inner .ProseMirror blockquote {
	margin: 0 0 26px;
	padding-left: 20px;
	border-left: 2px solid var(--color-border-strong);
	color: var(--color-ink-muted);
	font-style: italic;
}

.editor-canvas-inner .ProseMirror p.is-editor-empty:first-child::before {
	content: attr(data-placeholder);
	float: left;
	height: 0;
	color: var(--color-ink-faint);
	pointer-events: none;
}

/* Mobile — sticky top bar, separate title row, sticky bottom toolbar. */

.editor-topbar--mobile {
	position: sticky;
	top: 0;
	z-index: 5;
	display: grid;
	grid-template-columns: 44px 1fr auto;
	align-items: center;
	gap: 8px;
	padding: 6px 14px 10px;
	border-bottom: 1px solid var(--color-border-subtle);
	background: var(--color-base);
}

.editor-topbar__back-icon {
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-radius: 10px;
	color: var(--color-ink-body);
	text-decoration: none;
	transition: background 0.16s ease;
}

.editor-topbar__back-icon:hover {
	background: var(--color-row-hover);
}

.editor-topbar__story-name {
	text-align: center;
	font-size: 12.5px;
	color: var(--color-ink-faint);
	letter-spacing: 0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.editor-title-row--mobile {
	padding: 18px 22px 8px;
}

.editor-title-row--mobile .editor-topbar__title {
	font-size: 26px;
	padding: 0 4px;
}

.editor-toolbar--mobile {
	position: sticky;
	bottom: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 8px;
	border-top: 1px solid var(--color-border-subtle);
	background: var(--color-well);
}

.editor-toolbar--mobile .toolbar-btn {
	width: 38px;
	height: 44px;
}

.editor-toolbar--mobile__meta {
	display: flex;
	align-items: center;
	gap: 4px;
	padding-right: 2px;
}

@media (max-width: 700px) {
	.editor-canvas-wrap {
		padding: 8px 22px 24px;
	}

	.editor-canvas-inner .ProseMirror {
		font-size: 18px;
		line-height: 1.95;
	}
}

/*--------------------------------------------------------------
Auth

Unlike every other screen, the bordered/shadowed card here is real UI,
not just the mockup's "here is one screen" presentation frame — a
centered split card reads as an intentional, distinct treatment for the
sign-in moment, so it's kept as designed rather than unwrapped into a
full-bleed page the way Dashboard/Story Detail/etc. were.
--------------------------------------------------------------*/

.auth-shell {
	flex: 1;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48px;
}

.auth-card {
	width: 1000px;
	max-width: 100%;
	min-height: 640px;
	display: flex;
	background: var(--color-base);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-xl);
	overflow: hidden;
	box-shadow: 0 50px 110px -50px rgba(0, 0, 0, 0.95);
}

.auth-panel-art {
	width: 44%;
	flex: none;
	position: relative;
	background:
		radial-gradient(120% 90% at 28% 18%, rgba(207, 148, 132, 0.16), transparent 55%),
		radial-gradient(110% 80% at 82% 92%, rgba(122, 68, 92, 0.26), transparent 60%),
		linear-gradient(155deg, #2b1a23, #140b11 72%);
}

.auth-panel-art::before {
	content: '';
	position: absolute;
	inset: 20px;
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 10px;
}

.auth-panel-art__glyph {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.auth-panel-art__quote {
	position: absolute;
	left: 44px;
	right: 44px;
	bottom: 44px;
	margin: 0;
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 22px;
	line-height: 1.5;
	color: rgba(245, 231, 231, 0.82);
}

.auth-panel-form {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding: 44px 52px 30px;
}

.auth-brand {
	display: flex;
	align-items: center;
	margin-bottom: 34px;
}

.auth-brand__logo {
	display: block;
	width: auto;
	height: 34px;
}

.auth-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.auth-form__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.auth-form__forgot {
	font-size: 12px;
	color: var(--color-ink-muted);
	text-decoration: none;
	transition: color 0.16s ease;
}

.auth-form__forgot:hover {
	color: var(--color-accent-on-dark);
}

.auth-footer {
	margin: 22px 0 0;
	font-size: 11px;
	line-height: 1.6;
	color: var(--color-ink-disabled);
	text-align: center;
}

@media (max-width: 700px) {
	.auth-shell {
		padding: 0;
	}

	.auth-card {
		border-radius: 0;
		min-height: 100vh;
	}

	.auth-panel-art {
		display: none;
	}

	.auth-panel-form {
		padding: 32px 24px 24px;
	}
}

/*--------------------------------------------------------------
FAQ accordion

Static, server-rendered Q&A (page-faq.php) — three sections, each a
list of collapsible items. Questions in serif to match every other
heading in this app; answers in the default sans body font. Expand
indicator (chevron) uses the accent color and rotates via the
question button's own aria-expanded state, not a separate JS-toggled
class — one less thing to keep in sync.
--------------------------------------------------------------*/

.faq-section {
	margin-top: 36px;
}

.faq-section:first-of-type {
	margin-top: 28px;
}

.faq-section__title {
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 20px;
	color: var(--color-ink-primary);
	margin-bottom: 14px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--color-border-subtle);
}

.faq-item {
	border-bottom: 1px solid var(--color-border-faint);
}

.faq-item:last-child {
	border-bottom: none;
}

.faq-item__question {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	padding: 16px 4px;
	background: none;
	border: none;
	text-align: left;
	font-family: var(--font-serif);
	font-size: 16px;
	color: var(--color-ink-primary);
	cursor: pointer;
}

.faq-item__question:hover {
	color: var(--color-accent-on-dark);
}

.faq-item__icon {
	flex: none;
	color: var(--color-accent);
	transition: transform 0.18s ease;
}

.faq-item__question[aria-expanded="true"] .faq-item__icon {
	transform: rotate(180deg);
}

.faq-item__answer {
	padding: 0 4px 20px;
	font-size: 14.5px;
	line-height: 1.7;
	color: var(--color-ink-body);
	max-width: 720px;
}

.faq-item__answer[hidden] {
	display: none;
}

.faq-item__answer p + p {
	margin-top: 12px;
}

.faq-item__list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.faq-item__list em {
	font-style: normal;
	color: var(--color-ink-primary);
	font-weight: 500;
}

.faq-item__answer a {
	color: var(--color-accent-on-dark);
}

/*--------------------------------------------------------------
Default WordPress templates (index/single/page + comments)

Styling for the stock Underscores templates that aren't part of this
app's own screens but are genuinely reachable by a logged-in user —
see BUILD_PROGRESS.md's default-templates audit. Kept deliberately
plain: these are leftover-content fallbacks, not signature screens, so
this reuses existing tokens/primitives rather than introducing new
component patterns.
--------------------------------------------------------------*/

.nw-entry {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin-bottom: 40px;
	padding-bottom: 40px;
	border-bottom: 1px solid var(--color-border-subtle);
}

.nw-entry:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.nw-entry__header {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nw-entry__title-link {
	color: inherit;
	text-decoration: none;
}

.nw-entry__title-link:hover {
	color: var(--color-accent-on-dark);
}

.nw-entry__thumbnail img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-lg);
	display: block;
}

.nw-entry__content > * + * {
	margin-top: 16px;
}

.nw-entry__content h2,
.nw-entry__content h3,
.nw-entry__content h4 {
	font-family: var(--font-serif);
	font-weight: 500;
	color: var(--color-ink-primary);
}

.nw-entry__content ul,
.nw-entry__content ol {
	padding-left: 22px;
}

.nw-entry__content blockquote {
	padding-left: 18px;
	border-left: 2px solid var(--color-accent);
	color: var(--color-ink-muted);
	font-style: italic;
}

.nw-entry__content a {
	color: var(--color-accent-on-dark);
}

.nw-entry__content img {
	max-width: 100%;
	height: auto;
	border-radius: var(--radius-md);
}

.nw-entry__page-links,
.nw-entry__footer {
	font-size: 13px;
	color: var(--color-ink-muted);
}

.nw-entry__edit-link a {
	color: var(--color-ink-muted);
}

/* Post/comment prev-next navigation (the_post_navigation(),
   the_posts_navigation(), the_comments_navigation() all share this
   same markup shape via WP core's _navigation_markup()). */
.post-navigation,
.posts-navigation,
.comment-navigation {
	margin-top: 32px;
	padding-top: 20px;
	border-top: 1px solid var(--color-border-subtle);
}

.post-navigation .nav-links,
.comment-navigation .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 16px;
}

.posts-navigation .nav-links {
	display: flex;
	justify-content: center;
	gap: 24px;
}

.nav-previous a,
.nav-next a,
.posts-navigation .nav-links a {
	color: var(--color-ink-body);
	text-decoration: none;
}

.nav-previous a:hover,
.nav-next a:hover,
.posts-navigation .nav-links a:hover {
	color: var(--color-accent-on-dark);
}

.nw-entry__nav-title {
	display: block;
	font-family: var(--font-serif);
	font-size: 15px;
	margin-top: 2px;
}

/* Comments */

.comments-area {
	margin-top: 40px;
	padding-top: 32px;
	border-top: 1px solid var(--color-border-subtle);
}

.comments-title {
	margin-bottom: 18px;
}

.comment-list {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.comment-list .children {
	list-style: none;
	margin: 18px 0 0;
	padding: 0 0 0 28px;
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.comment-body {
	padding: 16px 18px;
	background: var(--color-well);
	border: 1px solid var(--color-border-subtle);
	border-radius: var(--radius-md);
}

.comment-author {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: var(--color-ink-primary);
}

.comment-author .avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
}

.comment-author .says {
	display: none;
}

.comment-metadata {
	font-size: 12px;
	color: var(--color-ink-faint);
	margin-bottom: 8px;
}

.comment-metadata a {
	color: inherit;
}

.comment-content {
	font-size: 14.5px;
	line-height: 1.65;
	color: var(--color-ink-body);
}

.comment-reply-link {
	display: inline-block;
	margin-top: 8px;
	font-size: 12.5px;
	color: var(--color-accent-on-dark);
	text-decoration: none;
}

.no-comments {
	margin-bottom: 16px;
}

/* Comment form (comment_form()'s own default markup/classes) */

#commentform {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.comment-notes,
.comment-form-cookies-consent {
	font-size: 13px;
	color: var(--color-ink-muted);
}

.comment-form-author input,
.comment-form-email input,
.comment-form-url input,
.comment-form-comment textarea,
#commentform input[type="text"],
#commentform input[type="email"],
#commentform input[type="url"],
#commentform textarea {
	width: 100%;
	margin-top: 6px;
	padding: 10px 14px;
	background: var(--color-base);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-ink-strong);
	font-family: var(--font-sans);
	font-size: 14px;
}

.comment-form-author input:focus,
.comment-form-email input:focus,
.comment-form-url input:focus,
.comment-form-comment textarea:focus,
#commentform textarea:focus {
	outline: none;
	border-color: var(--color-accent);
	box-shadow: 0 0 0 3px var(--color-accent-focus-ring);
}

.comment-form-comment label,
.comment-form-author label,
.comment-form-email label,
.comment-form-url label {
	font-size: 13px;
	color: var(--color-ink-muted);
}

.form-submit input[type="submit"] {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 22px;
	background: var(--color-accent);
	color: var(--color-accent-ink);
	border: none;
	border-radius: var(--radius-md);
	font-weight: 500;
	font-size: 14px;
	cursor: pointer;
	transition: var(--ease-fast);
}

.form-submit input[type="submit"]:hover {
	background: var(--color-accent-hover, var(--color-accent));
}

.comment-reply-title {
	font-family: var(--font-serif);
	font-weight: 500;
	font-size: 18px;
	color: var(--color-ink-primary);
	margin-bottom: 10px;
}

.logged-in-as {
	font-size: 13px;
	color: var(--color-ink-muted);
	margin-bottom: 14px;
}

.logged-in-as a {
	color: var(--color-accent-on-dark);
}

/*--------------------------------------------------------------
Legal page content

page-legal.php's rendering of the_content() for Privacy Policy /
Terms & Conditions / any similar policy Page. Deliberately its own
typography, not a reuse of .nw-prose (serif throughout, tuned for
story-chapter reading): policy text reads better sans-serif in the
body with serif reserved for the pasted content's own H2/H3 section
headings, matching how .faq-item__question / .faq-section__title
already split serif-heading/sans-body in this same app. "Last
updated" gets no special markup here — per the user, it's simplest as
a plain line the author writes into the content itself (naturally
picks up the italic/emphasis styling below if written as an <em> or
<strong> line), not something derived from the Page's modified date.
--------------------------------------------------------------*/

.legal-content {
	font-family: var(--font-sans);
	font-size: 15.5px;
	line-height: 1.8;
	color: var(--color-ink-body);
}

.legal-content > * + * {
	margin-top: 22px;
}

.legal-content h2,
.legal-content h3 {
	font-family: var(--font-serif);
	font-weight: 500;
	color: var(--color-ink-primary);
}

.legal-content h2 {
	font-size: 23px;
	line-height: 1.3;
	margin-top: 48px;
}

.legal-content h3 {
	font-size: 18px;
	line-height: 1.4;
	margin-top: 36px;
}

.legal-content > h2:first-child,
.legal-content > h3:first-child {
	margin-top: 0;
}

.legal-content ul,
.legal-content ol {
	padding-left: 24px;
}

.legal-content li + li {
	margin-top: 8px;
}

.legal-content strong {
	color: var(--color-ink-strong);
	font-weight: 600;
}

.legal-content em {
	color: var(--color-ink-muted);
	font-style: italic;
}

.legal-content a {
	color: var(--color-accent-on-dark);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.legal-content a:hover {
	color: var(--color-accent-hover);
}
