/*
Theme Name: Eniki Theme
Theme URI: https://eniki.se
Author: Eniki
Author URI: https://eniki.se
Description: Custom theme for Eniki — IT and IoT company based in Visby, Gotland.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 8.2
Tested up to: 6.7
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: eniki-theme
Tags: custom-menu, featured-images, translation-ready, one-column, two-columns
*/

/* ═══════════════════════════════════
   CSS CUSTOM PROPERTIES
   ═══════════════════════════════════ */

:root {
    /* Brand green matches the pixel logo accent (#8FD400) */
    --color-primary: #8FD400;
    --color-primary-dark: #76AE00;
    --color-secondary: #16150F;
    --color-ink-soft: #2B2926;
    --color-accent: #6B6A62;
    --color-white: #FFFFFF;
    --color-bg: #FAFAF7;
    --color-surface: #FFFFFF;
    --color-text: #23221C;
    --color-text-light: #6B6A62;
    /* Darker green for text-size links: AA contrast on light backgrounds */
    --color-link: #557F00;
    --color-border: #E4E3DC;
    --color-border-dark: #38362F;
    --color-text-on-dark: #F2F1EC;
    --color-text-on-dark-soft: #A5A49B;

    --font-heading: 'Space Grotesk', 'Arial Black', sans-serif;
    --font-body: 'Inter', Arial, Helvetica, sans-serif;
    --font-nav: 'IBM Plex Mono', 'Courier New', monospace;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --max-width: 1200px;
    --header-height: 100px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    --pixel-size: 4px;
    --pixel-shadow: 5px 5px 0 0;

    /* Pixel-grid texture used on dark surfaces */
    --pixel-grid-dark:
        repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 14px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 14px);
}

/* ═══════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background-color: var(--color-primary);
    color: var(--color-secondary);
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

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

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-secondary);
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--color-secondary);
}

h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.625rem, 3.5vw, 2.25rem); }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════
   UTILITY
   ═══════════════════════════════════ */

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

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal;
}

.screen-reader-text:focus {
    background-color: var(--color-white);
    clip: auto;
    display: block;
    font-size: 1rem;
    height: auto;
    left: 5px;
    padding: 15px 23px 14px;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ═══════════════════════════════════
   BUTTONS
   ═══════════════════════════════════ */

.btn,
.wp-block-button__link,
.wpcf7 input[type="submit"] {
    display: inline-block;
    padding: 0.9375rem 2rem;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border: 2px solid var(--color-secondary);
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    background-color: var(--color-primary);
    color: var(--color-secondary);
    box-shadow: var(--pixel-shadow) var(--color-secondary);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover,
.wp-block-button__link:hover,
.wpcf7 input[type="submit"]:hover {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    transform: translate(3px, 3px);
    box-shadow: 2px 2px 0 0 var(--color-secondary);
}

.btn:active,
.wp-block-button__link:active,
.wpcf7 input[type="submit"]:active {
    transform: translate(5px, 5px);
    box-shadow: 0 0 0 0 var(--color-secondary);
}

.btn--white {
    background-color: var(--color-white);
}

.btn--dark {
    background-color: var(--color-secondary);
    color: var(--color-white);
}

/* On dark surfaces the pixel shadow flips to lime */
.home-content > .container > .entry-content > .wp-block-group:last-of-type .wp-block-button__link {
    border-color: var(--color-primary);
    box-shadow: var(--pixel-shadow) var(--color-primary-dark);
}

.home-content > .container > .entry-content > .wp-block-group:last-of-type .wp-block-button__link:hover {
    box-shadow: 2px 2px 0 0 var(--color-primary-dark);
}

/* ═══════════════════════════════════
   HEADER
   ═══════════════════════════════════ */

.site-header {
    background-color: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: var(--spacing-md);
}

.site-logo {
    flex-shrink: 0;
}

.site-logo a {
    display: flex;
    align-items: center;
}

.site-logo svg {
    height: 52px;
    width: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Primary Navigation */
.primary-nav ul {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.primary-nav a {
    font-family: var(--font-nav);
    font-weight: 500;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-secondary);
    padding: 0.5rem 0;
    position: relative;
}

.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a {
    color: var(--color-secondary);
}

/* Pixel-block underline: steps in rather than sliding */
.primary-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-image: linear-gradient(90deg, var(--color-primary) 0 100%);
    background-repeat: no-repeat;
    background-size: 0% 100%;
    transition: background-size 0.2s steps(5, end);
}

.primary-nav a:hover::after,
.primary-nav .current-menu-item > a::after,
.primary-nav .current_page_item > a::after {
    background-size: 100% 100%;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-nav);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid var(--color-border);
    padding: 0.4375rem 0.75rem;
}

.language-switcher a,
.language-switcher span {
    color: var(--color-accent);
    text-decoration: none;
}

.language-switcher a:hover {
    color: var(--color-secondary);
}

.language-switcher .current-lang a,
.language-switcher .current-lang span {
    color: var(--color-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--color-primary);
}

.language-switcher .lang-divider {
    color: var(--color-border);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-secondary);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ═══════════════════════════════════
   FOOTER
   ═══════════════════════════════════ */

.site-footer {
    background-color: var(--color-secondary);
    background-image: var(--pixel-grid-dark);
    border-top: 4px solid var(--color-primary);
    color: var(--color-text-on-dark-soft);
    padding: var(--spacing-lg) 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
}

.footer-col h4 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
}

