/* ========================================================
   Neo-Brutalism Design System (Zero PX Policy)
   ======================================================== */

/* 1. Light Theme Variables (ค่าเริ่มต้น) */
:root {
    --neo-dark: #18181b;
    --neo-light: #f4f4f5;
    --neo-white: #ffffff;
    --neo-yellow: #fde047;
    --neo-stroke: #18181b;
    
    /* Neo-Brutalism Shadows & Borders */
    --border-thick: 0.125rem;
    --shadow-solid: 0.25rem 0.25rem 0 var(--neo-stroke);
    --shadow-solid-sm: 0.125rem 0.125rem 0 var(--neo-stroke);
    
    --radius-pill: 3rem;
    --radius-card: 1rem;
    
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;

    /* Fluid Typography */
    --font-base: clamp(1rem, 1.2vw, 1.125rem);
    --font-h1: clamp(2rem, 4vw, 3.25rem);
    --font-h2: clamp(1.5rem, 2.5vw, 2rem);
}

/* 2. Dark Theme Variables (เมื่อเปิดโหมดมืด) */
:root[data-theme="dark"] {
    --neo-dark: #f4f4f5;
    --neo-light: #18181b;
    --neo-white: #27272a;
    --neo-stroke: #000000;
    --neo-yellow: #ca8a04;
}

/* 3. Theme Transitions (ทำให้การเปลี่ยนสีสมูท ไม่กระตุก) */
body, .neo-header, .neo-hero, .neo-tool-card, .neo-footer, .search-box-wrapper input, .neo-privacy-card {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.15s ease;
}

/* ========================================================
   Resets & Base Styles
   ======================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: var(--font-base);
    color: var(--neo-dark);
    background-color: var(--neo-light);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
.visually-hidden { position: absolute; width: 0.0625rem; height: 0.0625rem; overflow: hidden; clip: rect(0,0,0,0); }

/* Skip Link for Accessibility (SEO) */
.skip-link { position: absolute; top: -3rem; left: 1rem; background: var(--neo-yellow); color: var(--neo-dark); padding: 0.5rem 1rem; z-index: 1000; border: var(--border-thick) solid var(--neo-stroke); font-weight: 700; transition: top 0.2s; }
.skip-link:focus { top: 1rem; }
.container { width: 100%; max-width: 80rem; margin: 0 auto; padding: 0 var(--space-sm); }

/* ========================================================
   Components
   ======================================================== */

/* Header */
.neo-header { background: var(--neo-white); border-bottom: var(--border-thick) solid var(--neo-stroke); position: sticky; top: 0; z-index: 100; }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 5rem; }
.brand-logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; font-size: 1.5rem; letter-spacing: -0.05em; }
.logo-icon { font-size: 1.75rem; padding: 0.25rem 0.5rem; border: var(--border-thick) solid var(--neo-stroke); border-radius: 0.5rem; background: var(--neo-yellow); box-shadow: var(--shadow-solid-sm); }
.brand-logo span { color: #0284c7; }

/* Buttons */
.neo-btn {
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.625rem 1.25rem;
    border: var(--border-thick) solid var(--neo-stroke);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-solid-sm);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}
.neo-btn:active { transform: translate(0.125rem, 0.125rem); box-shadow: 0 0 0 var(--neo-stroke); }
.btn-yellow { background-color: var(--neo-yellow); color: var(--neo-dark); }

