/*
Theme Name: Ethihas Editorial
Theme URI: https://ethihasdesign.in
Author: Ethihas Mandarada
Author URI: https://ethihasdesign.in
Description: Cinematic editorial portfolio theme for Ethihas Mandarada. Dark engineering grid, airflow lines, wide technical headlines and magazine-style project features. Built as a block theme, so every section is editable in the Site Editor.
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 7.4
Version: 1.6.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ethihas-editorial
Tags: portfolio, block-patterns, full-site-editing, dark, one-column, wide-blocks
*/

/* ---------- Base ---------- */

body {
	font-variant-ligatures: none;
	background-color: var(--wp--preset--color--base);
	background-image:
		linear-gradient(var(--wp--custom--grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--wp--custom--grid) 1px, transparent 1px);
	background-size: 80px 80px;
	background-position: center top;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
}

img {
	max-width: 100%;
	height: auto;
}

:where(.wp-site-blocks) > * {
	margin-block-start: 0;
}

.wp-block-image {
	margin-top: 0;
	margin-bottom: 0;
}

a:focus-visible,
.wp-element-button:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
}

/* ---------- Text styles (registered as block styles) ---------- */

.is-style-eyebrow,
.is-style-eyebrow-accent,
.wp-block-post-terms.is-style-eyebrow-accent {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	line-height: 1.6;
	color: var(--wp--preset--color--subtle);
}

.is-style-eyebrow-accent,
.wp-block-post-terms.is-style-eyebrow-accent,
.wp-block-post-terms.is-style-eyebrow-accent a {
	color: var(--wp--preset--color--accent);
}

.is-style-text-link a {
	display: inline-block;
	padding-bottom: 4px;
	border-bottom: 1px solid var(--wp--preset--color--line-strong);
	font-size: var(--wp--preset--font-size--small);
	transition: border-color 0.2s ease, color 0.2s ease;
}

.is-style-text-link a:hover {
	border-bottom-color: var(--wp--preset--color--accent);
}

.eth-meta {
	font-size: 12px;
	color: var(--wp--preset--color--subtle);
}

.eth-measure {
	max-width: 520px;
}

/* ---------- Header ---------- */

.eth-wordmark {
	margin: 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.18em;
	white-space: nowrap;
}

.eth-wordmark a:hover {
	color: var(--wp--preset--color--contrast);
}

.eth-nav .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--contrast);
}

.eth-nav .eth-nav-cta .wp-block-navigation-item__content {
	color: var(--wp--preset--color--accent);
}

.eth-brand .eth-logo,
.eth-brand .eth-logo a {
	display: block;
	line-height: 0;
}

.eth-logo img {
	display: block;
	object-fit: contain;
}

.eth-brand .eth-logo a {
	transition: transform 0.4s ease;
}

.eth-brand .eth-logo a:hover {
	transform: rotate(-12deg);
}

.eth-nav .wp-block-navigation__submenu-container {
	background-color: var(--wp--preset--color--surface) !important;
	color: var(--wp--preset--color--muted) !important;
	border: 1px solid var(--wp--preset--color--line) !important;
	padding: 8px 0;
	min-width: 220px;
}

.eth-nav .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 8px 18px;
}

.eth-nav .wp-block-navigation-submenu__toggle,
.eth-nav .wp-block-navigation__submenu-icon {
	color: inherit;
}

@media (max-width: 600px) {
	.eth-header > .wp-block-group {
		row-gap: 12px;
	}
	.eth-brand .eth-logo img {
		width: 32px !important;
		height: 32px !important;
	}
	.eth-wordmark {
		font-size: 12px;
	}
	.eth-nav .wp-block-navigation__container {
		column-gap: 20px;
		row-gap: 6px;
		justify-content: flex-start;
	}
}

/* ---------- Flow lines (block styles on Group) ---------- */

.is-style-hero-flow,
.is-style-flow-lines,
.is-style-flow-lines-reverse {
	position: relative;
	isolation: isolate;
}

.is-style-hero-flow::before,
.is-style-flow-lines::before,
.is-style-flow-lines-reverse::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	z-index: -1;
	pointer-events: none;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 100% 100%;
}

.is-style-hero-flow::before {
	top: 0;
	height: 820px;
	background-image: url(assets/svg/flow-hero.svg);
}

.is-style-flow-lines::before,
.is-style-flow-lines-reverse::before {
	top: -70px;
	bottom: -70px;
	background-image: url(assets/svg/flow-section.svg);
}

.is-style-flow-lines-reverse::before {
	transform: scaleX(-1);
}

@media (max-width: 720px) {
	.is-style-hero-flow::before {
		height: 640px;
		background-image: url(assets/svg/flow-hero-mobile.svg);
	}
}

