:root {
    --bg-color: #f7f3ea;
    --panel-bg: #fffdf8;
    --text-color: #1a1712;
    --muted: #5e574c;
    --gold: #b39359;
    --gold-hover: #8a6f3f;
    --gold-bright: #8a6f3f;
    --danger: #c45c5c;
    --success: #3d9b6e;
    --line: rgba(26, 23, 18, 0.10);
    --font: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

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

body.hub-body,
body {
    font-family: var(--font);
    background:
        radial-gradient(ellipse 80% 45% at 100% 0%, rgba(179, 147, 89, 0.16), transparent 55%),
        radial-gradient(ellipse 55% 40% at 0% 100%, rgba(56, 184, 181, 0.08), transparent 50%),
        var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.65;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    top: -100px;
    right: 1rem;
    z-index: 10000;
    background: var(--gold);
    color: #1a140c;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: transparent;
    border-bottom: 0;
}

.hub-nav { display: flex; gap: 0.55rem; flex-wrap: wrap; }

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.02em;
}
.logo-text { color: var(--muted); font-weight: 500; }

.btn-home {
    background: transparent;
    border: 1px solid rgba(179, 147, 89, 0.45);
    color: var(--gold);
    padding: 0.45rem 0.95rem;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    font-size: 0.92rem;
    font-weight: 600;
}
.btn-home:hover {
    background: var(--gold);
    color: #1a140c;
    border-color: var(--gold);
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
}

.hub-hero {
    text-align: center;
    margin: 0.5rem auto 2.5rem;
    max-width: 640px;
}
.hub-kicker {
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 0 0 0.6rem;
}
.hub-lead,
.hub-hero p,
.tool-desc {
    color: var(--muted);
    line-height: 1.7;
    margin: 0.75rem 0 0;
}

.hub-search-label {
    display: block;
    margin-top: 1.25rem;
}

.hub-search {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: block;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hub-search::placeholder { color: #8a8276; }
.hub-search:focus {
    border-color: rgba(179, 147, 89, 0.65);
    box-shadow: 0 0 0 3px rgba(179, 147, 89, 0.16);
}

.hub-results {
    margin: 0.95rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.hub-hero .hub-quick-panel {
    margin-top: 1.25rem;
}

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

.hub-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    margin-bottom: 0.65rem;
}

.hub-badge-local {
    color: #2f6f4e;
    border: 1px solid rgba(61, 155, 110, 0.35);
    background: rgba(61, 155, 110, 0.10);
}

.hub-badge-cloud {
    color: var(--gold);
    border: 1px solid rgba(179, 147, 89, 0.4);
    background: rgba(179, 147, 89, 0.1);
}

.hub-empty {
    text-align: center;
    padding: 2.5rem 1.25rem;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: rgba(255, 253, 248, 0.7);
    margin: 0.5rem 0 2rem;
}

.hub-empty-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
}

.hub-empty-desc {
    margin: 0.55rem 0 1.1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.hub-empty-reset {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    border: 1px solid rgba(179, 147, 89, 0.45);
    background: transparent;
    color: var(--gold);
}

.hub-empty-reset:hover {
    background: var(--gold);
    color: #1a140c;
    border-color: var(--gold);
}

.ext-tool-card[hidden] { display: none !important; }
section[hidden] { display: none !important; }

.page-title-main {
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--text-color);
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.section-title {
    color: var(--gold);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2.5rem 0 1.1rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line);
}

.section-desc {
    text-align: center;
    color: var(--muted);
    margin: -0.4rem 0 1.4rem;
    font-size: 0.98rem;
    line-height: 1.65;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem;
}
.tools-grid-ext { margin-bottom: 0.5rem; }

.ext-tool-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    background: var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.4rem 1.3rem;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    text-decoration: none;
    color: inherit;
    min-height: 148px;
    position: relative;
    box-shadow: 0 8px 24px rgba(26, 23, 18, 0.04);
}
.ext-tool-card:hover {
    transform: translateY(-3px);
    border-color: rgba(179, 147, 89, 0.5);
    box-shadow: 0 14px 32px rgba(26, 23, 18, 0.08);
}

.ext-tool-mark {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.08em;
    margin-bottom: 0.85rem;
    opacity: 0.9;
}

.ext-tool-title {
    font-size: 1.05rem;
    color: var(--text-color);
    font-weight: 700;
    line-height: 1.35;
}

.hub-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--gold);
    border: 1px solid rgba(179, 147, 89, 0.35);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.55rem;
    letter-spacing: 0.06em;
}

.hub-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1.1rem;
}

.hub-filter-btn {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    border: 1px solid rgba(179, 147, 89, 0.4);
    background: transparent;
    color: var(--gold);
}

.hub-filter-btn.is-active {
    background: var(--gold);
    color: #1a140c;
    border-color: transparent;
}

.hub-lead a { color: var(--gold-bright); }

.tool-card {
    background: var(--panel-bg);
    border: 1px solid rgba(179, 147, 89, 0.25);
    border-radius: 14px;
    padding: 1.5rem;
}

.calc-result-label { color: var(--muted); font-size: 0.9em; }
h1 { color: var(--text-color); text-align: center; font-size: 2.5em; margin-bottom: 10px; }
.calc-group { margin-bottom: 15px; }
.calc-group label { display: block; font-size: 0.95em; color: var(--muted); margin-bottom: 8px; }
.calc-group input {
    width: 100%; padding: 12px; background: #fff;
    border: 1px solid var(--line); border-radius: 8px; color: var(--text-color); box-sizing: border-box; outline: none; font-size: 1.1em;
}
.calc-group input:focus { border-color: var(--gold); }
.calc-btn {
    width: 100%; padding: 12px; background: var(--gold); color: #1a140c;
    border: none; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.3s; margin-top: 15px; font-size: 1.1em;
}
.calc-btn:hover { background: var(--gold-hover); }
.calc-result {
    margin-top: 20px; padding: 15px; background: rgba(179, 147, 89, 0.1);
    border-radius: 8px; border: 1px solid rgba(179, 147, 89, 0.3); display: none; text-align: center;
}
.calc-result span { display: block; font-size: 1.8em; font-weight: bold; color: var(--success); margin-top: 5px; }
.danger-text { color: var(--danger) !important; }

@media (max-width: 640px) {
    .hub-header { padding: 0.9rem 1rem; }
    .page-title-main { font-size: 1.75rem; }
}
