/*
Theme Name:  Ο ΤΟΠΟΣ ΜΟΥ
Theme URI:   https://otoposmou.fijisolutions.net
Description: Θυγατρικό θέμα Divi για την Εθελοντική Ομάδα Δράσης Ν. Πιερίας «Ο ΤΟΠΟΣ ΜΟΥ» και τον Καπνικό Σταθμό Κατερίνης.
Author:      Fiji Solutions
Author URI:  https://fijisolutions.net
Template:    Divi
Version:     0.1.0
Text Domain: otoposmou
Requires PHP: 8.1
*/

/* ------------------------------------------------------------------ archive */

/*
 * The 2,753 images in the 2004-2020 archive were not preserved — only their
 * filenames, and those only in a database dump that is not committed. This is what
 * stands in for each one. Deliberately quiet: it appears up to six times in a
 * single article, so it must read as a note, not as an error.
 */
.otm-missing-image {
	margin: 1.5rem 0;
	padding: 1.25rem;
	border: 1px dashed rgba(0, 0, 0, .22);
	border-radius: .35rem;
	background: rgba(0, 0, 0, .025);
	text-align: center;
}

.otm-missing-image figcaption {
	font-size: .85rem;
	font-style: italic;
	opacity: .7;
}

.otm-empty-body {
	font-style: italic;
	opacity: .75;
}

/* Keep archived YouTube embeds inside the column on a phone. */
.otm-video {
	position: relative;
	margin: 1.5rem 0;
	padding-top: 56.25%;
}

.otm-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ------------------------------------------------- archived polls (read-only) */

.otm-polls__note {
	font-style: italic;
	opacity: .75;
	margin-bottom: 2rem;
}

.otm-poll {
	margin: 0 0 2.25rem;
}

/*
 * The total is prominent on purpose. A 92.7% result on 4,019 votes and a 100%
 * result on 1 vote must not look alike — that is the whole risk of publishing an
 * archive of internal polls.
 */
.otm-poll__total {
	font-size: .9rem;
	opacity: .75;
	margin: .15rem 0 .6rem;
}

.otm-poll__bars {
	list-style: none;
	margin: 0;
	padding: 0;
}

.otm-poll__bars li {
	display: grid;
	grid-template-columns: minmax(8rem, 18rem) 1fr 3.5rem;
	gap: .75rem;
	align-items: center;
	margin: .35rem 0;
}

.otm-poll__bar {
	position: relative;
	height: .9rem;
	border-radius: .45rem;
	background: var(--otm-bar-bg, #e6e6e6);
}

.otm-poll__bar::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: var(--pct);
	border-radius: .45rem;
	background: var(--otm-bar, #2e6f4e);
}

/*
 * The percentage is always present as text, never conveyed by bar length alone —
 * the bars are decorative role="img" and carry the full result in aria-label.
 * tabular-nums so 9.1% and 58.2% align.
 */
.otm-poll__pct {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
	.otm-poll__bars li {
		grid-template-columns: 1fr 3.5rem;
	}

	.otm-poll__bar {
		grid-column: 1 / -1;
		order: 3;
	}
}

/*
 * ⚠️ `Template: Divi` must match the PARENT THEME'S DIRECTORY NAME exactly, and
 * Divi.zip extracts to `Divi/` with a capital D. Get the case wrong and WordPress
 * reports "The parent theme is missing" and refuses to activate the child, which
 * on a read-only rootfs cannot be fixed from wp-admin.
 *
 * This file must exist and must carry this header even while it holds no rules —
 * the header IS the theme. Design work is Phase 4.2 and is blocked on the client
 * supplying branding (logos and colours for BOTH organisations); do not invent it.
 *
 * ⚠️ Do NOT enqueue this file from functions.php. Divi 5.9.0 already enqueues both
 * stylesheets itself — see Divi/functions.php:524-543, which switches the parent
 * handle to `divi-style-parent` when is_child_theme() is true and then enqueues
 * `divi-style-child` from the stylesheet directory. The child-theme snippet in
 * every tutorial ("enqueue the parent style with get_template_directory_uri()")
 * double-loads ~277 KB of CSS here.
 */

/* ============================================================== demo palette */

/*
 * ⚠️ THIS IS NOT A BRAND. Phase 4.2 is blocked on the client supplying logos and
 * colours for BOTH organisations — «Ο ΤΟΠΟΣ ΜΟΥ» and the Καπνικός Σταθμός
 * Κατερίνης. What follows is a deliberately restrained default so the 1,818-post
 * archive can be read and reviewed, and so the demo does not look unfinished.
 * Every value here is meant to be replaced.
 *
 * The green is drawn from the organisation's own subject matter — forest, water,
 * recycling and Olympus are its four largest campaign sections — rather than
 * invented. It is dark enough to pass AA on white at body-text size.
 */
:root {
	--otm-ink: #1d2621;
	--otm-green: #2e6f4e;
	--otm-green-dark: #23543c;
	--otm-sand: #f6f5f1;
	--otm-rule: rgba(29, 38, 33, .12);
	--otm-bar: #2e6f4e;
	--otm-bar-bg: #e6e6e6;
}

/*
 * Greek typography: Divi's default stack leans on fonts with thin or absent Greek
 * coverage, which silently falls back per-glyph and gives ragged accents on
 * ά έ ή ί ό ύ ώ. A system stack with real Greek support is both faster and more
 * consistent than pulling a webfont, and it needs no Google Fonts request — which
 * matters because Complianz would otherwise have to gate it behind consent.
 */
body,
.et_pb_module,
#main-content .container {
	font-family: "Helvetica Neue", "Segoe UI", Roboto, "Noto Sans", "DejaVu Sans", Arial, sans-serif;
	color: var(--otm-ink);
}