.footer-col p,
.footer-col a {
    font-size: 0.9375rem;
    color: var(--color-text-on-dark-soft);
    line-height: 1.9;
}

.footer-col a:hover {
    color: var(--color-primary);
}

.footer-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-nav a {
    font-size: 0.9375rem;
    color: var(--color-text-on-dark-soft);
}

.footer-nav a:hover {
    color: var(--color-primary);
}

.footer-logo {
    margin-bottom: var(--spacing-sm);
}

.footer-logo svg {
    height: 30px;
    width: auto;
}

.footer-descriptor {
    font-size: 0.875rem;
    color: var(--color-text-on-dark-soft);
    line-height: 1.7;
    max-width: 30ch;
}

.footer-bottom {
    border-top: 1px solid var(--color-border-dark);
    padding: var(--spacing-sm) 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    color: var(--color-text-on-dark-soft);
}

/* ═══════════════════════════════════
   HERO SECTIONS
   ═══════════════════════════════════ */

.hero {
    position: relative;
    overflow: hidden;
    background-color: var(--color-secondary);
    background-image: var(--pixel-grid-dark);
    color: var(--color-text-on-dark);
    padding: calc(var(--spacing-xl) + var(--spacing-md)) 0 var(--spacing-xl);
}

/* Pixel cluster echoing the logo, fading out toward the corner.
   Grid gaps are painted in the surface colour so only a single mask layer
   (widely supported) is needed for the fade. */
.hero::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 420px;
    height: 320px;
    background-image:
        repeating-linear-gradient(0deg, transparent 0 10px, var(--color-secondary) 10px 14px),
        repeating-linear-gradient(90deg, transparent 0 10px, var(--color-secondary) 10px 14px),
        linear-gradient(var(--color-primary), var(--color-primary));
    -webkit-mask-image: radial-gradient(circle at 75% 75%, rgba(0,0,0,0.5), transparent 70%);
    mask-image: radial-gradient(circle at 75% 75%, rgba(0,0,0,0.5), transparent 70%);
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    color: var(--color-white);
    font-size: clamp(2.5rem, 6vw, 4.25rem);
    max-width: 16ch;
    margin-bottom: var(--spacing-sm);
}

.hero .hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1.0625rem, 2vw, 1.3125rem);
    font-weight: 400;
    color: var(--color-text-on-dark-soft);
    max-width: 56ch;
    line-height: 1.7;
}