/* ---------- Hero ---------- */

.eth-hero-title {
	max-width: 17ch;
}

.eth-hero-media {
	position: relative;
}

.eth-hero-media .wp-block-image img {
	display: block;
	width: 100%;
	max-height: 680px;
	border: 1px solid var(--wp--preset--color--line);
}

.eth-now-showing {
	position: absolute;
	left: clamp(12px, 2vw, 24px);
	bottom: clamp(12px, 2vw, 24px);
	margin: 0 !important;
	padding: 10px 16px;
	background: var(--wp--preset--color--base);
}

.eth-now-showing p {
	margin: 0;
}

.eth-now-showing .eth-now-title {
	font-family: var(--wp--preset--font-family--display);
	font-size: 16px;
	text-transform: uppercase;
	line-height: 1.3;
}

@media (max-width: 720px) {
	.eth-now-showing {
		padding: 6px 10px;
	}
	.eth-now-showing .is-style-eyebrow-accent {
		display: none;
	}
	.eth-now-showing .eth-now-title {
		font-size: 11px;
	}
}

.eth-strip {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.eth-strip p {
	margin: 0;
}

/* ---------- Features ---------- */

.eth-feature.wp-block-columns {
	margin: 0;
	padding-block: clamp(56px, 8vw, 96px);
	border-bottom: 1px solid var(--wp--preset--color--line);
	gap: 32px clamp(32px, 4vw, 48px);
}

.eth-feature.is-last {
	border-bottom: 0;
}

@media (min-width: 782px) {
	.eth-feature.is-reversed {
		flex-direction: row-reverse;
	}
}

.eth-frame img,
.eth-frame.wp-block-image img {
	display: block;
	width: 100%;
	border: 1px solid var(--wp--preset--color--line);
}

.eth-paper .eth-frame img {
	border-color: transparent;
}

.eth-frame a img {
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease;
}

.eth-frame a {
	display: block;
	overflow: hidden;
}

.eth-frame a:hover img {
	transform: scale(1.015);
}

.eth-letterbox img {
	background: #fce4e8;
}

/* ---------- Paper (sketchbook) band ---------- */

.eth-paper {
	background-image: none;
}

.eth-paper a:hover {
	color: var(--wp--preset--color--ink);
}

.eth-paper .is-style-text-link a {
	border-bottom-color: var(--wp--preset--color--ink);
}

.eth-paper .is-style-eyebrow,
.eth-paper .wp-element-caption,
.eth-paper figcaption {
	color: var(--wp--preset--color--ink-muted);
}

.eth-paper .wp-element-caption {
	margin-top: 12px;
	text-align: left;
}

/* ---------- Journey ---------- */

.eth-timeline {
	border-top: 1px solid var(--wp--preset--color--line-strong);
}

.eth-milestone {
	padding-top: 28px;
}

.eth-milestone > * {
	margin-block: 0;
}

.eth-milestone h3 {
	margin-top: 10px;
	margin-bottom: 10px;
}

.eth-advisory .eth-timeline {
	border-top-color: var(--wp--preset--color--line);
}

.eth-milestone.is-current {
	border-top: 2px solid var(--wp--preset--color--accent);
	margin-top: -1px;
}

/* ---------- Leadership ---------- */

.eth-bordered {
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.eth-role {
	padding-bottom: 32px;
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.eth-role:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.eth-role > * {
	margin-block: 0;
}

.eth-role h3 {
	margin-top: 6px;
	margin-bottom: 8px;
}

.is-style-viewfinder {
	position: relative;
	max-width: 420px;
}

.is-style-viewfinder img {
	display: block;
	width: 100%;
	border: 1px solid var(--wp--preset--color--line);
}

.is-style-viewfinder::before,
.is-style-viewfinder::after {
	content: "";
	position: absolute;
	width: 14px;
	height: 14px;
	pointer-events: none;
}

.is-style-viewfinder::before {
	top: 12px;
	left: 12px;
	border-top: 1px solid var(--wp--preset--color--accent);
	border-left: 1px solid var(--wp--preset--color--accent);
}

.is-style-viewfinder::after {
	bottom: 12px;
	right: 12px;
	border-bottom: 1px solid var(--wp--preset--color--accent);
	border-right: 1px solid var(--wp--preset--color--accent);
}

.eth-portrait img {
	object-position: center 22%;
}

.eth-portrait-caption {
	max-width: 420px;
}

/* ---------- Footer ---------- */

.eth-closing {
	max-width: 18ch;
}

.eth-signature {
	margin-top: clamp(64px, 9vw, 120px) !important;
	margin-bottom: 0;
	line-height: 0;
}

.eth-signature + .eth-baseline {
	margin-top: clamp(40px, 5vw, 64px) !important;
}

.eth-sign {
	display: block;
	width: clamp(240px, 36vw, 520px);
	height: auto;
	overflow: visible;
}

.eth-sign-strokes path {
	fill: none;
	stroke: #fff;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.eth-sign.is-ready .eth-sign-strokes path {
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
}

.eth-sign.is-signing .eth-sign-strokes path {
	animation: eth-draw var(--d) linear var(--t) forwards;
}

@keyframes eth-draw {
	to { stroke-dashoffset: 0; }
}

.eth-email a {
	display: inline-block;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--wp--preset--color--line-strong);
}

.eth-email a:hover {
	border-bottom-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--contrast);
}

.eth-baseline {
	border-top: 1px solid var(--wp--preset--color--line);
}

.eth-baseline p {
	margin: 0;
}

/* ---------- Case study ---------- */

.eth-back a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
}