/* Icon Button (สำหรับปุ่ม Dark Mode) */
.btn-icon {
    background-color: var(--neo-white);
    color: var(--neo-dark);
    padding: 0.5rem;
    font-size: 1.25rem;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero Section */
.neo-hero { background: var(--neo-white); border-bottom: var(--border-thick) solid var(--neo-stroke); padding: var(--space-lg) 0; }
.hero-grid { display: grid; gap: var(--space-md); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 64rem) { .hero-grid { grid-template-columns: 3fr 2fr; gap: var(--space-lg); } }

.eyebrow-badge { display: inline-block; background: #d9f99d; border: var(--border-thick) solid var(--neo-stroke); padding: 0.25rem 0.75rem; border-radius: var(--radius-pill); font-weight: 700; font-size: 0.85rem; margin-bottom: var(--space-sm); box-shadow: var(--shadow-solid-sm); color: #18181b; }
.hero-content h1 { font-size: var(--font-h1); line-height: 1.1; margin-bottom: var(--space-sm); font-weight: 800; }
.hero-copy { font-size: 1.125rem; color: #52525b; margin-bottom: var(--space-md); max-width: 35rem; }

/* Search Box */
.search-box-wrapper input {
    width: 100%;
    max-width: 35rem;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    font-family: inherit;
    border: var(--border-thick) solid var(--neo-stroke);
    border-radius: var(--radius-pill);
    outline: none;
    box-shadow: var(--shadow-solid);
    background: var(--neo-white);
    color: var(--neo-dark);
    transition: transform 0.1s;
}
.search-box-wrapper input:focus { transform: translate(-0.125rem, -0.125rem); box-shadow: 0.375rem 0.375rem 0 var(--neo-stroke); }

/* Privacy Card */
.neo-privacy-card { background: #e0f2fe; border: var(--border-thick) solid var(--neo-stroke); border-radius: var(--radius-card); padding: var(--space-sm); box-shadow: var(--shadow-solid); color: #18181b; }
.privacy-icon { font-size: 2.25rem; margin-bottom: 0.5rem; }
.neo-privacy-card h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.25rem; }
.neo-privacy-card p { font-size: 0.95rem; }

/* Tools Directory Grid */
.tools-section { padding: var(--space-lg) 0; }
.section-heading { text-align: center; margin-bottom: var(--space-md); }
.section-heading h2 { font-size: var(--font-h2); font-weight: 800; }
.section-heading p { color: #52525b; }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: var(--space-sm);
}

.neo-tool-card {
    background: var(--neo-white);
    border: var(--border-thick) solid var(--neo-stroke);
    border-radius: var(--radius-card);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-solid);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}
.neo-tool-card:hover {
    transform: translate(-0.25rem, -0.25rem);
    box-shadow: 0.5rem 0.5rem 0 var(--neo-stroke);
}

/* Tags */
.tool-tag { display: inline-block; padding: 0.2rem 0.6rem; border: var(--border-thick) solid var(--neo-stroke); border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; width: fit-content; margin-bottom: 0.5rem; color: #18181b; }
.tag-text { background: #ddd6fe; }
.tag-health { background: #a7f3d0; }
.tag-random { background: #fde047; }
.tag-time { background: #fbcfe8; }

.neo-tool-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; font-weight: 800; }
.neo-tool-card h3 a::after { content: ''; position: absolute; inset: 0; }
.neo-tool-card p { color: #52525b; font-size: 0.95rem; flex-grow: 1; margin-bottom: var(--space-sm); }
.card-link { font-weight: 700; color: #0284c7; display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* Utilities */
.hidden { display: none !important; }
.no-result { text-align: center; padding: var(--space-lg); font-size: 1.25rem; font-weight: 700; color: #71717a; }

/* Ad Slot (พื้นที่โฆษณา) */
.neo-ad-slot { background: var(--neo-white); border: var(--border-thick) dashed var(--neo-stroke); border-radius: var(--radius-card); min-height: 5.625rem; display: flex; align-items: center; justify-content: center; color: var(--neo-dark); font-weight: 700; font-size: 0.875rem; box-shadow: var(--shadow-solid-sm); }

/* Footer */
.neo-footer { background: var(--neo-white); border-top: var(--border-thick) solid var(--neo-stroke); padding: var(--space-md) 0; margin-top: auto; }
.footer-content { display: flex; flex-direction: column; gap: 1rem; text-align: center; font-weight: 600; }
@media (min-width: 48rem) { .footer-content { flex-direction: row; justify-content: space-between; text-align: left; } }
.footer-links { display: flex; gap: var(--space-sm); justify-content: center; color: #52525b; }