.hero .hero-accent {
    display: flex;
    width: 72px;
    height: 12px;
    margin-bottom: var(--spacing-md);
    background-image: repeating-linear-gradient(
        90deg,
        var(--color-primary) 0 12px,
        transparent 12px 16px
    );
}

.hero--page {
    padding: var(--spacing-lg) 0 var(--spacing-lg);
}

.hero--page h1 {
    font-size: clamp(2.125rem, 4.5vw, 3.25rem);
}

.hero--page .hero-subtitle {
    font-size: 1.125rem;
}

.hero--page::after {
    width: 300px;
    height: 220px;
}

/* ═══════════════════════════════════
   HOME PAGE CONTENT
   ═══════════════════════════════════ */

.home-content {
    padding: var(--spacing-xl) 0;
}

.home-content .entry-content > * + * {
    margin-top: var(--spacing-xl);
}

/* Stray empty paragraphs from the editor should not affect layout */
.home-content .entry-content > p:empty {
    display: none;
}

/* Tighten the gap between a heading/intro and the block that follows it */
.home-content .entry-content > h2 + p,
.home-content .entry-content > h2 + .wp-block-columns,
.home-content .entry-content > p + .wp-block-columns,
.home-content .entry-content > p + p,
.home-content .entry-content > .wp-block-columns + .wp-block-columns {
    margin-top: var(--spacing-md);
}

.home-content h2 {
    position: relative;
    margin-bottom: var(--spacing-sm);
}

/* Pixel marker before left-aligned section headings.
   The marker is a single flex item (lime square + ink square via gradient)
   centered against the heading text with align-items, so it stays vertically
   centred at any font size and on multi-line headings. */
.home-content .entry-content > h2:not(.has-text-align-center) {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.home-content .entry-content > h2:not(.has-text-align-center)::before {
    content: '';
    flex: 0 0 12px;
    width: 12px;
    height: 28px;
    background-image: linear-gradient(
        180deg,
        var(--color-primary) 0 12px,
        transparent 12px 16px,
        var(--color-secondary) 16px 28px
    );
}

.home-content h3 {
    font-size: 1.1875rem;
    margin-bottom: var(--spacing-xs);
}

.home-content p {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text);
    max-width: 800px;
}

.home-content .has-text-align-center {
    margin-left: auto;
    margin-right: auto;
}

/* Centered section headings get a small pixel-dash strip above them */
.home-content .entry-content > h2.has-text-align-center {
    padding-top: var(--spacing-md);
    background-image: repeating-linear-gradient(
        90deg,
        var(--color-primary) 0 10px,
        transparent 10px 14px
    );
    background-repeat: no-repeat;
    background-size: 66px 8px;
    background-position: top center;
}

.home-content .entry-content > p.has-text-align-center {
    color: var(--color-text-light);
    font-size: 1.0625rem;
    max-width: 52ch;
}

/* Columns become pixel-cards */
.home-content .wp-block-columns {
    gap: var(--spacing-sm);
    align-items: stretch;
}

.home-content .wp-block-column {
    min-width: 0;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-secondary);
    padding: var(--spacing-md);
}

.home-content .wp-block-column h3 {
    position: relative;
    padding-top: var(--spacing-sm);
}

.home-content .wp-block-column h3::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background-color: var(--color-primary);
    box-shadow: 12px 0 0 0 var(--color-border);
}

.home-content .wp-block-column p {
    font-size: 0.9375rem;
    color: var(--color-text-light);
}

.home-content .wp-block-group {
    max-width: 800px;
}

.home-content .wp-block-buttons {
    margin-top: var(--spacing-md);
    display: flex;
    justify-content: center;
}

/* CTA: final group becomes a dark pixel panel */
.home-content > .container > .entry-content > .wp-block-group:last-of-type {
    position: relative;
    overflow: hidden;
    background-color: var(--color-secondary);
    background-image: var(--pixel-grid-dark);
    border: none;
    max-width: none;
    padding: var(--spacing-lg) var(--spacing-md);
    text-align: center;
}

