/* =====================================================================
   eDefines Premium — Design System
   A premium, editorial magazine layer for GeneratePress.
   Sections: 1 Tokens · 2 Base · 3 Header/Chrome · 4 Cards · 5 Grids
   6 Hero · 7 Sections · 8 Single · 9 Footer/CTA · 10 Utilities · 11 Responsive
   ===================================================================== */

/* ----------------------------------------------------------------------
   1. DESIGN TOKENS
---------------------------------------------------------------------- */
:root {
	/* Brand */
	--edp-accent: #c1442e;
	--edp-accent-ink: #ffffff;
	--edp-gold: #b08d57;

	/* Light palette (warm editorial neutrals) */
	--edp-bg: #ffffff;
	--edp-surface: #f7f5f1;
	--edp-surface-2: #efece6;
	--edp-ink: #15120e;
	--edp-ink-soft: #3d362e;
	--edp-muted: #6b6258;
	--edp-line: #e7e2da;
	--edp-line-strong: #d8d2c8;

	/* Typography */
	--edp-font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
	--edp-font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	/* Fluid type scale */
	--edp-fs-eyebrow: 0.78rem;
	--edp-fs-meta: 0.82rem;
	--edp-fs-body: clamp(1.02rem, 0.97rem + 0.25vw, 1.18rem);
	--edp-fs-h3: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
	--edp-fs-h2: clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem);
	--edp-fs-h1: clamp(2.1rem, 1.5rem + 3vw, 3.9rem);
	--edp-fs-hero: clamp(2rem, 1.4rem + 3.4vw, 3.6rem);

	/* Space + shape */
	--edp-shell: 1200px;
	--edp-gap: clamp(1.1rem, 0.8rem + 1.2vw, 2rem);
	--edp-radius: 16px;
	--edp-radius-sm: 10px;
	--edp-shadow: 0 1px 2px rgba(20, 16, 12, .04), 0 8px 24px -12px rgba(20, 16, 12, .18);
	--edp-shadow-lg: 0 24px 60px -28px rgba(20, 16, 12, .35);
	--edp-ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="dark"] {
	--edp-bg: #100f0d;
	--edp-surface: #1a1815;
	--edp-surface-2: #232019;
	--edp-ink: #f3efe8;
	--edp-ink-soft: #d8d1c6;
	--edp-muted: #9f968a;
	--edp-line: #2c2823;
	--edp-line-strong: #38332b;
	--edp-accent: #e0795f;
	--edp-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .6);
	--edp-shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .8);
	color-scheme: dark;
}

/* ----------------------------------------------------------------------
   2. BASE
---------------------------------------------------------------------- */
body.edp {
	background: var(--edp-bg);
	color: var(--edp-ink);
	font-family: var(--edp-font-body);
	font-size: var(--edp-fs-body);
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	transition: background-color .3s var(--edp-ease), color .3s var(--edp-ease);
}

.edp h1, .edp h2, .edp h3, .edp h4 {
	font-family: var(--edp-font-display);
	font-weight: 600;
	line-height: 1.12;
	letter-spacing: -0.015em;
	color: var(--edp-ink);
}

.edp a { color: inherit; text-decoration: none; }
.edp .edp-shell { max-width: var(--edp-shell); margin-inline: auto; padding-inline: clamp(1rem, 0.5rem + 2vw, 2.5rem); }

.edp ::selection { background: var(--edp-accent); color: var(--edp-accent-ink); }

/* Accessible focus */
.edp a:focus-visible,
.edp button:focus-visible,
.edp input:focus-visible {
	outline: 3px solid var(--edp-accent);
	outline-offset: 3px;
	border-radius: 4px;
}

/* ----------------------------------------------------------------------
   3. HEADER CHROME — progress bar, icon buttons, dark toggle
---------------------------------------------------------------------- */
.edp-progress {
	position: fixed;
	inset: 0 0 auto 0;
	height: 3px;
	z-index: 9999;
	background: transparent;
	pointer-events: none;
}
.edp-progress__bar {
	display: block;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--edp-accent), var(--edp-gold));
	transition: width .1s linear;
}

