/*
Theme Name: MG-Enjoy
Theme URI: https://example.com/mg-enjoy
Author: MG Enjoy Team
Author URI: https://example.com
Description: A custom WordPress theme with red and white color scheme for MG Enjoy.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.5
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mg-enjoy
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================
   Preload: hide FOUC until Tailwind CDN applies
   ============================================ */
html.mg-preload:not(.mg-ready) body {
    opacity: 0;
    pointer-events: none;
}

html.mg-ready body {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.15s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    html.mg-ready body {
        transition: none;
    }
}

/* ============================================
   Font Family - Apply globally (override Tailwind preflight)
   ============================================ */
html,
body,
h1, h2, h3, h4, h5, h6,
p, div, span, a, button,
input, textarea, select, label {
    font-family: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

/* ============================================
   Container
   ============================================ */
.mg-container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .mg-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .mg-container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* ============================================
   Hero Section Fixes
   ============================================ */
.mg-leading-tight {
    line-height: 1.1;
}

.mg-max-ch {
    max-width: 55ch;
}

/* ============================================
   Button & Link Hover Fixes
   ============================================ */
a:hover,
a:focus,
button:hover,
button:focus {
    text-decoration: none !important;
}

/* Red buttons: keep white text on hover */
a.bg-red-700:hover,
a.bg-red-700:focus,
button.bg-red-700:hover,
button.bg-red-700:focus,
.bg-red-700:hover,
.bg-red-700:focus {
    color: #ffffff !important;
}

/* White buttons with red text: keep red text on hover */
a.bg-white.text-red-700:hover,
a.bg-white.text-red-700:focus,
button.bg-white.text-red-700:hover,
button.bg-white.text-red-700:focus {
    color: #c62828 !important;
}

/* ============================================
   Base WordPress Alignments
   ============================================ */
.alignleft {
    float: left;
    margin-right: 1.5rem;
}

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

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

.alignwide {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* ============================================
   WordPress Blocks
   ============================================ */
.wp-block-image img {
    border-radius: 0.75rem;
}

.wp-block-quote {
    border-left: 4px solid #c62828;
    padding-left: 1.5rem;
    font-style: italic;
}

.wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: #c62828;
    color: #ffffff;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.wp-block-button__link:hover {
    background-color: #8e0000;
    color: #ffffff;
}

/* ============================================
   Screen Reader Text
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   Navigation Fallback
   ============================================ */
#primary-menu,
#mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#primary-menu li,
#mobile-menu-list li {
    margin: 0;
    padding: 0;
}

#primary-menu a,
#mobile-menu-list a {
    text-decoration: none;
    display: inline-block;
}

/* ============================================
   Gallery
   ============================================ */
.gallery {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.gallery-item {
    margin: 0;
}

.gallery-icon img {
    border-radius: 0.5rem;
}

/* ============================================
   Comments Form
   ============================================ */
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="email"]:focus,
.comment-form input[type="url"]:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #c62828;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.comment-form .form-submit input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: #c62828;
    color: #ffffff;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-form .form-submit input[type="submit"]:hover {
    background-color: #8e0000;
}

/* ============================================
   Responsive Embed
   ============================================ */
.wp-embed-responsive .wp-has-aspect-ratio iframe {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
