/* ==========================================================================
   Ghafari v2 — components: buttons, header, navigation, footer, cards, forms, prose.
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0.7rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand-strong); color: #fff; box-shadow: var(--shadow-md); }

.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #072640; color: #fff; }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--hairline); }
.btn--ghost:hover { background: var(--paper); border-color: var(--ink); color: var(--ink); }

.btn--light { background: #fff; color: var(--brand-ink); }
.btn--light:hover { background: var(--brand-soft); color: var(--brand-ink); }

.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.btn--outline-light:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; color: #fff; }

.btn--sm { min-height: 44px; padding: 0.5rem 1.15rem; font-size: var(--text-sm); }

.btn svg { width: 1.1em; height: 1.1em; flex: none; transition: transform 0.2s; }
.btn:hover svg { transform: translateX(3px); }

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    color: var(--brand);
}
.link-arrow svg { width: 1em; height: 1em; transition: transform 0.2s; }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---- Topbar + header ---- */
.topbar {
    display: none;
    background: var(--ink);
    color: #cfe0f1;
    font-size: var(--text-xs);
    font-weight: 600;
}

.topbar a { color: #cfe0f1; }
.topbar a:hover { color: #fff; }

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    gap: var(--s3);
}

.topbar__list {
    display: flex;
    align-items: center;
    gap: var(--s3);
    list-style: none;
}

.topbar__list a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 40px;
}

.topbar__item { display: inline-flex; align-items: center; gap: 0.5rem; }
.topbar svg { width: 14px; height: 14px; opacity: 0.8; flex: none; }

@media (min-width: 1024px) {
    .topbar { display: block; }
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    transition: box-shadow 0.25s;
}

/* The blur makes the header a containing block for `position: fixed`, which would trap the phone menu inside it: desktop only. */
@media (min-width: 1100px) {
    .site-header {
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: saturate(1.4) blur(14px);
        -webkit-backdrop-filter: saturate(1.4) blur(14px);
    }
}

.site-header.is-scrolled { box-shadow: var(--shadow-md); }

.navbar {
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-height: var(--header-h);
}

.brand {
    display: flex;
    align-items: center;
    flex: none;
    margin-right: auto;
    color: var(--ink);
    font-weight: 800;
    font-size: var(--text-lg);
}

.brand img {
    height: 56px;
    width: auto;
}

.nav {
    display: none;
}

.nav__list {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    list-style: none;
}

.nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0.5rem 0.8rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 650;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.nav__link:hover,
.has-sub:focus-within > .nav__link { background: var(--pebble); color: var(--ink); }

.nav__link[aria-current='page'] { color: var(--brand); }

.nav__link[aria-current='page']::after {
    content: '';
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: var(--brand);
}

.nav__chev { width: 12px; height: 12px; transition: transform 0.2s; }
.nav__toggle[aria-expanded='true'] .nav__chev { transform: rotate(180deg); }

.has-sub { position: relative; }

.nav__sub {
    list-style: none;
    min-width: 200px;
    padding: 0.5rem;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.nav__sub .nav__link { display: flex; width: 100%; }

.navbar__cta { display: none; }

.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-right: -8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
}

.nav-toggle:hover { background: var(--pebble); }

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.25s var(--ease), opacity 0.2s;
}

.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -7px; }
.nav-toggle__bars::after { top: 7px; }

.nav-open .nav-toggle__bars { background: transparent; }
.nav-open .nav-toggle__bars::before { top: 0; transform: rotate(45deg); }
.nav-open .nav-toggle__bars::after { top: 0; transform: rotate(-45deg); }

/* Phones and tablets: the menu is a full-height panel under the header */
@media (max-width: 1099px) {
    .nav {
        position: fixed;
        inset: var(--header-h) 0 0 0;
        z-index: 90;
        display: block;
        padding: var(--s3) var(--gutter) var(--s5);
        overflow-y: auto;
        background: var(--paper);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s 0.25s;
    }

    .nav-open .nav {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }

    .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
    .nav__list > li { border-bottom: 1px solid var(--pebble); }
    .nav__link { width: 100%; min-height: 56px; padding: 0.75rem 0.25rem; font-size: var(--text-lg); justify-content: space-between; }
    .nav__link:hover { background: transparent; }
    .nav__link[aria-current='page']::after { display: none; }
    .nav__sub { display: none; padding: 0 0 0.5rem 1rem; border: 0; box-shadow: none; }
    .has-sub.is-open > .nav__sub { display: block; }
    .nav__sub .nav__link { min-height: 48px; font-size: var(--text-base); font-weight: 600; color: var(--slate); }
    .nav__mobile-cta { margin-top: var(--s3); display: block; }
    .nav__mobile-cta .btn { width: 100%; }
}

