/*
Theme Name: Khane
Theme URI: https://khane.com
Author: Khane
Author URI: https://khane.com
Description: راهنمای تخصصی املاک و سرمایه‌گذاری در آمریکا برای فارسی‌زبانان
Version: 1.0.0
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: khane
Tags: rtl-language, custom-menu, custom-logo, featured-images, translation-ready
*/

/* =============================================
   CSS VARIABLES
   ============================================= */
:root {
    --navy:       #1B2A4A;
    --navy-dark:  #0F1C2E;
    --gold:       #C9A84C;
    --gold-light: #e0c070;
    --light:      #F5F5F5;
    --dark:       #1a1a1a;
    --text-muted: #9aabbf;
    --white:      #ffffff;
    --border:     rgba(201, 168, 76, 0.2);
    --shadow:     0 4px 24px rgba(0, 0, 0, 0.12);
    --radius:     8px;
    --radius-lg:  16px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    direction: rtl;
    text-align: right;
    background-color: var(--white);
    color: var(--dark);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

a:hover {
    color: var(--gold-light);
}

ul {
    list-style: none;
}

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--navy);
    margin-bottom: 0.75em;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.7rem); }
h4 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1.25em;
    font-size: 1rem;
    color: #444;
}

/* =============================================
   LAYOUT WRAPPERS
   ============================================= */
.khane-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    min-height: 60vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn-gold {
    display: inline-block;
    background-color: var(--gold);
    color: var(--navy-dark);
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 12px 28px;
    border-radius: 50px;
    border: 2px solid var(--gold);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    white-space: nowrap;
}

.btn-gold:hover,
.btn-gold:focus {
    background-color: transparent;
    color: var(--gold);
    outline: none;
}

.btn-outline {
    display: inline-block;
    background-color: transparent;
    color: var(--gold);
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 12px 28px;
    border-radius: 50px;
    border: 2px solid var(--gold);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-outline:hover {
    background-color: var(--gold);
    color: var(--navy-dark);
}

/* =============================================
   SECTION STYLES
   ============================================= */
.section-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 12px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--gold);
    margin-top: 12px;
    margin-right: 0;
    border-radius: 2px;
}

.section-subtitle {
    font-size: 1.05rem;
    color: #666;
    margin-bottom: 40px;
    max-width: 600px;
}

.section-header {
    margin-bottom: 48px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.06);
    /* Prevent stacking context issues on mobile */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Hover lift only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    }
}

.card-body {
    padding: 24px;
}

/* =============================================
   ENTRY CONTENT (WP blocks)
   ============================================= */
.entry-content p { margin-bottom: 1.4em; }
.entry-content ul, .entry-content ol { margin: 1em 0 1.4em 0; padding-right: 1.5em; }
.entry-content li { margin-bottom: 0.5em; }
.entry-content blockquote {
    border-right: 4px solid var(--gold);
    padding: 16px 20px;
    margin: 24px 0;
    background: rgba(201,168,76,0.06);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: #555;
}
.entry-content h2,
.entry-content h3,
.entry-content h4 {
    margin-top: 2em;
}

/* =============================================
   PAGE HERO
   ============================================= */
.page-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #243b6e 100%);
    padding: 80px 20px;
    text-align: center;
    color: var(--white);
}

.page-hero h1 {
    color: var(--white);
    margin-bottom: 12px;
}

.page-hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* =============================================
   BREADCRUMBS
   ============================================= */
.breadcrumbs {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 12px 0;
    margin-bottom: 32px;
}

.breadcrumbs a { color: var(--gold); }
.breadcrumbs span { margin: 0 6px; }

/* =============================================
   FORMS
   Scoped to avoid overriding embedded page styles
   (e.g. mortgage calculator, custom components)
   ============================================= */
.entry-content input,
.entry-content textarea,
.entry-content select,
.khane-main input,
.khane-main textarea,
.khane-main select,
.contact-form input,
.contact-form textarea,
.contact-form select {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    direction: rtl;
    text-align: right;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--white);
    transition: var(--transition);
    outline: none;
}

.entry-content input:focus,
.entry-content textarea:focus,
.entry-content select:focus,
.khane-main input:focus,
.khane-main textarea:focus,
.khane-main select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy);
    display: block;
    margin-bottom: 6px;
}

/* =============================================
   UTILITIES
   ============================================= */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-gold   { color: var(--gold); }
.text-navy   { color: var(--navy); }
.text-muted  { color: #888; }
.bg-navy     { background-color: var(--navy); }
.bg-light    { background-color: var(--light); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.py-section { padding: 80px 0; }

/* =============================================
   SCREEN READER
   ============================================= */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* =============================================
   SKIP LINK
   ============================================= */
.skip-link {
    position: absolute;
    top: -100%;
    right: 0;
    background: var(--gold);
    color: var(--navy-dark);
    padding: 8px 16px;
    font-weight: 700;
    z-index: 9999;
    transition: top 0.2s;
}

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

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .khane-main { padding: 40px 16px; }
    .py-section  { padding: 60px 0; }
    .section-title::after { margin-right: auto; margin-left: auto; }
    .page-hero { padding: 60px 16px; }

    /* Ensure calculator inputs are tappable on mobile */
    .calculator-container {
        -webkit-transform: none;
        transform: none;
    }
    .calc-card, .calc-inputs, .input-wrapper {
        -webkit-transform: none;
        transform: none;
        pointer-events: auto;
        touch-action: manipulation;
    }
    .input-wrapper input,
    .input-wrapper select {
        pointer-events: auto !important;
        touch-action: manipulation;
        -webkit-user-select: text;
        user-select: text;
        font-size: 16px; /* Prevents iOS auto-zoom on focus */
    }
    .radio-pill label {
        min-height: 44px; /* Apple HIG minimum touch target */
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    .calc-btn-primary {
        min-height: 52px;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    html { font-size: 15px; }
    .btn-gold, .btn-outline { padding: 10px 22px; font-size: 0.9rem; }
}
