/*
Theme Name: Ovipaja
Theme URI: https://www.ovipaja.fi
Author: Napapiirin Ovipaja Oy
Description: Modern, marketing-focused custom theme for Napapiirin Ovipaja Oy. Lightweight, fast, and built to showcase project work.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: ovipaja
*/

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */
:root {
    /* Colors */
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-dark: #111317;
    --color-dark-soft: #1a1d23;
    --color-text: #1a1d23;
    --color-text-light: #6b7280;
    --color-accent: #2563eb;
    --color-accent-dark: #1d4ed8;
    --color-accent-light: #dbeafe;
    --color-border: #e5e7eb;
    --color-success: #059669;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, Consolas, "Liberation Mono", monospace;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 3rem;
    --space-xl: 5rem;
    --space-2xl: 8rem;

    /* Layout */
    --container-max: 1200px;
    --container-padding: 1.25rem;

    /* Radius */
    --radius: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.4s ease;
}

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

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

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-dark);
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.5rem);
    letter-spacing: -0.01em;
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

h4 {
    font-size: 1.125rem;
}

p {
    margin-bottom: 1rem;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

.section {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
}

.section--tight {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
}

.section--dark {
    background-color: var(--color-dark);
    color: #e5e7eb;
}

.section--dark h2,
.section--dark h3 {
    color: #fff;
}

.text-center {
    text-align: center;
}

.section-header {
    max-width: 640px;
    margin: 0 auto var(--space-lg);
    text-align: center;
}

.section-header .eyebrow {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--color-text-light);
    font-size: 1.125rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    line-height: 1.4;
}

.btn--primary {
    background-color: var(--color-accent);
    color: #fff;
}

.btn--primary:hover {
    background-color: var(--color-accent-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn--outline {
    background-color: transparent;
    border-color: currentColor;
}

.btn--outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn--light {
    background-color: #fff;
    color: var(--color-dark);
}

.btn--light:hover {
    background-color: #f3f4f6;
    color: var(--color-dark);
}

.btn--lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ==========================================================================
   Header / Navigation
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(17, 19, 23, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    padding-bottom: 0;
    transition: padding-bottom 0.35s ease;
}

/* When hovering, the whole bar grows taller to reveal the mega menu */
.site-header:hover {
    padding-bottom: 280px;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.site-logo span {
    color: var(--color-accent);
}

.site-logo:hover {
    color: #fff;
}

.primary-nav {
    display: flex;
    align-items: center;
}

.primary-nav > ul,
.primary-nav ul {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.primary-nav > ul > li > a,
.primary-nav ul li > a {
    color: #d1d5db;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition);
    text-decoration: none;
    padding: 0.25rem 0;
    display: inline-block;
}

.primary-nav > ul > li > a:hover,
.primary-nav ul li > a:hover {
    color: #fff;
}

/* ==========================================================================
   Mega Menu — header bar expands vertically on hover
   ========================================================================== */

/* Regular sub-menus (Ota yhteyttä etc.) — vertical dropdown */
.primary-nav .sub-menu {
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 200px;
    background: var(--color-dark);
    border-top: 2px solid var(--color-accent);
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
}

/* Show sub-menus on hover */
.menu-item-has-children:hover > .sub-menu {
    display: block;
}

.primary-nav .sub-menu > li {
    margin: 0;
    padding: 0;
}

.primary-nav .sub-menu > li > a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #d1d5db;
    text-decoration: none;
    transition: background-color var(--transition), color var(--transition);
}

.primary-nav .sub-menu > li > a:hover {
    background-color: var(--color-accent);
    color: #fff;
}

/* Tuotteet item — static so sub-menu positions relative to the header, not the li */
#menu-item-673 {
    position: static;
}

#menu-item-673 > a {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

#menu-item-673 > a::after {
    content: "▼";
    font-size: 0.65em;
    margin-left: 0.3rem;
    transition: transform var(--transition);
}

/* Rotate arrow when header is expanded */
.site-header:hover #menu-item-673 > a::after {
    transform: rotate(180deg);
}

/* Highlight Tuotteet link when header is expanded */
.site-header:hover #menu-item-673 > a {
    color: #fff;
}

/* Tuotteet sub-menu — full-width panel inside the header, styled like footer columns */
#menu-item-673 .sub-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 64px;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    background: #111317;
    border-top: 2px solid var(--color-accent);
    padding: 2.5rem var(--container-padding) 2.5rem var(--container-padding);
    list-style: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    /* Hidden by default, shown when header is hovered */
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.35s ease, opacity 0.35s ease;
}

/* Show Tuotteet sub-menu when header is hovered */
.site-header:hover #menu-item-673 .sub-menu {
    visibility: visible;
    opacity: 1;
}

/* Each product category = one column */
#menu-item-673 .sub-menu > li {
    min-width: 0;
}

#menu-item-673 .sub-menu > li > a {
    color: #d1d5db;
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0;
    display: block;
    border-left: 3px solid transparent;
    padding-left: 1rem;
    transition: color var(--transition), border-color var(--transition);
}

#menu-item-673 .sub-menu > li > a:hover {
    color: #fff;
    border-left-color: var(--color-accent);
}