/* The archive is long-form Greek prose. 1.7 and a bounded measure make 43,000-character
   articles readable; Divi's default is tight and full-width. */
.single .entry-content,
.page .entry-content {
	font-size: 1.05rem;
	line-height: 1.75;
}

.single .entry-content > p,
.single .entry-content > ul,
.single .entry-content > ol,
.page .entry-content > p {
	max-width: 42em;
}

a { color: var(--otm-green); }
a:hover { color: var(--otm-green-dark); }

h1, h2, h3, h4 { color: var(--otm-ink); }

/* Dates carry real weight on an archive spanning 2004-2020 — they are how a reader
   orients. Divi de-emphasises them almost to invisibility. */
.published,
.post-meta {
	font-size: .9rem;
	opacity: .8;
}

#main-header {
	border-bottom: 3px solid var(--otm-green);
}

/* Archive listings read better with a visible boundary between entries than with
   Divi's default whitespace-only separation, given how variable the entry lengths
   are here (some posts are one image placeholder, some are 43,000 characters). */
.archive .et_pb_post,
.blog .et_pb_post,
.search .et_pb_post {
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--otm-rule);
}

/* ============================================ front page — clean, consistent grid */

/*
 * Rebuilt after seeing it rendered. The first version was broken in three ways that
 * only a screenshot shows: Divi's placeholder logo sat on top of the menu, a
 * 12-item Greek menu wrapped onto two lines and orphaned the search icon on a
 * third, and the hero filled the entire first screen so the page opened on one
 * enormous photograph with a caption stranded underneath it.
 *
 * The rule this now follows: ONE consistent image ratio everywhere, and the hero is
 * a card with the headline ON the picture rather than a picture with text below it.
 */

/* ---- header ---- */

.otm-wordmark {
	display: flex;
	flex-direction: column;
	justify-content: center;
	height: 100%;
	text-decoration: none;
	line-height: 1.15;
}

.otm-wordmark__name {
	font-size: 1.32rem;
	font-weight: 800;
	letter-spacing: .04em;
	color: var(--otm-ink);
	white-space: nowrap;
}

.otm-wordmark__sub {
	font-size: .68rem;
	letter-spacing: .01em;
	color: var(--otm-green);
	white-space: nowrap;
}

/*
 * Divi absolutely-positions .logo_container and then reserves space for it with a
 * padding-left on the nav, computed from the LOGO IMAGE's width. With a text
 * wordmark there is no image to measure, so the reserved space was wrong and the
 * wordmark sat on top of the first menu links.
 *
 * ⚠️ Zeroing that padding (my first attempt) makes it worse, not better: the nav
 * then starts at x=0 and runs straight under the wordmark. The fix is to stop the
 * container being absolute at all and let a normal flex row place both.
 */
#main-header .container {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
}

#main-header .logo_container {
	position: static !important;
	width: auto !important;
	height: auto !important;
	flex: 0 0 auto;
}

#main-header #et-top-navigation {
	padding-left: 0 !important;
	flex: 1 1 auto;
	display: flex;
	justify-content: flex-end;
	align-items: center;
}

#main-header #et_top_search { margin-top: 0; }
#main-header #top-menu-nav { display: flex; align-items: center; }

.otm-front {
	max-width: 1180px;
	margin: 0 auto;
	padding: 2rem 1rem 3.5rem;
}

/* ---- one ratio, everywhere ---- */

.otm-card__link { display: block; color: inherit; text-decoration: none; }

.otm-card__media {
	display: block;
	position: relative;
	overflow: hidden;
	background: var(--otm-sand);
	border-radius: .35rem;
	aspect-ratio: 16 / 9;   /* the SAME ratio on hero and grid — no mixed sizes */
}

/*
 * ⚠️ The ID in this selector is deliberate, and !important alone was NOT enough.
 * Divi styles content images through an ID — roughly
 *   #main-content img { width: auto !important; height: auto !important; }
 * and an ID beats ANY number of classes regardless of !important on both sides. A
 * class-only rule with !important therefore lost, and the symptom was a hero photo
 * sitting at its intrinsic 747px inside a 1148px box with dead space beside it.
 * Matching the ID is what actually wins. object-fit needs BOTH dimensions pinned.
 */
#main-content .otm-card__media img,
.otm-card__media img {
	position: absolute !important;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform .4s ease;
}

.otm-card__link:hover .otm-card__media img { transform: scale(1.03); }

/* ---- hero: headline ON the image ---- */