.edp-icon-btn {
	display: inline-grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 0;
	background: transparent;
	color: var(--edp-ink);
	border-radius: 50%;
	cursor: pointer;
	transition: background-color .2s var(--edp-ease), transform .2s var(--edp-ease);
}
.edp-icon-btn:hover { background: var(--edp-surface-2); }
.edp-icon-btn:active { transform: scale(.92); }

.edp-dark-toggle .edp-ico--moon { display: none; }
[data-theme="dark"] .edp-dark-toggle .edp-ico--sun { display: none; }
[data-theme="dark"] .edp-dark-toggle .edp-ico--moon { display: block; }

/* ----------------------------------------------------------------------
   4. ARTICLE CARDS
---------------------------------------------------------------------- */
.edp-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: .9rem;
	background: var(--edp-bg);
}
.edp-card__media {
	position: relative;
	overflow: hidden;
	border-radius: var(--edp-radius);
	aspect-ratio: 3 / 2;
	background: var(--edp-surface-2);
}
.edp-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .6s var(--edp-ease), filter .6s var(--edp-ease);
}
.edp-card__img--placeholder {
	display: block; width: 100%; height: 100%;
	background:
		radial-gradient(120% 120% at 0 0, var(--edp-surface-2), var(--edp-surface));
}
.edp-card:hover .edp-card__img { transform: scale(1.05); }

.edp-card__body { display: flex; flex-direction: column; gap: .55rem; }
.edp-card__title {
	font-size: var(--edp-fs-h3);
	line-height: 1.25;
	letter-spacing: -0.01em;
}
.edp-card__title a { background-image: linear-gradient(var(--edp-accent), var(--edp-accent)); background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .3s var(--edp-ease); }
.edp-card:hover .edp-card__title a { background-size: 100% 2px; }
.edp-card__excerpt { color: var(--edp-muted); font-size: .95rem; margin: 0; }

/* List variant (sidebar / hero side / trending) */
.edp-card--list { flex-direction: row; align-items: flex-start; gap: 1rem; }
.edp-card--list .edp-card__media { flex: 0 0 110px; aspect-ratio: 1 / 1; border-radius: var(--edp-radius-sm); }
.edp-card--list .edp-card__title { font-size: 1.02rem; }

/* Feature variant (bigger) */
.edp-card--feature .edp-card__title { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); }

/* ----------------------------------------------------------------------
   5. GRIDS
---------------------------------------------------------------------- */
.edp-grid { display: grid; gap: var(--edp-gap); }
.edp-grid--magazine { grid-template-columns: repeat(3, 1fr); }
.edp-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* Bento: first card spans 2 cols + 2 rows for an editorial rhythm */
.edp-grid--bento {
	grid-template-columns: repeat(4, 1fr);
	grid-auto-rows: 1fr;
}
.edp-grid--bento > .edp-card:first-child { grid-column: span 2; grid-row: span 2; }
.edp-grid--bento > .edp-card:first-child .edp-card__title { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); }
.edp-grid--bento > .edp-card:nth-child(2) { grid-column: span 2; }

.edp-grid--list { grid-template-columns: 1fr; gap: 1.25rem; }

/* ----------------------------------------------------------------------
   6. HERO
---------------------------------------------------------------------- */
.edp-hero-wrap { padding-top: clamp(1.5rem, 1rem + 2vw, 3rem); }
.edp-hero-grid {
	display: grid;
	grid-template-columns: 1.55fr 1fr;
	gap: var(--edp-gap);
	align-items: stretch;
}
.edp-hero { display: flex; flex-direction: column; gap: 1.1rem; }
.edp-hero__media { display: block; overflow: hidden; border-radius: var(--edp-radius); aspect-ratio: 16 / 9; background: var(--edp-surface-2); box-shadow: var(--edp-shadow); }
.edp-hero__img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--edp-ease); }
.edp-hero__media:hover .edp-hero__img { transform: scale(1.04); }
.edp-hero__title { font-size: var(--edp-fs-hero); }
.edp-hero__title a:hover { color: var(--edp-accent); }
.edp-hero__excerpt { color: var(--edp-muted); font-size: 1.1rem; max-width: 60ch; }
.edp-hero__side { display: flex; flex-direction: column; gap: 1.25rem; justify-content: flex-start; padding-left: clamp(0px, 1vw, 1rem); }
.edp-hero__side .edp-card--list + .edp-card--list { border-top: 1px solid var(--edp-line); padding-top: 1.25rem; }