.home-content > .container > .entry-content > .wp-block-group:last-of-type::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-image: repeating-linear-gradient(
        90deg,
        var(--color-primary) 0 24px,
        transparent 24px 32px
    );
}

.home-content > .container > .entry-content > .wp-block-group:last-of-type h2 {
    color: var(--color-white);
    padding-left: 0;
}

.home-content > .container > .entry-content > .wp-block-group:last-of-type h2::before {
    display: none;
}

.home-content > .container > .entry-content > .wp-block-group:last-of-type p {
    color: var(--color-text-on-dark-soft);
    margin-left: auto;
    margin-right: auto;
    max-width: 52ch;
}

/* ═══════════════════════════════════
   ABOUT PAGE
   ═══════════════════════════════════ */

.about-section {
    padding: var(--spacing-xl) 0;
}

.about-section h2 {
    margin-bottom: var(--spacing-md);
}

.about-section p {
    font-size: 1.0625rem;
    line-height: 1.85;
    max-width: 720px;
    color: var(--color-text);
}

.about-section--editable .entry-content {
    max-width: 720px;
}

/* First paragraph reads as a lead */
.about-section--editable .entry-content > h2:first-child + p {
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--color-ink-soft);
}

.about-section--editable h2 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.about-section--editable h2::before {
    content: '';
    flex: 0 0 12px;
    width: 12px;
    height: 28px;
    background-image: linear-gradient(
        180deg,
        var(--color-primary) 0 12px,
        transparent 12px 16px,
        var(--color-secondary) 16px 28px
    );
}

/* Spacing between About sections — no divider, front-page-style rhythm */
.about-section--editable h2:not(:first-child) {
    margin-top: var(--spacing-xl);
}

/* ═══════════════════════════════════
   SERVICES PAGE
   ═══════════════════════════════════ */

.services-content {
    counter-reset: service-section;
    padding-bottom: var(--spacing-xl);
}

.services-content .entry-content {
    max-width: 800px;
}

.services-content h2 {
    counter-increment: service-section;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    margin-bottom: var(--spacing-sm);
    padding-top: var(--spacing-xl);
}

/* Lime + ink pixel marker before the number (order: -1 places it first).
   Matches the About/Home heading markers and is centred via align-items. */
.services-content h2::after {
    content: '';
    order: -1;
    flex: 0 0 12px;
    width: 12px;
    height: 28px;
    background-image: linear-gradient(
        180deg,
        var(--color-primary) 0 12px,
        transparent 12px 16px,
        var(--color-secondary) 16px 28px
    );
}

.services-content h2::before {
    content: counter(service-section, decimal-leading-zero);
    color: var(--color-link);
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
}

.services-content p {
    font-size: 1.0625rem;
    line-height: 1.8;
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.services-content ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xs) var(--spacing-lg);
    margin: 0 0 var(--spacing-sm);
    padding: 0;
    position: relative;
}

/* Vertical pixel-dash rail filling the gutter between the two columns */
.services-content ul::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    bottom: 0.75rem;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background-image: repeating-linear-gradient(
        180deg,
        var(--color-border) 0 8px,
        transparent 8px 13px
    );
}

.services-content ul li {
    font-size: 0.9375rem;
    line-height: 1.6;
    padding: 0.625rem 0 0.625rem 1.625rem;
    position: relative;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

.services-content ul li::before {
    background-color: var(--color-primary);
    content: '';
    height: 8px;
    left: 0;
    position: absolute;
    top: 1.05em;
    width: 8px;
}

/* Checkerboard the list dots: lime/ink alternating across the 2-column grid.
   Default is lime; the 2nd and 3rd of every 4 items are ink, so each row
   flips the colour order relative to the row above. */
.services-content ul li:nth-child(4n+2)::before,
.services-content ul li:nth-child(4n+3)::before {
    background-color: var(--color-secondary);
}

/* ═══════════════════════════════════
   CONTACT PAGE
   ═══════════════════════════════════ */

.contact-grid {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: var(--spacing-lg);
    padding: var(--spacing-xl) 0;
    align-items: start;
}

.contact-grid--editable > * {
    min-width: 0;
}

.contact-grid--editable h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
}