/* Mobile: reset header expansion, sub-menu becomes part of mobile nav */
@media (max-width: 768px) {
    .site-header {
        overflow: visible;
        padding-bottom: 0 !important;
    }

    .site-header:hover {
        padding-bottom: 0 !important;
    }

    #menu-item-673 .sub-menu {
        position: static;
        max-width: none;
        margin: 0;
        padding: 0.5rem 0 0;
        background: transparent;
        border-top: none;
        display: block;
        grid-template-columns: none;
        gap: 0;
    }

    #menu-item-673 .sub-menu > li > a {
        padding: 0.75rem 0;
        font-size: 0.95rem;
        font-weight: 500;
        border-left: none;
        padding-left: 1.5rem;
        color: #d1d5db;
    }

    #menu-item-673 .sub-menu > li > a:hover {
        color: #fff;
        border-left: none;
    }

    #menu-item-673 .sub-menu > li > a::before {
        content: "→ ";
        color: var(--color-accent);
        margin-right: 0.25rem;
    }
}

/* ==========================================================================
   Header Actions
   ========================================================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-actions .btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #fff;
    margin: 5px 0;
    transition: all var(--transition);
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    color: #fff;
    overflow: hidden;
}

.hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(17, 19, 23, 0.85) 0%, rgba(17, 19, 23, 0.5) 100%);
}

.hero__content {
    position: relative;
    z-index: 1;
    max-width: 640px;
    padding: var(--space-2xl) 0;
}

.hero__eyebrow {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent-light);
    margin-bottom: 1rem;
}

.hero h1 {
    color: #fff;
    margin-bottom: 1.5rem;
}

.hero__text {
    font-size: 1.25rem;
    color: #d1d5db;
    margin-bottom: 2rem;
    max-width: 480px;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ==========================================================================
   Stats Bar
   ========================================================================== */
.stats-bar {
    background-color: var(--color-dark);
    color: #fff;
    padding: var(--space-lg) 0;
}

.stats-bar .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat__number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-accent);
    line-height: 1;
}

.stat__label {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

/* ==========================================================================
   Services / Cards
   ========================================================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.service-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition);
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent);
}

.service-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background-color: var(--color-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
}

.service-card h3 {
    margin-bottom: 0.5rem;
}

.service-card p {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.service-card a {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ==========================================================================
   Portfolio / Project Grid
   ========================================================================== */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    display: block;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.project-card__image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background-color: var(--color-dark);
}

.project-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.project-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
}

.project-card__placeholder svg {
    width: 100%;
    height: 100%;
}

.project-card:hover .project-card__image img {
    transform: scale(1.05);
}

.project-card__body {
    padding: 1.25rem;
}

.project-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--color-dark);
}

.project-card__meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.project-card__excerpt {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* ==========================================================================
   Partners
   ========================================================================== */
.partners {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.partners-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 3rem;
}

.partners-grid img {
    max-height: 60px;
    width: auto;
    opacity: 0.7;
    filter: grayscale(100%);
    transition: all var(--transition);
}

.partners-grid img:hover {
    opacity: 1;
    filter: grayscale(0);
}

/* ==========================================================================
   CTA Section
   ========================================================================== */
.cta-section {
    background-color: var(--color-dark);
    color: #fff;
    text-align: center;
}

.cta-section h2 {
    color: #fff;
    margin-bottom: 1rem;
}

.cta-section p {
    color: #9ca3af;
    font-size: 1.125rem;
    max-width: 480px;
    margin: 0 auto 2rem;
}

/* ==========================================================================
   Content / Article
   ========================================================================== */
.page-header {
    background-color: var(--color-dark);
    color: #fff;
    padding: var(--space-xl) 0;
}

.page-header h1 {
    color: #fff;
}

.page-header p {
    color: #9ca3af;
    margin-top: 0.5rem;
}

.breadcrumb {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: #d1d5db;
}

.breadcrumb a:hover {
    color: #fff;
}

.article-content {
    max-width: 760px;
    margin: 0 auto;
}

.article-content img {
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

.article-content h2 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.article-content ul,
.article-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

.article-content blockquote {
    border-left: 4px solid var(--color-accent);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--color-text-light);
}

.entry-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

/* ==========================================================================
   Single Project
   ========================================================================== */
.project-hero {
    background-color: var(--color-dark);
    color: #fff;
    padding: var(--space-xl) 0;
}

.project-hero h1 {
    color: #fff;
}

.project-info {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-top: var(--space-lg);
}

.project-info__details {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    align-self: start;
}

.project-info__details h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.project-info__details dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    margin-top: 0.75rem;
}

.project-info__details dd {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background-color: var(--color-dark);
    color: #9ca3af;
    padding: var(--space-xl) 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: var(--space-lg);
}

.footer-col h4 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.footer-col ul li {
    margin-bottom: 0.5rem;
}

.footer-col a {
    color: #9ca3af;
    font-size: 0.9rem;
}

.footer-col a:hover {
    color: #fff;
}

.footer-contact {
    font-style: normal;
    line-height: 1.8;
}

.footer-contact a {
    color: #d1d5db;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.footer-logo {
    font-size: 1.125rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 1rem;
    display: block;
}

.footer-logo span {
    color: var(--color-accent);
}

/* ==========================================================================
   404 Page
   ========================================================================== */
.error-404 {
    text-align: center;
    padding: var(--space-2xl) 0;
}

.error-404 h1 {
    font-size: 6rem;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 968px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .project-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .primary-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--color-dark);
        flex-direction: column;
        padding: 1.5rem;
        gap: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .primary-nav.open {
        display: flex;
    }

    .primary-nav a {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .menu-toggle {
        display: block;
    }

    .header-actions .btn {
        display: none;
    }

    .hero {
        min-height: 480px;
    }

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

    .footer-bottom {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .section {
        padding-top: var(--space-lg);
        padding-bottom: var(--space-lg);
    }
}

/* ==========================================================================
   WordPress Core
   ========================================================================== */
.alignleft {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
}

.alignright {
    float: right;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.875rem;
    color: var(--color-text-light);
    text-align: center;
    margin-top: 0.5rem;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}