@media (min-width: 1100px) {
    .nav { display: block; }
    .nav-toggle { display: none; }
    .navbar__cta { display: inline-flex; }
    .nav__mobile-cta { display: none; }
    .brand { margin-right: 0; }
    .nav { margin-left: auto; }

    .nav__sub {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        visibility: hidden;
        opacity: 0;
        transform: translateY(6px);
        transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s;
    }

    .has-sub:hover > .nav__sub,
    .has-sub.is-open > .nav__sub,
    .has-sub:focus-within > .nav__sub {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition-delay: 0s;
    }
}

/* ---- Page hero (inner pages) ---- */
.page-hero {
    position: relative;
    overflow: hidden;
    background: var(--ink);
    color: #fff;
    padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem);
    isolation: isolate;
}

.page-hero__bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.22;
}

.page-hero .diamond { z-index: -1; }

.page-hero h1 {
    margin: 0;
    max-width: 18ch;
    color: #fff;
    font-size: clamp(2.125rem, 1.5rem + 3vw, 3.75rem);
}

.page-hero__sub {
    max-width: 60ch;
    margin: var(--s2) 0 0;
    color: #cfe0f1;
    font-size: var(--text-lg);
}

.crumbs {
    margin-bottom: var(--s3);
    font-size: var(--text-sm);
    font-weight: 600;
}

.crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.6rem;
    list-style: none;
}

.crumbs li { display: inline-flex; align-items: center; gap: 0.6rem; color: #cfe0f1; }
.crumbs li + li::before { content: '/'; opacity: 0.45; }
.crumbs a { color: #cfe0f1; text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color 0.2s; }
.crumbs a:hover { color: #fff; text-decoration-color: currentColor; }
.crumbs [aria-current] { color: #fff; }

/* Decorative diamonds, the logo's own shape. Atmosphere only, never UI. */
.diamond {
    position: absolute;
    width: var(--size, 120px);
    aspect-ratio: 1;
    border-radius: 14%;
    transform: rotate(45deg);
    pointer-events: none;
}

.diamond--blue { background: var(--brand); }
.diamond--green { background: var(--green); }
.diamond--ink { background: var(--ink); }
.diamond--ring { border: 2px solid currentColor; background: transparent; }

/* ---- Badges and tags ---- */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: var(--text-xs);
    font-weight: 700;
    line-height: 1.5;
}

.tag--green { background: var(--green-soft); color: var(--green-ink); }
.tag--plain { background: var(--pebble); color: var(--slate); }

/* ---- Cards ---- */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}

a.card:hover,
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: #bfd2e6;
}

.media {
    position: relative;
    overflow: hidden;
    background: var(--pebble);
}

.media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: auto !important;
    transition: transform 0.6s var(--ease);
}

.card:hover .media img,
.media-hover:hover img { transform: scale(1.04); }

.media--4x3 { aspect-ratio: 4 / 3; }
.media--16x10 { aspect-ratio: 16 / 10; }
.media--wide { aspect-ratio: 16 / 9; }

.card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.5rem;
    padding: var(--s3);
}

.card__title { margin: 0; font-size: var(--text-lg); line-height: 1.3; }
.card__title a { color: var(--ink); }
.card__title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }

.card__text { margin: 0; color: var(--slate); font-size: var(--text-sm); }
.card__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; padding-top: 0.5rem; }

.card__date {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--slate);
    letter-spacing: 0.02em;
}

.card__more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.5rem;
    color: var(--brand);
    font-size: var(--text-sm);
    font-weight: 700;
}

.card__more svg { width: 1em; height: 1em; transition: transform 0.2s; }
.card:hover .card__more svg { transform: translateX(4px); }

/* ---- Forms ---- */
.form { display: grid; gap: var(--s2); }
.form__row { display: grid; gap: var(--s2); }