/* ----------------------------------------------------------------------
   7. SECTIONS, BADGES, META, BUTTONS, TRENDING, TOPICS
---------------------------------------------------------------------- */
.edp-section { padding-block: clamp(2.2rem, 1.5rem + 3vw, 4.5rem); }
.edp-section + .edp-section { padding-top: 0; }
.edp-section__head {
	display: flex; align-items: baseline; justify-content: space-between;
	gap: 1rem; margin-bottom: clamp(1.2rem, 1rem + 1vw, 2rem);
	padding-bottom: .9rem; border-bottom: 1px solid var(--edp-line);
}
.edp-section__title { font-size: var(--edp-fs-h2); position: relative; }
.edp-section__more { font-family: var(--edp-font-body); font-size: .9rem; font-weight: 600; color: var(--edp-accent); white-space: nowrap; }
.edp-section__more:hover { letter-spacing: .01em; }

.edp-badge {
	display: inline-flex; align-items: center; align-self: flex-start;
	font-family: var(--edp-font-body);
	font-size: var(--edp-fs-eyebrow); font-weight: 700;
	letter-spacing: .08em; text-transform: uppercase;
	color: var(--edp-accent);
	padding: .2rem 0;
}
.edp-badge::before { content: ""; width: 18px; height: 2px; background: var(--edp-accent); margin-right: .5rem; }

.edp-meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem;
	font-size: var(--edp-fs-meta); color: var(--edp-muted);
	font-family: var(--edp-font-body);
}
.edp-meta__author { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--edp-ink-soft); }
.edp-meta__avatar { border-radius: 50%; }
.edp-meta__read { display: inline-flex; align-items: center; gap: .3rem; }
.edp-meta__read svg { opacity: .7; }
.edp-meta__updated { color: var(--edp-accent); }
.edp-meta > * { position: relative; }
.edp-meta > * + *:not(.edp-meta__author)::before { content: "·"; position: absolute; left: -.55rem; color: var(--edp-line-strong); }

.edp-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	font-family: var(--edp-font-body); font-weight: 600; font-size: .95rem;
	padding: .8rem 1.4rem; border-radius: 999px; border: 1px solid transparent;
	cursor: pointer; transition: transform .2s var(--edp-ease), box-shadow .2s var(--edp-ease), background-color .2s var(--edp-ease);
}
.edp-btn--solid { background: var(--edp-accent); color: var(--edp-accent-ink); }
.edp-btn--solid:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -10px var(--edp-accent); }
.edp-btn--ghost { background: transparent; border-color: var(--edp-line-strong); color: var(--edp-ink); }
.edp-btn--ghost:hover { border-color: var(--edp-accent); color: var(--edp-accent); }

/* Trending rank list */
.edp-rank { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.4rem 2.4rem; counter-reset: edp; }
.edp-rank__item { display: flex; gap: 1rem; align-items: flex-start; padding-bottom: 1.2rem; border-bottom: 1px solid var(--edp-line); }
.edp-rank__num { font-family: var(--edp-font-display); font-size: 2rem; font-weight: 600; line-height: 1; color: var(--edp-line-strong); min-width: 1.6ch; }
.edp-rank__item:hover .edp-rank__num { color: var(--edp-accent); }
.edp-rank__title { font-size: 1.08rem; line-height: 1.3; margin: .15rem 0 .5rem; }
.edp-rank__title a:hover { color: var(--edp-accent); }

/* Topics tiles */
.edp-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.edp-topic {
	display: flex; flex-direction: column; gap: .25rem;
	padding: 1.2rem 1.3rem; border-radius: var(--edp-radius);
	background: var(--edp-surface); border: 1px solid var(--edp-line);
	transition: transform .25s var(--edp-ease), border-color .25s var(--edp-ease), box-shadow .25s var(--edp-ease);
}
.edp-topic:hover { transform: translateY(-4px); border-color: var(--edp-accent); box-shadow: var(--edp-shadow); }
.edp-topic__name { font-family: var(--edp-font-display); font-weight: 600; font-size: 1.2rem; }
.edp-topic__count { font-size: .82rem; color: var(--edp-muted); }

