/*
Theme Name: Erim Courses
Theme URI: https://erimkaramenderes.com
Author: Erim Karamenderes
Author URI: https://erimkaramenderes.com
Description: A lead-generation focused block theme for musicians selling online instrument courses (Saxophone, Piano, Flute and more). Includes course post type, inquiry forms, sticky WhatsApp CTA, and bilingual support (EN/TR).
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 7.4
Version: 1.1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: erim-courses
Tags: block-theme, full-site-editing, education, music, one-column, two-columns, custom-colors, custom-menu, custom-logo, editor-style, featured-images, rtl-language-support, translation-ready
*/

/* -------------------------------------------------------------------------
   Almost everything is handled in theme.json. This file holds only the
   pieces that the block editor cannot express cleanly: the floating
   WhatsApp button, the language switcher, micro-interactions, and a few
   accessibility helpers.
   ------------------------------------------------------------------------- */

/* ---------- Smooth scroll for in-page anchors (e.g. View Courses) ---------- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

/* ---------- Focus styles for accessibility ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--wp--preset--color--accent, #b8682c);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ---------- Floating WhatsApp button ---------- */
.erim-whatsapp-float {
    position: fixed;
    right: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1rem, 3vw, 2rem);
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4), 0 2px 6px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.erim-whatsapp-float:hover,
.erim-whatsapp-float:focus-visible {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 28px rgba(37, 211, 102, 0.5), 0 4px 8px rgba(0, 0, 0, 0.12);
    color: #ffffff;
}

.erim-whatsapp-float svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.erim-whatsapp-float .erim-whatsapp-label {
    position: absolute;
    right: 70px;
    background: #1a1612;
    color: #fdf9f3;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.erim-whatsapp-float:hover .erim-whatsapp-label,
.erim-whatsapp-float:focus-visible .erim-whatsapp-label {
    opacity: 1;
}

/* Pulse animation to draw attention */
.erim-whatsapp-float::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #25d366;
    z-index: -1;
    animation: erim-pulse 2.4s ease-out infinite;
}

@keyframes erim-pulse {
    0%   { transform: scale(1);   opacity: 0.6; }
    80%  { transform: scale(1.6); opacity: 0;   }
    100% { transform: scale(1.6); opacity: 0;   }
}

@media (prefers-reduced-motion: reduce) {
    .erim-whatsapp-float::before { animation: none; }
    html { scroll-behavior: auto; }
}

/* ---------- Language switcher (works with Polylang's wp_nav_menu) ---------- */
.erim-lang-switcher {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.erim-lang-switcher li { display: inline-block; }

.erim-lang-switcher a {
    color: var(--wp--preset--color--ink, #1a1612);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 2px;
    transition: color 180ms ease, border-color 180ms ease;
}

.erim-lang-switcher a:hover,
.erim-lang-switcher .current-lang a,
.erim-lang-switcher .current-menu-item a {
    color: var(--wp--preset--color--accent, #b8682c);
    border-color: var(--wp--preset--color--accent, #b8682c);
}

/* ---------- Course card subtle lift ---------- */
.erim-course-card {
    transition: transform 280ms ease, box-shadow 280ms ease;
}
.erim-course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px -18px rgba(26, 22, 18, 0.25);
}

/* ---------- Heading flourish: underline accent on hero ---------- */
.erim-hero-title .has-accent-color {
    position: relative;
    display: inline-block;
}
.erim-hero-title .has-accent-color::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.1em;
    height: 0.18em;
    background: var(--wp--preset--color--accent, #b8682c);
    opacity: 0.25;
    z-index: -1;
    border-radius: 2px;
}

/* ---------- Form polish (works with native Form block) ---------- */
.wp-block-form input[type="text"],
.wp-block-form input[type="email"],
.wp-block-form input[type="tel"],
.wp-block-form input[type="url"],
.wp-block-form textarea,
.wp-block-form select {
    width: 100%;
    padding: 0.85rem 1rem;
    font: inherit;
    color: var(--wp--preset--color--ink, #1a1612);
    background: var(--wp--preset--color--card, #fdf9f3);
    border: 1px solid rgba(26, 22, 18, 0.18);
    border-radius: 4px;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.wp-block-form input:focus,
.wp-block-form textarea:focus,
.wp-block-form select:focus {
    border-color: var(--wp--preset--color--accent, #b8682c);
    box-shadow: 0 0 0 3px rgba(184, 104, 44, 0.15);
    outline: none;
}

.wp-block-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.92rem;
}

/* ---------- Skip link (a11y) ---------- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 1rem;
    background: var(--wp--preset--color--ink, #1a1612);
    color: var(--wp--preset--color--cream, #f7f1e8);
    padding: 0.6rem 1rem;
    z-index: 100000;
    text-decoration: none;
}
.skip-link:focus { left: 1rem; }

/* ---------- Mobile tweaks ---------- */
@media (max-width: 600px) {
    .erim-whatsapp-float { width: 54px; height: 54px; }
    .erim-whatsapp-float svg { width: 28px; height: 28px; }
    .erim-whatsapp-float .erim-whatsapp-label { display: none; }
}
