/*
Theme Name: Ernesto
Theme URI: https://doc-hr.com
Author: Sam Krieg
Author URI: https://doc-hr.com
Description: A modern, lightweight, blazingly fast WordPress theme. Mobile-first, SEO-optimized, and built for performance. Compatible with WooCommerce, WPML, BBPress, BuddyPress. No Gutenberg, Classic Editor only. Supports modern image formats (AVIF, WebP) and optimized for AI crawlers.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ernesto
Tags: blog, e-commerce, custom-menu, featured-images, threaded-comments, translation-ready, woocommerce, custom-logo, mobile-first, performance, seo-ready

Ernesto WordPress Theme, (C) 2026
Ernesto is distributed under the terms of the GNU GPL.
*/

/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
1.0 CSS Custom Properties
2.0 Reset & Normalize
3.0 Base Typography
4.0 Layout & Grid
5.0 Header & Navigation
6.0 Content
7.0 Sidebar & Widgets
8.0 Footer
9.0 Forms
10.0 Buttons
11.0 WooCommerce
12.0 Accessibility
13.0 Utilities
14.0 Media Queries
--------------------------------------------------------------*/

/*--------------------------------------------------------------
1.0 CSS Custom Properties
--------------------------------------------------------------*/

/*
 * IMPORTANT: Colors and Fonts are defined in separate files:
 * - /assets/css/colors.css (all color variables, light-dark mode)
 * - /assets/css/fonts.css (all font families, sizes, weights)
 *
 * This file contains layout, spacing, and component-specific variables.
 */

:root {
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --container-width: 1200px;
  --container-width-narrow: 800px;
  --container-padding: 1rem;
  --header-height: 80px;

  /* Borders */
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.375rem;
  --border-radius-lg: 0.5rem;
  --border-radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;
}

/*--------------------------------------------------------------
2.0 Reset & Normalize
--------------------------------------------------------------*/
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

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

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul, ol {
  list-style-position: inside;
}

/*--------------------------------------------------------------
3.0 Base Typography
--------------------------------------------------------------*/
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover, a:focus {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

strong, b {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 0.125rem 0.25rem;
  background-color: var(--color-bg-alt);
  border-radius: var(--border-radius-sm);
}

pre {
  padding: var(--space-md);
  background-color: var(--color-bg-alt);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

blockquote {
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  border-left: 4px solid var(--color-primary);
  background-color: var(--color-bg-alt);
  font-style: italic;
}

/*--------------------------------------------------------------
4.0 Layout & Grid
--------------------------------------------------------------*/
.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-content {
  flex: 1;
  padding: var(--space-xl) 0;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.container-narrow {
  max-width: var(--container-width-narrow);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Full-width layout - extends edge-to-edge */
.container.container-full-width {
  max-width: 100%;
  padding: 0;
}

/* Boxed layout - standard container with max-width */
.container.container-boxed {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Gutenberg block alignment
 * Full-width pages: blocks flow naturally inside .container-full-width (no padding)
 * Boxed pages: alignfull breaks out to container edges; alignwide centres with cap
 */

/* alignfull in boxed layout: expand width to cover container padding on both sides */
.page-layout-boxed .alignfull {
  margin-left: calc(-1 * var(--container-padding));
  margin-right: calc(-1 * var(--container-padding));
  width: calc(100% + 2 * var(--container-padding));
  max-width: calc(100% + 2 * var(--container-padding));
}

/* alignwide on full-width pages: cap at container width and centre */
.page-layout-full-width .alignwide {
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
}

.content-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

/* Prevent grid blowout: grid children must not expand the 1fr track */
.content-area > * {
  min-width: 0;
}

@media (min-width: 768px) {
  .content-area.has-sidebar {
    grid-template-columns: 2fr 1fr;
  }
}

/*--------------------------------------------------------------
5.0 Header & Navigation
--------------------------------------------------------------*/
.site-header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.site-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin: 0;
}

.site-title a {
  color: var(--color-text);
  text-decoration: none;
}

.custom-logo-link {
  display: block;
  line-height: 0;
}

.custom-logo {
  max-height: 50px;
  width: auto;
}

/* Menu styles have been moved to assets/css/menu.css */

/*--------------------------------------------------------------
6.0 Content
--------------------------------------------------------------*/
.entry {
  margin-bottom: var(--space-2xl);
}

.entry-header {
  margin-bottom: var(--space-lg);
}

.entry-title {
  margin-bottom: var(--space-sm);
}

.entry-title a {
  color: var(--color-text);
  text-decoration: none;
}

.entry-title a:hover {
  color: var(--color-primary);
}

.entry-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--space-md);
}

.entry-meta a {
  color: var(--color-text-light);
}

.entry-meta a:hover {
  color: var(--color-primary);
}

.entry-thumbnail {
  margin-bottom: var(--space-lg);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.entry-thumbnail img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.entry-content {
  margin-bottom: var(--space-lg);
}

.entry-content > * + * {
  margin-top: var(--space-md);
}

.entry-footer {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin: var(--space-2xl) 0;
}

.pagination a, .pagination span {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  text-decoration: none;
}

.pagination .current {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/*--------------------------------------------------------------
7.0 Sidebar & Widgets
--------------------------------------------------------------*/
.widget {
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background-color: var(--color-bg-alt);
  border-radius: var(--border-radius-md);
}

.widget-title {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-primary);
}

.widget ul {
  list-style: none;
  padding: 0;
}

.widget li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.widget li:last-child {
  border-bottom: none;
}

/*--------------------------------------------------------------
8.0 Footer
--------------------------------------------------------------*/
.site-footer {
  background-color: var(--color-text);
  color: var(--color-bg-alt);
  padding: var(--space-2xl) 0 var(--space-lg);
  margin-top: var(--space-3xl);
}

.footer-widgets {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .footer-widgets {
    grid-template-columns: repeat(3, 1fr);
  }
}

.site-info {
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.site-info a {
  color: var(--color-bg-alt);
}

/*--------------------------------------------------------------
9.0 Forms
--------------------------------------------------------------*/
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--input-border-primary);
  border-radius: var(--border-radius-md);
  background-color: var(--color-bg);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--input-border-primary-active);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--input-border-primary-active);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
}

