/*
 * Discovery Bible theme styles.
 *
 * Ported from apps/web-public/app/globals.css (the Next.js site). Tokens live
 * in theme.json; this file adds what theme.json cannot express: dark mode,
 * the block styles in inc/block-styles.php, the header, and motion. The
 * custom blocks carry their own CSS in src/blocks/<name>/style.css.
 *
 * Loaded on the site and in the editor (add_editor_style), so editors see
 * what visitors see.
 */

/* ───────────────────────── tokens ───────────────────────── */

:root {

	/* The brand where it is text, a rule or a ring. Buttons keep the brand
	   itself in both themes: their text sits on it, not beside it. */
	--dbp-accent: var(--wp--preset--color--primary);
	--dbp-accent-wash: color-mix(in srgb, var(--wp--preset--color--primary) 12%, transparent);
	--dbp-night-label: color-mix(in srgb, var(--wp--preset--color--primary) 35%, #ffd9d6);
	--dbp-night-edge: rgb(255 255 255 / 8%);
	--dbp-header-glass: rgb(255 255 255 / 94%);
	--dbp-error: #b42318;
	--dbp-bezel: #1b1917;
	--dbp-bezel-ring: transparent;
	--dbp-elevated: #fff;
	--dbp-hover: #f5f5f4;
	--dbp-border: #e7e5e4;
	--dbp-emphasis: #005fcc;
	--dbp-shadow-frame: 0 1px 2px rgb(27 25 23 / 4%), 0 24px 60px -28px rgb(27 25 23 / 28%);
	--dbp-shadow-frame-night: 0 40px 90px -40px rgb(0 0 0 / 90%);
	--dbp-shadow-phone: 0 30px 70px -30px rgb(27 25 23 / 45%);
	--dbp-shadow-card: 0 30px 60px -40px rgb(27 25 23 / 35%);
	--dbp-shadow-field: 0 18px 40px -30px rgb(27 25 23 / 45%);
	--dbp-shot-dim: none;
}

/*
 * Dark: a warm near-black ground, not an inversion. Two copies of one block
 * that must stay identical:
 *  - [data-theme="dark"] is what the head script (inc/assets.php) sets;
 *  - the media query covers a visit with no script, where nothing sets it.
 * Re-mapping the presets means every block coloured from the palette follows.
 */
:root[data-theme="dark"] {
	color-scheme: dark;
	--wp--preset--color--paper: #161311;
	--wp--preset--color--stone: #1e1a17;
	--wp--preset--color--surface-muted: #1b1714;
	--wp--preset--color--rule: #36302b;
	--wp--preset--color--ink: #f3ede7;
	--wp--preset--color--body: #e8e1da;
	--wp--preset--color--muted: #b3a99f;
	--wp--preset--color--border-strong: #4d453e;
	--wp--preset--color--night: #0d0b0a;
	--dbp-accent: color-mix(in srgb, var(--wp--preset--color--primary) 45%, #ffd9d6);
	--dbp-accent-wash: color-mix(in srgb, var(--dbp-accent) 18%, transparent);
	--dbp-night-edge: rgb(255 255 255 / 10%);
	--dbp-header-glass: rgb(22 19 17 / 90%);
	--dbp-error: #ff9d90;
	--dbp-bezel: #2b2623;
	--dbp-bezel-ring: rgb(255 255 255 / 8%);
	--dbp-elevated: #221e1b;
	--dbp-hover: #2a2522;
	--dbp-border: #36302b;
	--dbp-emphasis: #9dc1ff;
	--dbp-shadow-frame: 0 1px 2px rgb(0 0 0 / 30%), 0 24px 60px -28px rgb(0 0 0 / 80%);
	--dbp-shadow-frame-night: 0 40px 90px -40px rgb(0 0 0 / 95%);
	--dbp-shadow-phone: 0 30px 70px -30px rgb(0 0 0 / 85%);
	--dbp-shadow-card: 0 30px 60px -40px rgb(0 0 0 / 80%);
	--dbp-shadow-field: 0 18px 40px -30px rgb(0 0 0 / 80%);
	--dbp-shot-dim: brightness(0.92);
}

@media (prefers-color-scheme: dark) {

	:root:not([data-theme]) {
		color-scheme: dark;
		--wp--preset--color--paper: #161311;
		--wp--preset--color--stone: #1e1a17;
		--wp--preset--color--surface-muted: #1b1714;
		--wp--preset--color--rule: #36302b;
		--wp--preset--color--ink: #f3ede7;
		--wp--preset--color--body: #e8e1da;
		--wp--preset--color--muted: #b3a99f;
		--wp--preset--color--border-strong: #4d453e;
		--wp--preset--color--night: #0d0b0a;
		--dbp-accent: color-mix(in srgb, var(--wp--preset--color--primary) 45%, #ffd9d6);
		--dbp-accent-wash: color-mix(in srgb, var(--dbp-accent) 18%, transparent);
		--dbp-night-edge: rgb(255 255 255 / 10%);
		--dbp-header-glass: rgb(22 19 17 / 90%);
		--dbp-error: #ff9d90;
		--dbp-bezel: #2b2623;
		--dbp-bezel-ring: rgb(255 255 255 / 8%);
		--dbp-elevated: #221e1b;
		--dbp-hover: #2a2522;
		--dbp-border: #36302b;
		--dbp-emphasis: #9dc1ff;
		--dbp-shadow-frame: 0 1px 2px rgb(0 0 0 / 30%), 0 24px 60px -28px rgb(0 0 0 / 80%);
		--dbp-shadow-frame-night: 0 40px 90px -40px rgb(0 0 0 / 95%);
		--dbp-shadow-phone: 0 30px 70px -30px rgb(0 0 0 / 85%);
		--dbp-shadow-card: 0 30px 60px -40px rgb(0 0 0 / 80%);
		--dbp-shadow-field: 0 18px 40px -30px rgb(0 0 0 / 80%);
		--dbp-shot-dim: brightness(0.92);
	}
}

/* ───────────────────────── base ───────────────────────── */

html {
	color-scheme: light;
	scroll-behavior: smooth;
	scroll-padding-top: 5rem;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
	text-wrap: balance;
}

p {
	text-wrap: pretty;
}

::selection {
	background-color: var(--dbp-accent-wash);
}

:focus-visible {
	outline: 2px solid var(--dbp-accent);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Header, main and footer, and the sections inside the page, sit flush:
   each section brings its own padding. */
.wp-site-blocks > * {
	margin-block: 0;
}

.wp-block-post-content > .alignfull,
.wp-block-post-content > .alignfull + .alignfull {
	margin-block: 0;
}

/* ───────────────────────── header ───────────────────────── */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 50;
}

.dbp-header {
	isolation: isolate;
	background: var(--dbp-header-glass);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--wp--preset--color--rule);
}

.dbp-header__bar {
	min-height: 4rem;
}

.dbp-header .wp-block-site-logo img {
	border-radius: 999px;
}

@media (max-width: 47.99rem) {

	.dbp-header .wp-block-navigation {
		display: none;
	}
}

.dbp-header .wp-block-site-title a:hover {
	opacity: 0.85;
}

/* ───────────────────────── sections ───────────────────────── */

.is-style-section,
.is-style-section-stone,
.is-style-section-night,
.is-style-section-rule {
	padding-block: var(--wp--preset--spacing--section);
}

.is-style-section-stone {
	background: var(--wp--preset--color--stone);
}

.is-style-section-rule {
	border-top: 1px solid var(--wp--preset--color--rule);
}

.is-style-section-night {
	background: var(--wp--preset--color--night);
	color: var(--wp--preset--color--night-text);
	border-block: 1px solid var(--dbp-night-edge);
}

.is-style-section-night :where(h1, h2, h3, h4) {
	color: var(--wp--preset--color--night-text);
}

.is-style-section-night p.is-style-lead,
.is-style-section-night .is-style-features p {
	color: var(--wp--preset--color--night-muted);
}

.is-style-section-night p.is-style-eyebrow {
	color: var(--dbp-night-label);
}

/* The hero's own rhythm: a little tighter above, roomier below. */
.dbp-hero {
	overflow-x: clip;
	padding-block: clamp(3rem, 6vw, 5.5rem) clamp(4rem, 8vw, 6.5rem);
}

/* Two columns that stack below 1024px (core columns stack at 782px). */
@media (max-width: 63.99rem) {

	.wp-block-columns.dbp-split {
		flex-wrap: wrap !important;
	}

	.wp-block-columns.dbp-split > .wp-block-column {
		flex-basis: 100% !important;
	}
}

.wp-block-columns.dbp-split > .wp-block-column {
	min-width: 0;
}

/* ───────────────────────── type ───────────────────────── */

p.is-style-eyebrow {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--dbp-accent);
}

p.is-style-lead {
	max-width: 36rem;
	font-size: var(--wp--preset--font-size--lead);
	line-height: 1.6;
	color: var(--wp--preset--color--muted);
}

p.is-style-note {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--dbp-accent);
}