.eth-facts {
	border-top: 1px solid var(--wp--preset--color--line);
	border-bottom: 1px solid var(--wp--preset--color--line);
	padding-block: 24px;
}

.eth-facts > div > * {
	margin-block: 0;
}

.eth-facts > div > * + * {
	margin-top: 8px;
}

.eth-case-cover img {
	display: block;
	width: 100%;
	border: 1px solid var(--wp--preset--color--line);
}

.eth-next {
	border-top: 1px solid var(--wp--preset--color--line);
}

.eth-next .wp-block-post-navigation-link {
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(26px, 4.4vw, 64px);
	line-height: 1.1;
	text-transform: uppercase;
}

.eth-next .wp-block-post-navigation-link a:hover {
	color: var(--wp--preset--color--accent);
}

.eth-post-card .wp-block-post-featured-image img {
	border: 1px solid var(--wp--preset--color--line);
}

.eth-post-card .wp-block-post-title {
	font-size: var(--wp--preset--font-size--title-m);
	line-height: 1.2;
}

/* ---------- Full-width media on project posts and pages ----------
   Text stays in the narrow reading column; every image, gallery and
   video in post content (old or new) opens out to the full wide layout. */

.wp-block-post-content.is-layout-constrained > :is(p, h1, h2, h3, h4, h5, h6, div, a, figure, center):not(.alignfull):has(img, video, iframe),
.wp-block-post-content.is-layout-constrained > :is(.wp-block-image, .wp-block-gallery, .wp-block-video, .wp-block-embed, .wp-block-cover, .wp-video, .gallery, img, video, iframe):not(.alignfull) {
	max-width: var(--wp--style--global--wide-size) !important;
	width: 100%;
}

.wp-block-post-content img:not(.eth-keep-size) {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin-inline: auto;
	float: none;
}

/* Tall images: as big as the screen allows, never taller */
.wp-block-post-content > :is(p, h1, h2, h3, h4, h5, h6, a, center, figure, .wp-block-image) img:not(.eth-keep-size) {
	max-height: 92vh;
	object-fit: contain;
}

/* Several images in one paragraph or heading: stack with a small gap */
.wp-block-post-content :is(p, h1, h2, h3, h4, h5, h6, a, center) img + img,
.wp-block-post-content :is(p, h1, h2, h3, h4, h5, h6, center) a + a,
.wp-block-post-content :is(p, h1, h2, h3, h4, h5, h6, center) a + img,
.wp-block-post-content :is(p, h1, h2, h3, h4, h5, h6, center) img + a {
	margin-top: 16px;
}

.wp-block-post-content :is(p, h1, h2, h3, h4, h5, h6, center):has(img) a {
	display: block;
}

.wp-block-post-content :is(p, h1, h2, h3, h4, h5, h6, center):has(img) br {
	display: none;
}

/* Image-only headings from the old editor should not add heading spacing */
.wp-block-post-content :is(h1, h2, h3, h4, h5, h6):has(img) {
	line-height: 0;
	font-size: 0;
}

/* Classic image captions */
.wp-block-post-content .wp-caption {
	width: 100% !important;
	max-width: 100%;
}

/* Old gallery shortcode: bigger tiles */
.wp-block-post-content .gallery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
	gap: 16px;
}

.wp-block-post-content .gallery .gallery-item {
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	float: none !important;
}

.wp-block-post-content .gallery br {
	display: none;
}

/* WordPress video player: fill the wide column, keep 16:9 */
.wp-block-post-content .wp-video {
	width: 100% !important;
	max-width: var(--wp--style--global--wide-size) !important;
	margin-inline: auto;
}

.wp-block-post-content .wp-video .mejs-container,
.wp-block-post-content .wp-video video {
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 16 / 9;
}

