/*
Theme Name: Celmed 2026
Theme URI:
Author: Robert Konik
Description: Refreshed classic theme for celmed.com.pl — keeps the celmed5 identity (teal palette, Arial body / Georgia headings, two-column layout with left sidebar) but rebuilt with semantic HTML5 and responsive CSS. No Artisteer wrappers, no IE6/7 stylesheets.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: celmed2026
Tags: two-columns, left-sidebar, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, healthcare, clinic
*/

/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
	--color-primary-dark: #114E5F;
	--color-primary:      #19768F;
	--color-accent:       #3CBADD;
	--color-deep:         #0B3541;
	--color-surface:      #D4DCDD;
	--color-surface-soft: #EAF4F6;
	--color-background:   #ffffff;
	--color-foreground:   #22292B;
	--color-muted:        #4A5A5E;
	--color-rule:         #dfe7e9;

	--font-body:    Arial, Helvetica, "Liberation Sans", sans-serif;
	--font-heading: Georgia, "Times New Roman", Times, serif;

	--fs-small:    11px;
	--fs-body:     13px;
	--fs-emph:     16px;
	--fs-h3:       22px;
	--fs-h2:       26px;
	--fs-h1:       30px;

	--layout-max:      1200px;
	--content-max:     680px;
	--sidebar-width:   260px;
	--layout-gap:      32px;

	--space-1: 8px;
	--space-2: 16px;
	--space-3: 24px;
	--space-4: 32px;
	--space-5: 48px;

	--radius: 6px;
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: var(--fs-body); }

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: var(--fs-body);
	line-height: 1.55;
	color: var(--color-foreground);
	background-color: var(--color-background);
	position: relative;
}

/* Decorative background layer — fixed to the viewport so it looks
   identical on every page regardless of content length. Placed behind
   all content via negative z-index. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: url("assets/background.svg") left top / cover no-repeat;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a {
	color: var(--color-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
}
a:hover, a:focus { color: var(--color-accent); }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-heading);
	font-weight: 700;
	color: var(--color-primary-dark);
	margin: 0 0 var(--space-2);
	line-height: 1.25;
}
h1 { font-size: var(--fs-h1); line-height: 1.15; }
h2 { font-size: var(--fs-h2); line-height: 1.2; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: 18px; }
h5 { font-size: var(--fs-emph); }
h6 { font-size: 14px; }

p, ul, ol, dl, figure, pre, blockquote { margin: 0 0 var(--space-2); }

hr { border: 0; border-top: 1px solid var(--color-rule); margin: var(--space-4) 0; }

blockquote {
	border-left: 3px solid var(--color-accent);
	padding: var(--space-1) var(--space-3);
	color: var(--color-muted);
	background: var(--color-surface-soft);
	border-radius: var(--radius);
}

code, kbd, pre, samp { font-family: ui-monospace, "Menlo", "Consolas", monospace; font-size: 0.95em; }
pre { overflow-x: auto; padding: var(--space-2); background: var(--color-surface-soft); border-radius: var(--radius); }

/* Screen-reader helpers */
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
	position: absolute; left: -9999px; top: auto;
	background: var(--color-primary-dark); color: #fff; padding: 8px 12px;
}
.skip-link:focus { left: 8px; top: 8px; z-index: 1000; }

/* ==========================================================================
   Layout frame
   ========================================================================== */

.site {
	max-width: var(--layout-max);
	margin: 0 auto;
	padding: 0 var(--space-3);
}

.site-header {
	padding: var(--space-4) 0 var(--space-3);
	border-bottom: 1px solid var(--color-rule);
	margin-bottom: var(--space-4);
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
	align-items: center;
	justify-content: space-between;
}

.site-branding {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
}
.site-branding a { text-decoration: none; color: inherit; }
.site-logo .custom-logo-link { display: inline-block; }
.site-logo img { max-height: 72px; width: auto; display: block; }
.site-identity { min-width: 0; }
.site-title {
	font-family: var(--font-heading);
	font-size: var(--fs-h2);
	font-weight: 700;
	color: var(--color-primary-dark);
	margin: 0;
	line-height: 1.2;
}
.site-title a { color: inherit; }
.site-description {
	font-size: var(--fs-small);
	color: var(--color-muted);
	margin: 4px 0 0;
}