/*--------------------------------------------------------------
10.0 Buttons
--------------------------------------------------------------*/
.button,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  background-color: var(--color-primary-dark);
  color: white;
  text-decoration: none;
}

.button-secondary {
  background-color: var(--color-secondary);
}

.button-outline {
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.button-outline:hover {
  background-color: var(--color-primary);
  color: white;
}

/*--------------------------------------------------------------
11.0 WooCommerce
--------------------------------------------------------------*/
.woocommerce-breadcrumb {
  margin-bottom: var(--space-lg);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.products {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  list-style: none;
  padding: 0;
}

@media (min-width: 640px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .products {
    grid-template-columns: repeat(3, 1fr);
  }
}

.product {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: var(--space-md);
  transition: box-shadow var(--transition-base);
}

.product:hover {
  box-shadow: var(--shadow-lg);
}

/*--------------------------------------------------------------
12.0 Accessibility
--------------------------------------------------------------*/
.screen-reader-text {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999999;
  padding: var(--space-md);
  background-color: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
  top: 0;
}

/*--------------------------------------------------------------
13.0 Utilities
--------------------------------------------------------------*/
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.hidden { display: none; }

/*--------------------------------------------------------------
14.0 Media Queries
--------------------------------------------------------------*/
@media (min-width: 1024px) {
  :root {
    --font-size-base: 1.125rem;
    --container-padding: 2rem;
  }
}

@media print {
  /* ── Hide chrome ────────────────────────────────── */
  .site-header,
  .site-footer,
  .sidebar,
  .menu-toggle,
  .back-to-top,
  .ernesto-accessibility-toolbar,
  .cookie-consent,
  .newsletter-section {
    display: none !important;
  }

  /* ── Base typography ────────────────────────────── */
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000 !important;
    background: #fff !important;
  }

  /* ── Cover / hero blocks ────────────────────────── */
  /* Strip the viewport-height min-height so cover blocks don't
     leave large blank areas when background images don't print  */
  .wp-block-cover,
  .wp-block-cover-image {
    min-height: 0 !important;
    padding: 1.5rem 0 !important;
    background: none !important;
  }

  .wp-block-cover__image-background,
  .wp-block-cover__video-background {
    display: none !important;
  }

  .wp-block-cover__inner-container {
    position: static !important;
    transform: none !important;
  }

  /* ── Don't print URLs on buttons or nav links ───── */
  /* accessibility.css already shows a[href]:after for body links,
     but we don't want "(https://…)" appended to every button/nav item */
  .wp-block-button__link::after,
  .wp-block-button a::after,
  a.button::after,
  .button::after,
  .slide-button::after,
  nav a::after,
  .site-header a::after,
  .site-footer a::after,
  .menu a::after {
    display: none !important;
    content: none !important;
  }

  /* ── Page-break hints ───────────────────────────── */
  .wp-block-group,
  .wp-block-columns,
  article,
  .card {
    page-break-inside: avoid;
  }

  h1, h2, h3, h4 {
    page-break-after: avoid;
  }

  /* ── Images ─────────────────────────────────────── */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
}
