/* ============================================
   PERAC EDU - Main Stylesheet
   Custom design tokens layered on top of Tailwind
   ============================================ */

:root {
    --brand-50: #EEF2FF;
    --brand-100: #E0E7FF;
    --brand-500: #6366F1;
    --brand-600: #4F46E5;
    --brand-700: #4338CA;
    --accent-400: #22D3EE;
    --accent-500: #06B6D4;
    --violet-500: #8B5CF6;
    --gradient-brand: linear-gradient(135deg, #06B6D4 0%, #4F46E5 50%, #8B5CF6 100%);
    --gradient-brand-soft: linear-gradient(135deg, #E0F2FE 0%, #EEF2FF 50%, #F5F3FF 100%);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ============================================
   Nav Links
   ============================================ */
.nav-link {
    position: relative;
    color: #334155;
    font-weight: 500;
    font-size: 0.875rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    transition: color 0.2s;
}
.nav-link:hover { color: #4F46E5; }
.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background: var(--gradient-brand);
    transition: width 0.3s;
}
.nav-link:hover::after { width: 100%; }
.nav-link-active {
    color: #4F46E5;
    font-weight: 600;
}
.nav-link-active::after { width: 100%; }

.mobile-nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #334155;
    font-weight: 500;
    border-radius: 0.5rem;
}
.mobile-nav-link:hover { background: #F8FAFC; }
.mobile-nav-active { background: #EEF2FF; color: #4338CA; }

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-brand);
    color: white;
    font-weight: 600;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.25);
    transition: all 0.2s;
    font-size: 0.875rem;
    text-decoration: none;
}
.btn-primary:hover {
    box-shadow: 0 20px 35px -5px rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #1E293B;
    font-weight: 600;
    border-radius: 0.75rem;
    border: 1px solid #CBD5E1;
    transition: all 0.2s;
    font-size: 0.875rem;
    text-decoration: none;
}
.btn-secondary:hover {
    border-color: #818CF8;
    color: #4F46E5;
    transform: translateY(-2px);
}

/* ============================================
   Course Cards (homepage)
   ============================================ */
.course-card {
    position: relative;
    display: block;
    padding: 1.75rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    transition: all 0.3s;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}
.course-card:hover {
    border-color: transparent;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}
.course-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-brand-soft);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
}
.course-card:hover::before { opacity: 1; }
.course-card > * { position: relative; z-index: 1; }