.wp-block-post-content .wp-video .mejs-mediaelement,
.wp-block-post-content .wp-video .mejs-layers,
.wp-block-post-content .wp-video .mejs-overlay {
	width: 100% !important;
	height: 100% !important;
}

.wp-block-post-content video {
	display: block;
	width: 100%;
	height: auto;
	background: #000;
}

.wp-block-post-content iframe {
	width: 100%;
	aspect-ratio: 16 / 9;
	height: auto;
}

/* Media blocks inside columns or grids keep their column width */
.wp-block-post-content :is(.wp-block-columns, .is-layout-grid) img {
	margin-inline: 0;
}

/* ---------- Flight path scroll gauge ---------- */

.eth-gauge {
	position: fixed;
	right: clamp(12px, 1.4vw, 22px);
	top: 54%;
	z-index: 50;
	height: min(44vh, 360px);
	transform: translateY(-50%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.4s ease;
	--p: var(--eth-scroll, 0);
}

.eth-gauge.is-on {
	opacity: 1;
}

.eth-gauge-track {
	position: relative;
	width: 1px;
	height: 100%;
	background: var(--wp--preset--color--line-strong);
}

.eth-gauge-track i {
	position: absolute;
	right: 0;
	width: 6px;
	height: 1px;
	background: var(--wp--preset--color--line-strong);
}

.eth-gauge-track i:nth-child(1) { top: 0; }
.eth-gauge-track i:nth-child(2) { top: 25%; }
.eth-gauge-track i:nth-child(3) { top: 50%; }
.eth-gauge-track i:nth-child(4) { top: 75%; }
.eth-gauge-track i:nth-child(5) { top: 100%; }

.eth-gauge-fill {
	position: absolute;
	left: -0.5px;
	top: 0;
	width: 2px;
	height: calc(var(--p) * 100%);
	background: var(--wp--preset--color--accent);
}

.eth-gauge-dot {
	position: absolute;
	left: -3px;
	top: calc(var(--p) * 100%);
	width: 7px;
	height: 7px;
	margin-top: -3px;
	border-radius: 50%;
	background: var(--wp--preset--color--accent);
	box-shadow: 0 0 0 4px rgba(255, 90, 31, 0.18), 0 0 14px rgba(255, 90, 31, 0.6);
}

.eth-gauge-read {
	position: absolute;
	left: -5px;
	bottom: calc(100% + 14px);
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	white-space: nowrap;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 10px;
	letter-spacing: 0.16em;
	color: var(--wp--preset--color--subtle);
}

.eth-gauge-read b {
	font-weight: 500;
	color: var(--wp--preset--color--contrast);
}

.eth-topbar {
	display: none;
}

@media (max-width: 900px) {
	.eth-gauge {
		display: none;
	}

	.eth-topbar {
		display: block;
		position: fixed;
		left: 0;
		top: var(--wp-admin--admin-bar--height, 0px);
		z-index: 60;
		width: 100%;
		height: 2px;
		transform-origin: left center;
		transform: scaleX(var(--eth-scroll, 0));
		background: var(--wp--preset--color--accent);
		box-shadow: 0 0 10px rgba(255, 90, 31, 0.55);
		opacity: 0;
		pointer-events: none;
	}

	.eth-topbar.is-on {
		opacity: 1;
	}
}

/* ---------- Return to base ---------- */

.eth-return {
	position: fixed;
	right: clamp(14px, 1.6vw, 24px);
	bottom: clamp(16px, 3vh, 32px);
	z-index: 55;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 48px;
	min-height: 48px;
	padding: 0 15px;
	border: 1px solid var(--wp--preset--color--line-strong);
	border-radius: 999px;
	background: rgba(11, 11, 12, 0.82);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s, border-color 0.2s ease;
}

.eth-return.is-on {
	opacity: 1;
	visibility: visible;
	transform: translateY(calc(-1 * var(--eth-lift, 0px)));
	transition: opacity 0.35s ease, transform 0.12s linear, visibility 0s, border-color 0.2s ease;
}

.eth-return:hover,
.eth-return:focus-visible {
	border-color: var(--wp--preset--color--accent);
}

.eth-return svg {
	flex: none;
	color: var(--wp--preset--color--accent);
}

@media (max-width: 900px) {
	.eth-return {
		padding: 0;
		justify-content: center;
	}

	.eth-return-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
}

/* ---------- Reveal on scroll ---------- */

.eth-reveal {
	opacity: 0;
	transform: translateY(28px);
	transition:
		opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--eth-delay, 0ms),
		transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) var(--eth-delay, 0ms);
}

.eth-reveal.is-in {
	opacity: 1;
	transform: none;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}