/* Sectional sidebar navigation
   ---------------------------------
   Top-level items render as a vertical list. Submenus are hidden by
   default and revealed only for the current section (current item or
   its ancestor). */
.section-nav { margin-bottom: var(--space-3); }
.section-menu,
.section-menu ul {
	list-style: none; margin: 0; padding: 0;
}
.section-menu > li {
	border-top: 1px solid var(--color-rule);
}
.section-menu > li:last-child { border-bottom: 1px solid var(--color-rule); }
.section-menu a {
	display: block;
	text-decoration: none;
	color: var(--color-primary-dark);
	font-weight: 700;
	padding: 10px 12px;
}
.section-menu a:hover,
.section-menu a:focus {
	background: var(--color-surface-soft);
	color: var(--color-primary);
}
.section-menu .current-menu-item > a,
.section-menu .current-menu-ancestor > a {
	color: var(--color-primary);
	background: var(--color-surface-soft);
	box-shadow: inset 3px 0 0 var(--color-accent);
}

/* Parents with children: the <a>, toggle button, and the <ul.sub-menu>
   need to share a single row layout. Flex with wrap keeps the submenu
   on its own row below the anchor+button. */
.section-menu li.menu-item-has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
}
.section-menu li.menu-item-has-children > a { flex: 1 1 auto; min-width: 0; }
.section-menu li.menu-item-has-children > .sub-menu { flex: 0 0 100%; }

/* Toggle button — shows "+" when collapsed, "−" when expanded. */
.section-menu-toggle {
	flex: 0 0 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	cursor: pointer;
	color: var(--color-primary-dark);
	padding: 0;
	font: inherit;
}
.section-menu-toggle:hover,
.section-menu-toggle:focus {
	background: var(--color-surface-soft);
	color: var(--color-primary);
}
.section-menu-toggle-icon {
	position: relative;
	display: inline-block;
	width: 14px;
	height: 14px;
}
.section-menu-toggle-icon::before,
.section-menu-toggle-icon::after {
	content: "";
	position: absolute;
	background: currentColor;
	border-radius: 1px;
	left: 50%; top: 50%;
	transition: transform 0.15s ease, opacity 0.15s ease;
}
.section-menu-toggle-icon::before {
	width: 14px; height: 2px;
	transform: translate(-50%, -50%);
}
.section-menu-toggle-icon::after {
	width: 2px; height: 14px;
	transform: translate(-50%, -50%);
}
.section-menu-toggle[aria-expanded="true"] .section-menu-toggle-icon::after {
	transform: translate(-50%, -50%) scaleY(0);
	opacity: 0;
}

/* Submenus: default to expanded (no-JS fallback — everything stays
   navigable without scripts). When section-menu.js runs, it adds a
   `js` class to <html> and we flip to collapse-by-default. */
.section-menu .sub-menu {
	display: block;
	background: #fff;
	border-top: 1px solid var(--color-rule);
}
.js .section-menu .sub-menu { display: none; }
.js .section-menu .is-open > .sub-menu { display: block; }

/* Hide the "+" toggle button when JS is off (it wouldn't do anything). */
.section-menu-toggle { display: none; }
.js .section-menu-toggle { display: inline-flex; }
.section-menu .sub-menu a {
	font-weight: 400;
	font-size: var(--fs-body);
	padding: 6px 12px 6px 24px;
	color: var(--color-foreground);
}
.section-menu .sub-menu a:hover,
.section-menu .sub-menu a:focus,
.section-menu .sub-menu .current-menu-item > a {
	background: var(--color-surface-soft);
	color: var(--color-primary);
	box-shadow: none;
}
.section-menu .sub-menu .sub-menu a { padding-left: 36px; }

/* Main content grid: sidebar + content */
.site-inner {
	display: grid;
	grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
	gap: var(--layout-gap);
	align-items: start;
	padding-bottom: var(--space-5);
}

.content-area { min-width: 0; }
.content-area > .prose,
.entry-content,
.page-content {
	max-width: var(--content-max);
}

/* Sidebar */
.widget-area {
	background: var(--color-surface-soft);
	border-radius: var(--radius);
	padding: var(--space-3);
}
.widget { margin-bottom: var(--space-3); }
.widget:last-child { margin-bottom: 0; }
.widget-title { font-size: var(--fs-emph); margin: 0 0 var(--space-2); }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { padding: 4px 0; border-bottom: 1px dotted var(--color-rule); }
.widget li:last-child { border-bottom: 0; }