p.is-style-fine-print {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
}

.wp-block-quote cite {
	display: block;
	margin-top: 0.25rem;
	font-family: var(--wp--preset--font-family--body);
	font-style: normal;
	font-size: var(--wp--preset--font-size--small);
}

/* Features: a title and a sentence on a grid. No cards. */
.is-style-features :where(h3, h4) {
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--feature);
	letter-spacing: 0;
	line-height: 1.35;
}

.is-style-features p {
	margin-top: 0.4rem;
	color: var(--wp--preset--color--muted);
	line-height: 1.6;
}

/* A quiet stone panel (the partnership waitlist). */
.is-style-panel {
	padding: clamp(1.25rem, 3vw, 2rem);
	border: 1px solid var(--wp--preset--color--rule);
	border-radius: 12px;
	background: var(--wp--preset--color--stone);
}

.is-style-panel p:not(.is-style-fine-print) {
	color: var(--wp--preset--color--muted);
}

/* ───────────────────────── images ───────────────────────── */

.wp-block-image.is-style-frame img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--wp--preset--color--rule);
	border-radius: 14px;
	background: var(--wp--preset--color--paper);
	box-shadow: var(--dbp-shadow-frame);
	filter: var(--dbp-shot-dim);
}

.is-style-section-night .wp-block-image.is-style-frame img {
	border-color: var(--dbp-night-edge);
	box-shadow: var(--dbp-shadow-frame-night);
}