/* ----------------------------------------------------------------------
   8. SINGLE POST
---------------------------------------------------------------------- */
.edp-single .entry-content {
	font-size: var(--edp-fs-body);
	line-height: 1.8;
	color: var(--edp-ink-soft);
}
.edp-single .entry-content > p,
.edp-single .entry-content > ul,
.edp-single .entry-content > ol,
.edp-single .entry-content > h2,
.edp-single .entry-content > h3,
.edp-single .entry-content > blockquote,
.edp-single .entry-content > figure {
	max-width: 720px; margin-inline: auto;
}
.edp-single .entry-content h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); margin-top: 2.4em; margin-bottom: .6em; scroll-margin-top: 90px; }
.edp-single .entry-content h3 { font-size: var(--edp-fs-h3); margin-top: 1.8em; margin-bottom: .5em; scroll-margin-top: 90px; }
.edp-single .entry-content p { margin-bottom: 1.4em; }
.edp-single .entry-content a { color: var(--edp-accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.edp-single .entry-content img { border-radius: var(--edp-radius); }
.edp-single .entry-content figcaption { font-size: .85rem; color: var(--edp-muted); text-align: center; margin-top: .6rem; }

/* Drop cap on the first paragraph */
.edp-single .entry-content > p:first-of-type::first-letter {
	font-family: var(--edp-font-display);
	font-size: 3.6em; line-height: .8; font-weight: 600;
	float: left; margin: .05em .12em 0 0; color: var(--edp-accent);
}

/* Blockquote */
.edp-single .entry-content blockquote {
	font-family: var(--edp-font-display);
	font-size: clamp(1.25rem, 1.1rem + .6vw, 1.6rem);
	line-height: 1.4; font-style: italic;
	border-left: 3px solid var(--edp-accent);
	padding-left: 1.4rem; margin-block: 2rem; color: var(--edp-ink);
}

/* Auto Table of Contents */
.edp-toc {
	max-width: 720px; margin: 2rem auto;
	background: var(--edp-surface); border: 1px solid var(--edp-line);
	border-radius: var(--edp-radius); padding: 1.2rem 1.5rem;
}
.edp-toc__title { font-family: var(--edp-font-body); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--edp-muted); margin: 0 0 .7rem; }
.edp-toc ol { margin: 0; padding-left: 1.1rem; display: grid; gap: .45rem; }
.edp-toc a { color: var(--edp-ink-soft); font-size: .95rem; }
.edp-toc a:hover, .edp-toc a.is-active { color: var(--edp-accent); }
.edp-toc li.is-sub { margin-left: .8rem; font-size: .9rem; }

/* Sticky share rail */
.edp-share {
	position: sticky; top: 50%; float: left;
	display: flex; flex-direction: column; gap: .5rem;
	margin-left: -72px; margin-top: 1rem;
}
.edp-share__btn {
	width: 44px; height: 44px; display: grid; place-items: center;
	border-radius: 50%; border: 1px solid var(--edp-line);
	background: var(--edp-bg); color: var(--edp-muted); cursor: pointer;
	transition: color .2s var(--edp-ease), border-color .2s var(--edp-ease), transform .2s var(--edp-ease);
}
.edp-share__btn:hover { color: var(--edp-accent); border-color: var(--edp-accent); transform: translateY(-2px); }
.edp-copy-link.is-copied { color: #1f9d55; border-color: #1f9d55; }

/* Author box */
.edp-author {
	display: flex; gap: 1.4rem; align-items: flex-start;
	max-width: 760px; margin: 3rem auto;
	padding: 1.8rem; border-radius: var(--edp-radius);
	background: var(--edp-surface); border: 1px solid var(--edp-line);
}
.edp-author__avatar img { border-radius: 50%; display: block; }
.edp-author__eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--edp-muted); }
.edp-author__name { font-size: 1.3rem; margin: .2rem 0 .5rem; }
.edp-author__name a:hover { color: var(--edp-accent); }
.edp-author__bio { color: var(--edp-muted); font-size: .98rem; margin: 0 0 .7rem; }
.edp-author__more { font-weight: 600; color: var(--edp-accent); font-size: .92rem; }

