/* ==========================================================================
   DreamTech 4U — Bangladesh Smart Tools
   Global stylesheet: tokens, base, layout, header, footer, hero, utilities.
   Theme is controlled by the data-theme attribute on <html>.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    --font: "Hind Siliguri", "Noto Sans Bengali", "Nirmala UI", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --text: #0f172a;
    --muted: #475569;
    --border: #e2e8f0;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-contrast: #ffffff;
    --primary-soft: #eff6ff;
    --link: #1d4ed8;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08);

    --header-h: 64px;
    --container: 1120px;
    --gutter: 1rem;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0b1220;
    --surface: #111a2e;
    --surface-2: #17223a;
    --text: #e6edf8;
    --muted: #a3b1c6;
    --border: #243452;

    --primary: #2563eb;
    --primary-hover: #3b82f6;
    --primary-soft: #14213d;
    --link: #7db3ff;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);

    color-scheme: dark;
}

/* ---------- 2. Base / reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; }
main:focus { outline: none; }

img, svg { max-width: 100%; height: auto; }
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 4.5vw + .5rem, 2.9rem); }
h2 { font-size: clamp(1.35rem, 2.5vw + .5rem, 1.85rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1rem; }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

ul, ol { margin: 0; padding: 0; }
ul[class], ol[class] { list-style: none; }

[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------- 3. Utilities ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 200;
    padding: .6rem 1rem;
    background: var(--primary);
    color: var(--primary-contrast);
    border-radius: var(--radius-sm);
    text-decoration: none;
}
.skip-link:focus { top: .75rem; }

/* ---------- 4. Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 44px;
    padding: .6rem 1.25rem;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--surface-2); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-expanded="true"] { background: var(--primary-soft); color: var(--link); }

/* ---------- 5. Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    min-height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--text);
    text-decoration: none;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 11px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { font-size: .72rem; color: var(--muted); }

.main-nav ul { display: flex; flex-wrap: wrap; gap: .25rem; }
.main-nav a {
    display: block;
    padding: .5rem .9rem;
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-sm);
}
.main-nav a:hover { background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--link); background: var(--primary-soft); }

.header-actions { display: flex; align-items: center; gap: .15rem; margin-left: auto; }

/* Theme toggle: show moon in light mode, sun in dark mode */
.theme-icon-light, .theme-icon-dark { display: none; line-height: 0; }
[data-theme="light"] .theme-icon-dark { display: inline-flex; }
[data-theme="dark"]  .theme-icon-light { display: inline-flex; }

/* Without JavaScript: hide controls that need it */
.no-js .nav-toggle,
.no-js .search-toggle,
.no-js [data-search-toggle],
.no-js [data-theme-toggle] { display: none; }

.nav-toggle { display: none; }
.js .nav-toggle { display: inline-flex; }

.search-panel {
    padding: .75rem 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* ---------- 6. Search form ---------- */
.search-form { display: flex; gap: .5rem; width: 100%; }
.search-form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    padding: .6rem 1rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    -webkit-appearance: none;
    appearance: none;
}
.search-form input[type="search"]::placeholder { color: var(--muted); opacity: 1; }
.search-form input[type="search"]:focus { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
.search-form .btn { min-height: 48px; }

/* ---------- 7. Hero ---------- */
.hero {
    padding: clamp(2.5rem, 7vw, 5rem) 0;
    text-align: center;
    background:
        radial-gradient(ellipse at 20% 0%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 55%),
        radial-gradient(ellipse at 90% 10%, color-mix(in srgb, #7c3aed 14%, transparent), transparent 50%),
        var(--bg);
    border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: 760px; }
.hero h1 { margin-bottom: .75rem; }
.hero-sub { font-size: clamp(1rem, 1.2vw + .75rem, 1.2rem); color: var(--muted); margin-bottom: 1.75rem; }
.hero-search {
    max-width: 620px;
    margin-inline: auto;
    padding: .4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius-sm) + 6px);
    box-shadow: var(--shadow);
}
.hero-search input[type="search"] { border: 0; background: transparent; }
.hero-search input[type="search"]:focus { outline: none; }
.hero-search:focus-within { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }

/* ---------- 8. Sections, chips ---------- */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section-title { margin-bottom: 1.25rem; }

.chip-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 44px;
    padding: .45rem 1rem;
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, background-color .15s ease;
}
.chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.chip-en { font-size: .8rem; color: var(--muted); }

/* ---------- 9. Footer ---------- */
.site-footer {
    margin-top: 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding-block: 2.25rem;
}
.footer-tagline { margin: .75rem 0 1rem; color: var(--muted); }

.social-list { display: flex; gap: .5rem; }
.social-link {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--text);
    background: var(--surface-2);
    border-radius: 50%;
    text-decoration: none;
}
a.social-link:hover { background: var(--primary); color: #fff; }
.social-link.is-placeholder { opacity: .45; cursor: default; }

.footer-nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.footer-nav a { display: inline-block; padding: .35rem 0; color: var(--text); text-decoration: none; }
.footer-nav a:hover { color: var(--link); text-decoration: underline; }

.footer-bottom {
    padding: 1rem 0;
    font-size: .9rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}
.footer-bottom p { margin: 0; }

/* ---------- 10. Responsive ---------- */
/* Mobile / tablet: nav becomes a dropdown (only when JS is available) */
@media (max-width: 819.98px) {
    .js .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: .5rem var(--gutter) 1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .js .main-nav.is-open { display: block; }
    .js .main-nav ul { flex-direction: column; }
    .js .main-nav a { padding: .8rem .9rem; }
    .no-js .main-nav { order: 3; width: 100%; padding-bottom: .5rem; }
}

@media (min-width: 820px) {
    :root { --gutter: 1.5rem; }
    .js .nav-toggle { display: none; }
    .main-nav { margin-left: auto; }
    .header-actions { margin-left: 0; }
    .footer-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
    .footer-nav ul { justify-content: flex-end; }
}

@media (max-width: 479.98px) {
    .brand-text small { display: none; }
    .search-form .btn { padding-inline: 1rem; }
}

/* ---------- 11. Accessibility / motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (prefers-contrast: more) {
    :root { --border: #64748b; }
}

@media print {
    .site-header, .site-footer, .skip-link, .hero-search { display: none !important; }
    body { background: #fff; color: #000; }
    a { color: #000; text-decoration: underline; }
}