/* First group: contact information panel on dark */
.contact-grid--editable > .wp-block-group:first-child {
    background-color: var(--color-secondary);
    background-image: var(--pixel-grid-dark);
    border-top: 4px solid var(--color-primary);
    padding: var(--spacing-md);
}

.contact-grid--editable > .wp-block-group:first-child h2 {
    color: var(--color-white);
}

.contact-grid--editable > .wp-block-group:first-child p {
    color: var(--color-text-on-dark);
}

.contact-grid--editable > .wp-block-group:first-child a {
    color: var(--color-text-on-dark);
    border-bottom: 1px solid var(--color-primary);
}

.contact-grid--editable > .wp-block-group:first-child a:hover {
    color: var(--color-primary);
}

.contact-grid--editable h3 {
    color: var(--color-text-light);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.6875rem;
    letter-spacing: 0.18em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.contact-grid--editable > .wp-block-group:first-child h3 {
    color: var(--color-primary);
    margin-top: var(--spacing-sm);
}

.contact-grid--editable p {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
}

.contact-grid--editable a {
    color: var(--color-text);
}

.contact-grid--editable a:hover {
    color: var(--color-link);
}

/* Contact Form 7 overrides */
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0;
    background-color: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wpcf7 input:focus,
.wpcf7 textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 3px 3px 0 0 var(--color-primary);
}

.wpcf7 p {
    margin-bottom: var(--spacing-sm);
}

.wpcf7 form .wpcf7-response-output {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    margin: var(--spacing-sm) 0 0;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
}

/* ═══════════════════════════════════
   SINGLE POST
   ═══════════════════════════════════ */

.post-content {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg) 0;
}

.post-content h1 {
    margin-bottom: var(--spacing-xs);
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-accent);
    margin-bottom: var(--spacing-md);
}

.post-body h2,
.post-body h3,
.post-body h4 {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.post-body p {
    line-height: 1.8;
}

.post-body ul,
.post-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    list-style: disc;
}

.post-body ol {
    list-style: decimal;
}

.post-body blockquote {
    border-left: 3px solid var(--color-primary);
    padding-left: var(--spacing-sm);
    margin: var(--spacing-md) 0;
    font-style: italic;
    color: var(--color-accent);
}

.post-body img {
    margin: var(--spacing-md) 0;
}

/* ═══════════════════════════════════
   404 PAGE
   ═══════════════════════════════════ */

.error-404 {
    text-align: center;
    padding: var(--spacing-xl) 0;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-404 h1 {
    font-family: var(--font-mono);
    font-size: 6rem;
    color: var(--color-link);
    margin-bottom: var(--spacing-xs);
}

.error-404 p {
    font-size: 1.25rem;
    color: var(--color-accent);
    margin-bottom: var(--spacing-md);
}

/* ═══════════════════════════════════
   SEARCH FORM
   ═══════════════════════════════════ */

.search-form {
    display: flex;
    max-width: 500px;
}

.search-form .search-field {
    flex: 1;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: 0;
}

.search-form .search-field:focus {
    outline: none;
    border-color: var(--color-primary);
}

.search-form .search-submit {
    padding: 0.75rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background-color: var(--color-secondary);
    color: var(--color-white);
    border: none;
    border-radius: 0;
    cursor: pointer;
}

.search-form .search-submit:hover {
    background-color: var(--color-ink-soft);
}

/* ═══════════════════════════════════
   PAGE CONTENT (generic)
   ═══════════════════════════════════ */

.page-content {
    padding: var(--spacing-lg) 0;
}

.page-content .entry-content {
    max-width: 800px;
}

/* ═══════════════════════════════════
   MOTION
   ═══════════════════════════════════ */

/* Hero entrance: accent strip types in, text rises gently. Once, on load. */
@keyframes eniki-strip-in {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0 0 0); }
}