.otm-hero { position: relative; margin-bottom: 3.5rem; }

.otm-hero__track {
	display: flex;
	gap: 1rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.otm-hero__track::-webkit-scrollbar { display: none; }
.otm-hero__slide { flex: 0 0 100%; scroll-snap-align: start; }

.otm-card--hero .otm-card__link { position: relative; display: block; }
.otm-card--hero .otm-card__media { border-radius: .5rem; }

/*
 * 🔴 A WIDER RATIO, NOT max-height.
 *
 * `aspect-ratio: 16/9` plus `max-height: 420px` does NOT give a 1148x420 box. When
 * one dimension is constrained, aspect-ratio shrinks the OTHER to preserve the
 * ratio — so the box became 747x420 (420 x 16/9 = 746.7) and the hero photo sat in
 * the left two-thirds with dead space beside it, while the gradient overlay, which
 * is positioned against the full-width link, stretched past it. It read as a
 * broken image and was a correctly-filled box of the wrong size.
 *
 * Changing the RATIO is the right lever: cinematic, and short enough that the page
 * never opens on one full-screen photograph.
 */
.otm-card--hero .otm-card__media { aspect-ratio: 2.6 / 1; }

.otm-card--hero .otm-card__body {
	position: absolute;
	inset: auto 0 0 0;
	padding: 2.5rem 1.75rem 1.5rem;
	border-radius: 0 0 .5rem .5rem;
	background: linear-gradient(to top, rgba(0, 0, 0, .82) 12%, rgba(0, 0, 0, .45) 55%, rgba(0, 0, 0, 0));
	color: #fff;
}

.otm-card--hero .otm-card__title { font-size: 1.6rem; color: #fff; max-width: 34ch; }
.otm-card--hero .otm-card__date { color: rgba(255, 255, 255, .82); }
.otm-card--hero .otm-card__link:hover .otm-card__title { color: #fff; text-decoration: underline; }

/* ---- grid ---- */

.otm-card__body { display: block; padding: .8rem 0 0; }

.otm-card__tag {
	display: inline-block;
	margin-bottom: .45rem;
	padding: .16rem .6rem;
	border-radius: 3px;
	background: var(--otm-green);
	color: #fff;
	font-size: .68rem;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.otm-card__title {
	display: block;
	font-size: 1.02rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--otm-ink);
}

.otm-card__excerpt {
	display: block;
	margin-top: .45rem;
	font-size: .9rem;
	line-height: 1.55;
	color: rgba(29, 38, 33, .72);
}

.otm-card__date { display: block; margin-top: .55rem; font-size: .78rem; opacity: .55; }
.otm-card__link:hover .otm-card__title { color: var(--otm-green); }

.otm-section-title {
	margin: 0 0 1.5rem;
	padding-bottom: .55rem;
	border-bottom: 1px solid var(--otm-rule);
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--otm-ink);
}

.otm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem 1.75rem; }

@media (max-width: 980px) { .otm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) {
	.otm-grid { grid-template-columns: 1fr; }
	.otm-card--hero .otm-card__title { font-size: 1.1rem; }
	.otm-card--hero .otm-card__body { padding: 1.75rem 1rem 1rem; }
	.otm-hero__nav { display: none; }   /* swipe is the native gesture here */

	/* A 2.6:1 hero is only ~150px tall on a 390px screen, and the gradient plus
	   three lines of text cover almost all of it — the photograph stops being
	   visible at exactly the width where it matters most. Taller ratio on phones. */
	.otm-card--hero .otm-card__media { aspect-ratio: 4 / 3; }
}

.otm-hero__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .9);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
	font-size: 1.35rem;
	line-height: 1;
	color: var(--otm-ink);
	cursor: pointer;
}

.otm-hero__nav--prev { left: .75rem; }
.otm-hero__nav--next { right: .75rem; }
.otm-hero__nav[hidden] { display: none; }

.otm-more { margin-top: 3rem; text-align: center; }

.otm-btn {
	display: inline-block;
	padding: .7rem 1.8rem;
	border: 1px solid var(--otm-green);
	border-radius: 3px;
	background: transparent;
	color: var(--otm-green) !important;
	font-weight: 600;
	font-size: .9rem;
	letter-spacing: .04em;
	text-decoration: none;
	text-transform: uppercase;
}

.otm-btn:hover { background: var(--otm-green); color: #fff !important; }

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

#footer-widgets .footer-widget li { border: 0; padding: .2rem 0; }
#footer-widgets .footer-widget li:before { display: none; }
#footer-widgets h4.title { border-bottom: 1px solid rgba(255,255,255,.18); padding-bottom: .45rem; }

/*
 * Eight Greek menu items do not fit one line at 1280px with Divi's 14px nav type,
 * and the eighth wrapped onto a second row — which reads as broken however few
 * items there are. Trimming a little type and a little gutter fits them all rather
 * than dropping a section from the navigation.
 */
#top-menu li a { font-size: 13px; }
#top-menu > li { padding-right: 18px; }
@media (max-width: 1100px) { #top-menu li a { font-size: 12.5px; } #top-menu > li { padding-right: 14px; } }