/* Related */
.edp-related { max-width: var(--edp-shell); margin: 3.5rem auto 0; padding-inline: clamp(1rem, 0.5rem + 2vw, 2.5rem); }
.edp-related__title { font-size: var(--edp-fs-h2); margin-bottom: 1.5rem; padding-bottom: .8rem; border-bottom: 1px solid var(--edp-line); }

/* ----------------------------------------------------------------------
   9. FOOTER CTA / NEWSLETTER
---------------------------------------------------------------------- */
.edp-footer-cta { background: var(--edp-surface); border-top: 1px solid var(--edp-line); padding-block: clamp(2.5rem, 2rem + 2vw, 4rem); }
.edp-footer-cta__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; }
.edp-footer-cta__title { font-size: var(--edp-fs-h2); margin: 0; max-width: 16ch; }
.edp-footer-cta__sub { color: var(--edp-muted); margin: .5rem 0 0; max-width: 48ch; }
.edp-newsletter { display: flex; gap: .6rem; flex: 1 1 320px; max-width: 460px; }
.edp-newsletter input[type="email"] {
	flex: 1; padding: .85rem 1.1rem; border-radius: 999px;
	border: 1px solid var(--edp-line-strong); background: var(--edp-bg); color: var(--edp-ink); font-size: .95rem;
}
.edp-newsletter input::placeholder { color: var(--edp-muted); }

/* ----------------------------------------------------------------------
   10. UTILITIES — back to top, reduced motion, print
---------------------------------------------------------------------- */
.edp-top {
	position: fixed; right: clamp(1rem, 2vw, 2rem); bottom: clamp(1rem, 2vw, 2rem);
	width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--edp-line);
	background: var(--edp-bg); color: var(--edp-ink); cursor: pointer; z-index: 900;
	display: grid; place-items: center; box-shadow: var(--edp-shadow);
	opacity: 0; transform: translateY(12px); pointer-events: none;
	transition: opacity .3s var(--edp-ease), transform .3s var(--edp-ease), color .2s, border-color .2s;
}
.edp-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.edp-top:hover { color: var(--edp-accent); border-color: var(--edp-accent); }

@media (prefers-reduced-motion: reduce) {
	.edp *, .edp *::before, .edp *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
	.edp-progress, .edp-share, .edp-top, .edp-footer-cta, .edp-related, .edp-author, .main-navigation, .edp-dark-toggle { display: none !important; }
	body.edp { color: #000; background: #fff; }
}

/* ----------------------------------------------------------------------
   11. RESPONSIVE
---------------------------------------------------------------------- */
@media (max-width: 980px) {
	.edp-hero-grid { grid-template-columns: 1fr; }
	.edp-hero__side { padding-left: 0; }
	.edp-grid--magazine, .edp-grid--3 { grid-template-columns: repeat(2, 1fr); }
	.edp-grid--bento { grid-template-columns: repeat(2, 1fr); }
	.edp-grid--bento > .edp-card:first-child,
	.edp-grid--bento > .edp-card:nth-child(2) { grid-column: span 2; grid-row: auto; }
	.edp-share { position: static; float: none; flex-direction: row; margin: 1.2rem 0 0; }
}

@media (max-width: 600px) {
	.edp-grid--magazine, .edp-grid--3, .edp-grid--bento { grid-template-columns: 1fr; }
	.edp-grid--bento > .edp-card:first-child,
	.edp-grid--bento > .edp-card:nth-child(2) { grid-column: auto; }
	.edp-section__head { flex-direction: column; align-items: flex-start; gap: .4rem; }
	.edp-footer-cta__inner { flex-direction: column; align-items: flex-start; }
	.edp-newsletter { flex-direction: column; max-width: 100%; }
	.edp-newsletter .edp-btn { width: 100%; }
	.edp-single .entry-content > p:first-of-type::first-letter { font-size: 3em; }
}

/* Sticky bottom share on mobile (progressive enhancement via JS class) */
@media (max-width: 600px) {
	.edp-single .edp-share.is-mobile-dock {
		position: fixed; inset: auto 0 0 0; margin: 0;
		flex-direction: row; justify-content: center; gap: 1.2rem;
		background: var(--edp-bg); border-top: 1px solid var(--edp-line);
		padding: .6rem; z-index: 950;
	}
}