.course-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    transition: transform 0.3s;
}
.course-card:hover .course-icon { transform: scale(1.1); }
.course-title {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #0F172A;
    margin-bottom: 0.5rem;
}
.course-desc {
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.course-link {
    color: #4F46E5;
    font-size: 0.875rem;
    font-weight: 600;
    transition: transform 0.2s;
    display: inline-block;
}
.course-card:hover .course-link { transform: translateX(4px); }

/* ============================================
   Course Detail Cards (courses.html)
   ============================================ */
.course-detail-card {
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}
.course-detail-card:hover {
    border-color: #A5B4FC;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.course-detail-level {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4F46E5;
    background: #EEF2FF;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}
.course-detail-title {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    color: #0F172A;
    margin-bottom: 0.5rem;
}
.course-detail-desc {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.course-detail-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748B;
    padding-top: 0.75rem;
    border-top: 1px solid #F1F5F9;
}
.course-detail-meta span:first-child { font-weight: 600; color: #334155; }
.course-detail-meta span:last-child { font-weight: 700; color: #4F46E5; }

/* ============================================
   Journey Cards
   ============================================ */
.journey-card {
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}
.journey-card:hover {
    border-color: #A5B4FC;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.journey-age {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0891B2;
    background: rgba(34, 211, 238, 0.1);
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}
.journey-title {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #0F172A;
    margin-bottom: 0.5rem;
}
.journey-desc {
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.journey-tag {
    font-size: 0.75rem;
    color: #64748B;
    padding-top: 0.75rem;
    border-top: 1px solid #F1F5F9;
}

/* ============================================
   Testimonial Cards
   ============================================ */
.testimonial-card {
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}
.testimonial-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Value Cards (about)
   ============================================ */
.value-card {
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}
.value-card:hover {
    border-color: #A5B4FC;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.value-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.value-title {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #0F172A;
    margin-bottom: 0.75rem;
}
.value-desc {
    color: #475569;
    line-height: 1.6;
}

/* ============================================
   Timeline (about)
   ============================================ */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 2rem;
    border-left: 2px solid #E2E8F0;
}
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -0.5rem;
    top: 0;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #E2E8F0;
}
.timeline-year {
    position: absolute;
    left: -3rem;
    top: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #64748B;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}
.timeline-content {
    margin-left: 1rem;
    padding: 1.25rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #E2E8F0;
}
.timeline-title {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    color: #0F172A;
    margin-bottom: 0.25rem;
}
.timeline-desc {
    font-size: 0.875rem;
    color: #475569;
}
.timeline-item-current::before { background: var(--gradient-brand); }
.timeline-item-current .timeline-content {
    border-color: #C7D2FE;
    background: rgba(238, 242, 255, 0.3);
}

/* ============================================
   Business Line Cards
   ============================================ */
.business-line-card {
    padding: 1.75rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}
.business-line-card:hover {
    border-color: #A5B4FC;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.business-line-num {
    font-size: 3rem;
    font-weight: 900;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
    line-height: 1;
}
.business-line-title {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #0F172A;
    margin-bottom: 0.5rem;
}
.business-line-desc {
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}
.business-line-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4338CA;
    background: #EEF2FF;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

/* ============================================
   Tutor Cards
   ============================================ */
.tutor-card {
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    border: 1px solid #E2E8F0;
    text-align: center;
    transition: all 0.2s;
}
.tutor-card:hover {
    border-color: #A5B4FC;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.tutor-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}
.tutor-name {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    color: #0F172A;
}
.tutor-title {
    font-size: 0.875rem;
    color: #4F46E5;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.tutor-bg {
    font-size: 0.75rem;
    color: #64748B;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.tutor-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
}
.tutor-tags span {
    font-size: 0.75rem;
    background: #F1F5F9;
    color: #334155;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

/* ============================================
   Filter Pills
   ============================================ */
.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #E2E8F0;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.filter-pill:hover {
    border-color: #818CF8;
    color: #4F46E5;
}

.tutor-filter {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #E2E8F0;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
}
.tutor-filter:hover {
    border-color: #818CF8;
    color: #4F46E5;
}
.tutor-filter.active {
    background: var(--gradient-brand);
    color: white;
    border-color: transparent;
}

/* ============================================
   Forms
   ============================================ */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}
.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    background: white;
    border: 1px solid #CBD5E1;
    border-radius: 0.5rem;
    color: #1E293B;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 1rem;
}
.form-input::placeholder { color: #94A3B8; }
.form-input:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}
textarea.form-input { resize: vertical; }

/* ============================================
   FAQ
   ============================================ */
.faq-item {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #E2E8F0;
    overflow: hidden;
}
.faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    cursor: pointer;
    font-weight: 600;
    color: #0F172A;
    list-style: none;
    transition: background 0.2s;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q:hover { background: #F8FAFC; }
.faq-icon {
    font-size: 1.5rem;
    color: #4F46E5;
    font-weight: 300;
    transition: transform 0.2s;
}
.faq-item[open] .faq-icon { transform: rotate(45deg); }
.faq-a {
    padding: 0 1.25rem 1.25rem;
    color: #475569;
    line-height: 1.6;
}

/* ============================================
   Scroll Reveal Animation
   ============================================ */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Focus States (a11y)
   ============================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid #6366F1;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================
   Print
   ============================================ */
@media print {
    header, footer, .btn-primary, .btn-secondary { display: none !important; }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