/* The phone: its own screen radius and a thin bezel, not a drawn device. */
.wp-block-image.is-style-phone {
	width: min(19rem, 78vw);
	margin-inline: auto;
	padding: 0.5rem;
	border-radius: 2.6rem;
	background: var(--dbp-bezel);
	box-shadow: var(--dbp-shadow-phone), 0 0 0 1px var(--dbp-bezel-ring);
}

.wp-block-image.is-style-phone img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 2.1rem;
	filter: var(--dbp-shot-dim);
}

/* ───────────────────────── buttons ───────────────────────── */

.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wp-block-button.is-style-outline .wp-block-button__link {
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--paper);
	border-color: var(--wp--preset--color--border-strong);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	border-color: var(--wp--preset--color--ink);
}

/* The header's call to action. */
.wp-block-button.is-style-compact .wp-block-button__link {
	min-height: 2.25rem;
	padding-inline: 0.875rem;
	border-radius: 7px;
	font-size: var(--wp--preset--font-size--small);
}

/* A quiet second action: a button's height, an arrow instead of a box. */
.wp-block-button.is-style-arrow-link .wp-block-button__link {
	gap: 0.375rem;
	padding-inline: 0;
	color: var(--wp--preset--color--ink);
	background: transparent;
	border-color: transparent;
}

.wp-block-button.is-style-arrow-link .wp-block-button__link::after {
	content: "→";
	transition: transform 0.2s ease;
}

.wp-block-button.is-style-arrow-link .wp-block-button__link:hover {
	color: var(--dbp-accent);
	background: transparent;
	border-color: transparent;
}

.wp-block-button.is-style-arrow-link .wp-block-button__link:hover::after {
	transform: translateX(3px);
}

/* ───────────────────────── footer ───────────────────────── */

.dbp-footer {
	border-top: 1px solid var(--dbp-border);
}

.dbp-footer .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
}

.dbp-footer .wp-block-navigation-item__content:hover {
	color: var(--dbp-accent);
}

/* Room for the cookie notice while it shows, so the footer scrolls clear. */
.wp-site-blocks::after {
	content: "";
	display: block;
	height: var(--cookie-consent-banner-height, 0);
}

/* ───────────────────────── legal pages ───────────────────────── */

.dbp-legal h2 {
	margin-top: 2.5rem;
	font-size: 1.5rem;
}

.dbp-legal h3 {
	font-size: 1.125rem;
}

.dbp-legal :where(p, li) {
	color: var(--wp--preset--color--body);
}

/* ───────────────────────── cookie notice ───────────────────────── */