@media (min-width: 640px) {
    .form__row--2 { grid-template-columns: 1fr 1fr; }
}

.field { display: grid; gap: 0.4rem; }

.field label,
.field__label {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--ink);
}

.field label small { font-weight: 500; color: var(--slate); }

.input,
.field input[type='text'],
.field input[type='email'],
.field input[type='tel'],
.field input[type='number'],
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.95rem;
    background: var(--paper);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    color: var(--ink);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea { min-height: 140px; resize: vertical; }

.field input[type='file'] {
    width: 100%;
    padding: 0.6rem;
    background: var(--paper);
    border: 1px dashed var(--mist);
    border-radius: var(--radius-sm);
    color: var(--slate);
}

.field input::placeholder,
.field textarea::placeholder { color: #8aa0b8; }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--mist); }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(0, 100, 182, 0.16);
}

.form .help-block {
    font-size: var(--text-xs);
    font-weight: 650;
    color: var(--danger);
}

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: var(--text-sm);
    font-weight: 600;
}

.alert-success { background: var(--green-soft); border-color: #a9dca3; color: var(--green-ink); }
.alert-danger { background: var(--danger-soft); border-color: #f2b8b2; color: var(--danger); }

/* ---- Pagination ---- */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: var(--s5);
    list-style: none;
}

.pager a,
.pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.8rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink);
    font-weight: 700;
    font-size: var(--text-sm);
}

.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager [aria-current='page'] { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager [aria-disabled='true'] { color: var(--mist); background: var(--cloud); }

/* ---- Prose: rich text written in the dashboard ---- */
.prose {
    max-width: 70ch;
    font-size: var(--text-lg);
    line-height: 1.75;
    color: #1d4166;
}

.prose > * + * { margin-top: 1.25em; }
.prose h2 { margin-top: 2em; font-size: var(--text-2xl); }
.prose h3 { margin-top: 1.7em; font-size: var(--text-xl); }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; }
.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--brand); font-weight: 700; }

.prose blockquote {
    margin-inline: 0;
    padding: 0.4em 0 0.4em 1.2em;
    border-left: 4px solid var(--green);
    font-size: 1.1em;
    font-weight: 600;
    color: var(--ink);
}

.prose img { border-radius: var(--radius-md); }
.prose strong { color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--hairline); margin-block: 2.5em; }

.prose--compact { font-size: var(--text-base); line-height: 1.7; }

/* ---- Footer ---- */
.site-footer {
    background: var(--paper);
    border-top: 1px solid var(--hairline);
    color: var(--slate);
    font-size: var(--text-sm);
}

.footer__grid {
    display: grid;
    gap: var(--s5) var(--s4);
    padding-block: var(--s6);
}

@media (min-width: 700px) { .footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer__grid { grid-template-columns: 1.5fr 1fr 1fr 1.3fr; } }

.footer__brand img { height: 56px; width: auto; margin-bottom: var(--s2); }
.footer__brand p { max-width: 36ch; }

.footer__title {
    margin: 0 0 var(--s2);
    color: var(--ink);
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer__links { display: grid; gap: 0.15rem; list-style: none; }
.footer__links a { display: inline-block; padding-block: 0.3rem; color: var(--ink); font-weight: 600; }
.footer__links a:hover { color: var(--brand); }

.footer__contact { display: grid; gap: 0.75rem; font-style: normal; }
.footer__contact a { color: var(--ink); font-weight: 600; }
.footer__contact a:hover { color: var(--brand); }

.social { display: flex; gap: 0.5rem; margin-top: var(--s3); list-style: none; }

.social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    color: var(--ink);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.social a:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.social svg { width: 18px; height: 18px; }

.footer__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s2);
    padding-block: var(--s3);
    border-top: 1px solid var(--hairline);
    font-size: var(--text-xs);
    font-weight: 600;
}

.footer__bar a { color: var(--slate); }
.footer__bar a:hover { color: var(--brand); }

.to-top {
    position: fixed;
    right: var(--s3);
    bottom: var(--s3);
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-full);
    background: var(--paper);
    color: var(--ink);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s, visibility 0s 0.25s;
}

.to-top.is-visible { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.to-top:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.to-top svg { width: 18px; height: 18px; }