/* Footer */
.site-footer {
	background: var(--color-primary-dark);
	color: #fff;
	padding: var(--space-4) var(--space-3);
	margin-top: var(--space-5);
}
.site-footer a { color: var(--color-accent); }
.site-footer .footer-inner {
	max-width: var(--layout-max); margin: 0 auto;
	display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: space-between; align-items: center;
}
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.footer-nav a { color: #fff; text-decoration: none; font-size: var(--fs-small); }
.footer-nav a:hover { color: var(--color-accent); }

/* ==========================================================================
   Posts / pages
   ========================================================================== */

.entry { margin-bottom: var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-rule); }
.entry:last-child { border-bottom: 0; }

.entry-header { margin-bottom: var(--space-2); }
.entry-title { margin: 0 0 var(--space-1); }
.entry-title a { text-decoration: none; color: inherit; }
.entry-title a:hover { color: var(--color-primary); }

.entry-meta { color: var(--color-muted); font-size: var(--fs-small); display: flex; flex-wrap: wrap; gap: var(--space-2); }
.entry-meta a { color: inherit; }

.entry-thumbnail { margin: var(--space-2) 0 var(--space-3); }
.entry-thumbnail img { border-radius: var(--radius); }

.entry-footer { color: var(--color-muted); font-size: var(--fs-small); margin-top: var(--space-3); }

/* Buttons */
.button, .wp-block-button__link, input[type="submit"], button[type="submit"] {
	display: inline-block;
	font-family: var(--font-body);
	font-weight: 700;
	background: var(--color-primary);
	color: #fff;
	padding: 8px 14px;
	border: 0;
	border-radius: var(--radius);
	cursor: pointer;
	text-decoration: none;
	line-height: 1.2;
}
.button:hover, .wp-block-button__link:hover, input[type="submit"]:hover, button[type="submit"]:hover {
	background: var(--color-primary-dark);
	color: #fff;
}

/* Forms */
input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], textarea, select {
	font: inherit;
	padding: 6px 8px;
	border: 1px solid var(--color-surface);
	border-radius: 4px;
	background: #fff;
	width: 100%;
	max-width: 320px;
}

/* Search form */
.search-form { display: flex; gap: var(--space-1); }
.search-form label { flex: 1; }
.search-form input[type="search"] { width: 100%; max-width: none; }

/* Pagination */
.pagination, .posts-navigation, .post-navigation { margin: var(--space-4) 0; display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; }
.pagination .page-numbers, .posts-navigation a, .post-navigation a {
	padding: 4px 10px; border: 1px solid var(--color-rule); border-radius: 4px; text-decoration: none;
}
.pagination .page-numbers.current {
	background: var(--color-primary); color: #fff; border-color: var(--color-primary);
}

/* Comments */
.comments-area { margin-top: var(--space-5); }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list li { margin-bottom: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-rule); }
.comment-list .children { list-style: none; padding-left: var(--space-3); }
.comment-meta { font-size: var(--fs-small); color: var(--color-muted); margin-bottom: var(--space-1); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
	.site-inner {
		grid-template-columns: 1fr;
		gap: var(--space-4);
	}
	/* Nav sits with widgets in the sidebar; keep it above the content
	   on mobile so the user always sees navigation first. */
	.widget-area { order: 0; }
	.content-area { order: 1; }
}

@media (max-width: 600px) {
	html { font-size: 14px; }
	body { font-size: 14px; }
	.site-title { font-size: 26px; }
	h1 { font-size: 26px; }
	h2 { font-size: 22px; }
	h3 { font-size: 18px; }
	.site-header { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================================
   WordPress-generated classes (alignment, captions, galleries)
   ========================================================================== */

.alignleft  { float: left;  margin: 0 var(--space-3) var(--space-2) 0; }
.alignright { float: right; margin: 0 0 var(--space-2) var(--space-3); }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignwide, .alignfull { margin-left: calc(50% - 50vw + var(--space-3)); margin-right: calc(50% - 50vw + var(--space-3)); max-width: none; }
.wp-caption, figure.wp-caption { max-width: 100%; margin: 0 0 var(--space-2); }
.wp-caption-text, figcaption { font-size: var(--fs-small); color: var(--color-muted); padding: 4px 0; }
.sticky .entry-title::before { content: "★ "; color: var(--color-accent); }