.dbp-cookie {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 200;
	padding: 0.75rem max(2.5rem, calc(env(safe-area-inset-right, 0px) + 2.25rem)) max(0.75rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
	border-top: 1px solid var(--dbp-border);
	background: var(--dbp-elevated);
	color: var(--wp--preset--color--body);
	font-family: var(--wp--preset--font-family--body);
}

.dbp-cookie[hidden] {
	display: none;
}

.dbp-cookie__inner {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	max-width: 48rem;
	margin-inline: auto;
}

@media (min-width: 40rem) {

	.dbp-cookie {
		padding: 1rem max(3rem, calc(env(safe-area-inset-right, 0px) + 2.25rem)) max(1rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
	}

	.dbp-cookie__inner {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
		gap: 1rem;
	}
}

.dbp-cookie__text {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.375;
}

.dbp-cookie__text a {
	font-weight: 500;
	color: var(--dbp-emphasis);
	text-decoration: none;
	text-underline-offset: 2px;
}

.dbp-cookie__text a:hover {
	text-decoration: underline;
}

.dbp-cookie__actions {
	display: flex;
	flex-shrink: 0;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.dbp-cookie__actions button {
	padding: 0.375rem 0.75rem;
	border: 1px solid var(--dbp-border);
	border-radius: 6px;
	background: transparent;
	color: var(--wp--preset--color--body);
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 500;
	cursor: pointer;
}

.dbp-cookie__actions button:hover,
.dbp-cookie__dismiss:hover {
	background: var(--dbp-hover);
}

.dbp-cookie__dismiss {
	position: absolute;
	top: 0.5rem;
	right: max(0.5rem, env(safe-area-inset-right, 0px));
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--muted);
	cursor: pointer;
}

.dbp-cookie__dismiss svg {
	width: 1rem;
	height: 1rem;
}

/* ───────────────────────── motion ───────────────────────── */

/* The hero settles in once on load. */
.dbp-enter {
	animation: dbp-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.dbp-enter--1 {
	animation-delay: 0.06s;
}

.dbp-enter--2 {
	animation-delay: 0.12s;
}

.dbp-enter--3 {
	animation-delay: 0.18s;
}

.dbp-enter--4 {
	animation-duration: 0.9s;
	animation-delay: 0.22s;
}

/* Sections rise as they scroll in, tied to scroll position; where scroll
   timelines are missing they simply sit still. Never in the editor. */
@supports (animation-timeline: view()) {

	body:not(.editor-styles-wrapper) .dbp-reveal {
		animation: dbp-reveal linear both;
		animation-timeline: view();
		animation-range: entry 0% entry 55%;
	}
}

@keyframes dbp-rise {

	from {
		opacity: 0;
		transform: translateY(10px);
	}
}

@keyframes dbp-reveal {

	from {
		opacity: 0.25;
		transform: translateY(28px);
	}
}

@media (prefers-reduced-motion: reduce) {

	html {
		scroll-behavior: auto;
	}

	.dbp-enter,
	.dbp-reveal {
		animation: none !important;
	}
}

.dbp-footer .wp-block-dbp-copyright {
	text-align: center;
}

.dbp-footer .wp-block-site-logo img {
	border-radius: 999px;
}

@media (max-width: 39.99rem) {

	.dbp-header .wp-block-site-title {
		font-size: 1.125rem;
	}
}

.dbp-epigraph {
	margin-top: 2.5rem;
}

.dbp-header .wp-block-navigation-item__content {
	transition: color 0.2s ease;
}

.dbp-header .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--ink);
}

.wp-block-quote {
	margin-inline: 0;
}

/* Two versions of one button: the long label on wider screens, the short
   one on phones (the header's call to action). Any block can use these. */
@media (max-width: 39.99rem) {

	.dbp-hide-on-phone {
		display: none !important;
	}
}

@media (min-width: 40rem) {

	.dbp-phone-only {
		display: none !important;
	}
}

.dbp-header .wp-block-site-logo {
	flex-shrink: 0;
}

.dbp-header .wp-block-site-title {
	white-space: nowrap;
}

@media (max-width: 39.99rem) {

	.dbp-header__bar {
		gap: 0.75rem !important;
	}
}

@media (max-width: 39.99rem) {

	.dbp-header__actions {
		gap: 0.25rem !important;
	}
}

/* Narrow phones: everything stays on one line (the Next.js header wraps
   its title and button here). The title gives way first, never overlaps. */
.dbp-header__bar > .wp-block-group:first-child {
	min-width: 0;
}

.dbp-header .wp-block-site-title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

@media (max-width: 24.99rem) {

	.dbp-header .wp-block-site-title {
		font-size: 1rem;
	}
}

@media (max-width: 24.99rem) {

	.dbp-header__bar,
	.dbp-header__bar > .wp-block-group:first-child {
		gap: 0.5rem !important;
	}

	.dbp-header .wp-block-button.is-style-compact .wp-block-button__link {
		padding-inline: 0.75rem;
	}
}