/* Gentle rise for the hero on page load. */
@keyframes eniki-rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* Stronger reveal for scroll-driven content sections. */
@keyframes eniki-reveal {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
    .hero .hero-accent {
        animation: eniki-strip-in 0.5s steps(5, end) 0.1s both;
    }

    .hero h1 {
        animation: eniki-rise 0.5s ease-out 0.15s both;
    }

    .hero .hero-subtitle {
        animation: eniki-rise 0.5s ease-out 0.3s both;
    }
}

/* Scroll-driven reveal. CSS-only progressive enhancement: browsers without
   animation-timeline show fully static pages — no broken/hidden state.

   Block-level elements rise as they enter the viewport. Cards and list
   items are revealed individually, and a small per-item offset to the
   trigger range produces a gentle stagger as a row "deals in". */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {

        /* Block-level reveal (columns containers excluded — their columns
           animate individually below, to avoid a double animation).
           Range plays as the element rises ~10%–55% through entry, so the
           motion is clearly visible rather than finishing near the edge. */
        .home-content .entry-content > *:not(.wp-block-columns),
        .about-section--editable .entry-content > h2,
        .about-section--editable .entry-content > p,
        .services-content .entry-content > h2,
        .services-content .entry-content > p,
        .contact-grid--editable > * {
            animation: eniki-reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 40%;
        }

        /* Cards + checklist items: individual reveal with a clear stagger.
           Ending the range later makes a row "deal in" — earlier items
           finish first while later ones are still rising. */
        .home-content .wp-block-column,
        .services-content ul li {
            animation: eniki-reveal linear both;
            animation-timeline: view();
            animation-range: entry 0% cover 35%;
        }

        .home-content .wp-block-column:nth-child(2),
        .services-content ul li:nth-child(2n) {
            animation-range: entry 0% cover 50%;
        }

        .home-content .wp-block-column:nth-child(3) {
            animation-range: entry 0% cover 65%;
        }
    }
}

/* ═══════════════════════════════════
   MOTION PREFERENCES
   ═══════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════ */

@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }

    .contact-grid {
        gap: var(--spacing-md);
    }
}

/* ═══════════════════════════════════
   RESPONSIVE — MOBILE
   ═══════════════════════════════════ */

@media (max-width: 768px) {
    :root {
        --header-height: 80px;
        --spacing-xl: 4rem;
    }

    .site-logo svg {
        height: 38px;
    }

    .hero {
        padding: var(--spacing-lg) 0;
    }

    .hero::after {
        width: 220px;
        height: 160px;
        opacity: 0.6;
    }

    .menu-toggle {
        display: flex;
    }

    /* Anchored to the header's bottom edge (top: 100%) so it always clears
       the logo and toggle regardless of header height. z-index: -1 keeps it
       behind the header bar, so the logo and close button stay on top and
       clickable; the closed panel tucks up out of sight behind the bar. */
    .header-right {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: -1;
        background-color: var(--color-white);
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: var(--spacing-md);
        transform: translateY(-110%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    }

    .header-right.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .primary-nav ul {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
    }

    .primary-nav a {
        font-size: 1rem;
        padding: 0.5rem;
    }

    .language-switcher {
        border: none;
        padding: var(--spacing-sm) 0 0;
        border-top: 1px solid var(--color-border);
    }

    .home-content .entry-content > * + * {
        margin-top: var(--spacing-lg);
    }

    .services-content ul {
        grid-template-columns: 1fr;
    }

    .services-content ul::before {
        display: none;
    }

    /* Single column: simple lime/ink alternation per item */
    .services-content ul li:nth-child(4n+2)::before,
    .services-content ul li:nth-child(4n+3)::before {
        background-color: var(--color-primary);
    }

    .services-content ul li:nth-child(even)::before {
        background-color: var(--color-secondary);
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .home-content .wp-block-column {
        padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-md);
    }
}
