/* ==========================================================================
   عشيرة الزيود — visual system
   Concept: the page opens inside بيت الشعر (the goat-hair tent) and moves out
   into daylight. The woven سدو band is the structural spine that separates
   every section, the way woven panels divide a tent.
   ========================================================================== */

:root {
    /* Goat hair, hearth smoke, undyed wool, madder dye, brass. */
    --hair: #14100e;
    --hearth: #1e1714;
    --ember: #2b211b;
    --bone: #efe5d4;
    --bone-dim: #dccdb4;
    --sand: #a58f70;
    --sand-deep: #6f5c44;
    --madder: #9c2b38;
    --madder-deep: #71202a;
    --saffron: #c9a227;

    --ok: #2f6b4f;
    --warn: #8a3b1e;

    --font-display: "Reem Kufi", "Noto Kufi Arabic", "Segoe UI", sans-serif;
    --font-body: "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;

    --shell: 1120px;
    --gutter: clamp(1.25rem, 4vw, 2.5rem);

    --radius: 3px;
    --shadow: 0 18px 44px -28px rgba(20, 16, 14, 0.7);
}

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

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

body {
    margin: 0;
    background: var(--bone);
    color: var(--hair);
    font-family: var(--font-body);
    font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
    line-height: 1.85;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

p {
    margin: 0 0 1.1em;
}

a {
    color: var(--madder-deep);
}

img,
svg {
    max-width: 100%;
}

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

.shell {
    width: min(100% - (var(--gutter) * 2), var(--shell));
    margin-inline: auto;
}

.skip-link {
    position: absolute;
    inset-inline-start: -9999px;
    top: 0;
    z-index: 99;
    background: var(--saffron);
    color: var(--hair);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
}

.skip-link:focus {
    inset-inline-start: 0;
}

/* --------------------------------------------------------------------------
   Signature: the سدو band. Madder diamonds on undyed wool, ruled in goat hair.
   -------------------------------------------------------------------------- */

.sadu {
    height: 22px;
    background-color: var(--bone);
    background-image:
        linear-gradient(135deg, var(--madder) 25%, transparent 25%),
        linear-gradient(225deg, var(--madder) 25%, transparent 25%),
        linear-gradient(315deg, var(--madder) 25%, transparent 25%),
        linear-gradient(45deg, var(--madder) 25%, transparent 25%);
    background-size: 22px 22px;
    border-block: 3px solid var(--hair);
    flex: none;
}

.sadu--dark {
    background-color: var(--hair);
    background-image:
        linear-gradient(135deg, var(--saffron) 25%, transparent 25%),
        linear-gradient(225deg, var(--saffron) 25%, transparent 25%),
        linear-gradient(315deg, var(--saffron) 25%, transparent 25%),
        linear-gradient(45deg, var(--saffron) 25%, transparent 25%);
    border-block-color: var(--madder);
}

.sadu--slim {
    height: 14px;
    background-size: 14px 14px;
    border-block-width: 2px;
}

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */

.masthead {
    background: var(--hair);
    color: var(--bone);
}

.masthead__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-block: 1rem;
    flex-wrap: wrap;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--bone);
    text-decoration: none;
}

.wordmark__mark {
    width: 34px;
    height: 34px;
    flex: none;
    color: var(--saffron);
}

.wordmark__text {
    font-family: var(--font-display);
    font-size: 1.4rem;
    letter-spacing: 0.01em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem 1.75rem;
    flex-wrap: wrap;
}

.nav a {
    color: var(--bone-dim);
    text-decoration: none;
    font-size: 0.95rem;
    padding-block: 0.25rem;
    border-bottom: 2px solid transparent;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.nav a:hover,
.nav a[aria-current="page"] {
    color: var(--bone);
    border-bottom-color: var(--madder);
}

/* --------------------------------------------------------------------------
   Hero — inside the tent
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    background-color: var(--hair);
    background-image:
        repeating-linear-gradient(90deg, rgba(239, 229, 212, 0.022) 0 1px, transparent 1px 4px),
        radial-gradient(130% 80% at 50% -10%, rgba(201, 162, 39, 0.16), transparent 62%);
    color: var(--bone);
    text-align: center;
    padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5rem);
    overflow: hidden;
}

.hero__eyebrow {
    font-size: 0.82rem;
    letter-spacing: 0.28em;
    color: var(--saffron);
    margin: 0 0 1.5rem;
    text-transform: uppercase;
}

.hero__title {
    font-size: clamp(3rem, 12vw, 7rem);
    line-height: 1.1;
    margin: 0;
    color: var(--bone);
    text-shadow: 0 2px 40px rgba(201, 162, 39, 0.18);
}

.hero__lede {
    max-width: 46ch;
    margin: 1.5rem auto 0;
    color: var(--bone-dim);
    font-size: clamp(1.02rem, 1rem + 0.3vw, 1.2rem);
}

.hero__band {
    width: min(560px, 82%);
    margin: 2.5rem auto;
}

.hero__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.95rem 2rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn--primary {
    background: var(--madder);
    color: var(--bone);
    border-color: var(--madder);
}

.btn--primary:hover {
    background: var(--madder-deep);
    border-color: var(--madder-deep);
}

.btn--ghost {
    background: transparent;
    color: var(--bone);
    border-color: rgba(239, 229, 212, 0.35);
}

.btn--ghost:hover {
    border-color: var(--saffron);
    color: var(--saffron);
}

.btn--block {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
    padding-block: clamp(3rem, 7vw, 5.5rem);
}

.section--dark {
    background: var(--hearth);
    color: var(--bone);
}

.section__head {
    max-width: 62ch;
    margin-bottom: 2.5rem;
}

.section__eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.24em;
    color: var(--madder);
    margin: 0 0 0.75rem;
}

.section--dark .section__eyebrow {
    color: var(--saffron);
}

.section__title {
    font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem);
}

.section__lede {
    margin-top: 1rem;
    color: var(--sand-deep);
}

.section--dark .section__lede {
    color: var(--bone-dim);
}

/* Story: pillars of the tent — three panels held by a shared ridge line. */

.pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1px;
    background: rgba(20, 16, 14, 0.16);
    border: 1px solid rgba(20, 16, 14, 0.16);
}

.pillar {
    background: var(--bone);
    padding: 2rem 1.75rem;
}

.pillar__label {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--madder);
    margin: 0 0 0.85rem;
}

.pillar__title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.pillar p {
    margin-bottom: 0;
    color: var(--sand-deep);
}

/* الأفخاذ — a woven register, each name a knot on the loom. */

.fakhth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.85rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.fakhth {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(239, 229, 212, 0.06);
    border: 1px solid rgba(239, 229, 212, 0.16);
    border-inline-start: 3px solid var(--saffron);
    padding: 0.9rem 1.1rem;
    font-size: 1.05rem;
}

.fakhth__dot {
    width: 9px;
    height: 9px;
    flex: none;
    background: var(--madder);
    transform: rotate(45deg);
}

.fakhth__note {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--sand);
}

/* --------------------------------------------------------------------------
   الأفخاذ page
   -------------------------------------------------------------------------- */

.page-head {
    background-color: var(--hair);
    background-image:
        repeating-linear-gradient(90deg, rgba(239, 229, 212, 0.022) 0 1px, transparent 1px 4px),
        radial-gradient(120% 90% at 50% -20%, rgba(201, 162, 39, 0.14), transparent 62%);
    color: var(--bone);
    text-align: center;
    padding-block: clamp(2.75rem, 6vw, 4.5rem);
}

.page-head__title {
    font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.4rem);
    color: var(--bone);
}

.page-head__lede {
    max-width: 52ch;
    margin: 1rem auto 0;
    color: var(--bone-dim);
}

.tribes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* minmax(0, 1fr) rather than 1fr: grid tracks default to min-content,
       which would let the wide tree image stretch the whole page. */
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

.tribe {
    min-width: 0;
    border: 1px solid rgba(20, 16, 14, 0.18);
    background: #fff;
}

.tribe:has(.tribe__panel[open]) {
    border-color: rgba(20, 16, 14, 0.32);
    box-shadow: var(--shadow);
}

.tribe__head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.6rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.16s ease;
}

/* Hide the browser's own disclosure triangle — the chevron replaces it. */
.tribe__head {
    list-style: none;
}

.tribe__head::-webkit-details-marker {
    display: none;
}

.tribe__head:hover {
    background: rgba(156, 43, 56, 0.05);
}

.tribe__head:focus-visible {
    outline: 3px solid var(--saffron);
    outline-offset: -3px;
}

.tribe__state {
    margin-inline-start: auto;
    font-size: 0.85rem;
    color: var(--sand-deep);
}

.tribe__chevron {
    width: 13px;
    height: 9px;
    flex: none;
    color: var(--madder);
    transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.tribe__panel[open] .tribe__chevron {
    transform: rotate(180deg);
}

.tribe__body {
    min-width: 0;
    padding: 0 1.6rem 1.6rem;
}

.tribe__empty {
    margin: 0;
    padding-top: 0.35rem;
    color: var(--sand-deep);
    font-size: 0.95rem;
}

/* Clipped to a diamond rather than rotated, so the number stays upright. */
.tribe__index {
    width: 2.3rem;
    height: 2.3rem;
    flex: none;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--bone);
    background: var(--madder);
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.tribe__name {
    font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Family tree */

.tree {
    margin: 0.5rem 0 0;
}

.tree__caption {
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    color: var(--madder);
    margin-bottom: 0.75rem;
}

.tree__frame {
    display: block;
    max-width: 100%;
    border: 1px solid rgba(20, 16, 14, 0.16);
    background: #faf7f1;
    padding: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    transition: border-color 0.18s ease;
}

.tree__frame:hover {
    border-color: var(--madder);
}

.tree__frame img {
    display: block;
    width: 100%;
    height: auto;
    /* Wide trees stay readable by scrolling inside the frame rather than
       shrinking the names into illegibility. */
    min-width: 720px;
}

/* --- Narrow screens ---------------------------------------------------- */

@media (max-width: 640px) {
    .page-head {
        padding-block: 2.25rem;
    }

    .tribe__head {
        padding: 1rem 1.1rem;
        gap: 0.7rem;
    }

    .tribe__body {
        padding: 0 1.1rem 1.1rem;
    }

    /* The status label is the first thing to go — the chevron already says
       the row opens, and the name matters more than the label. */
    /* .tribe__state {
        display: none;
    } */

    .tribe__index {
        width: 1.9rem;
        height: 1.9rem;
        font-size: 0.78rem;
    }

    .tree__frame {
        padding: 0.35rem;
    }

    .tree__frame img {
        min-width: 560px;
    }
}


/* Closing call */

.call {
    background: var(--bone-dim);
    text-align: center;
    padding-block: clamp(3rem, 7vw, 4.5rem);
}

.call__title {
    font-size: clamp(1.7rem, 1.3rem + 2vw, 2.6rem);
    margin-bottom: 0.75rem;
}

.call__text {
    max-width: 50ch;
    margin-inline: auto;
    color: var(--sand-deep);
}

/* --------------------------------------------------------------------------
   Flash / thank-you
   -------------------------------------------------------------------------- */

.flash {
    background: var(--bone);
    color: var(--hair);
    border: 2px solid var(--hair);
    box-shadow: var(--shadow);
    padding: 1.35rem 1.5rem;
    margin-block: 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.flash__mark {
    width: 30px;
    height: 30px;
    flex: none;
    color: var(--madder);
    margin-top: 0.2rem;
}

.flash__title {
    font-family: var(--font-display);
    font-size: 1.45rem;
    margin: 0 0 0.35rem;
}

.flash p {
    margin: 0;
    color: var(--sand-deep);
}

.flash--error {
    border-color: var(--warn);
}

.flash--error .flash__mark {
    color: var(--warn);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-page {
    padding-block: clamp(2.5rem, 6vw, 4rem);
}

.form-card {
    max-width: 720px;
    margin-inline: auto;
    background: var(--bone);
    border: 1px solid rgba(20, 16, 14, 0.2);
    box-shadow: var(--shadow);
}

.form-card__head {
    background: var(--hair);
    color: var(--bone);
    padding: 2rem clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.form-card__title {
    font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.3rem);
    color: var(--bone);
}

.form-card__lede {
    margin: 0.65rem 0 0;
    color: var(--bone-dim);
    font-size: 0.98rem;
}

.form-card__body {
    padding: clamp(1.75rem, 4vw, 2.5rem);
}

.field {
    margin-bottom: 1.6rem;
}

.field__label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.field__hint {
    display: block;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--sand-deep);
    margin-top: 0.2rem;
}

.field__required {
    color: var(--madder);
    margin-inline-start: 0.25rem;
}

.input,
.select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.5;
    padding: 0.8rem 1rem;
    color: var(--hair);
    background: #fff;
    border: 1px solid var(--sand);
    border-radius: var(--radius);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input:focus,
.select:focus {
    border-color: var(--madder);
    box-shadow: 0 0 0 3px rgba(156, 43, 56, 0.14);
    outline: none;
}

.input[aria-invalid="true"],
.select[aria-invalid="true"] {
    border-color: var(--warn);
    background: #fff8f5;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236f5c44' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: left 1rem center;
    background-size: 12px 8px;
    background-repeat: no-repeat;
    padding-inline-start: 2.6rem;
}

.field__error {
    display: block;
    color: var(--warn);
    font-size: 0.9rem;
    margin-top: 0.4rem;
    font-weight: 600;
}

/* Ballot choices — framed as a pair, because they are one decision. */

.ballot {
    border: 1px solid rgba(20, 16, 14, 0.2);
    padding: 1.5rem;
    margin-bottom: 1.75rem;
}

.ballot__legend {
    font-family: var(--font-display);
    font-size: 1.25rem;
    padding-inline: 0.6rem;
    margin-inline-start: -0.6rem;
}

.ballot__hint {
    color: var(--sand-deep);
    font-size: 0.92rem;
    margin: 0.35rem 0 1.25rem;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--sand);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.check + .check {
    margin-top: 0.75rem;
}

.check:hover {
    border-color: var(--madder);
}

.check__box {
    width: 1.35rem;
    height: 1.35rem;
    flex: none;
    margin: 0.2rem 0 0;
    accent-color: var(--madder);
}

.check__label {
    font-weight: 600;
}

.check__note {
    display: block;
    font-weight: 400;
    font-size: 0.88rem;
    color: var(--sand-deep);
}

/* The wrapper exists only to carry the `disabled` attribute — it should be
   invisible as a box. */
.form-fields {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.form-fields:disabled .input,
.form-fields:disabled .select,
.form-fields:disabled .check {
    background-color: #efeade;
    color: var(--sand-deep);
    cursor: not-allowed;
}

.form-fields:disabled .check:hover {
    border-color: var(--sand);
}

.form-fields:disabled .btn {
    background: var(--sand);
    border-color: var(--sand);
    color: #fff;
    cursor: not-allowed;
}

.form-fields:disabled .btn:hover {
    transform: none;
    background: var(--sand);
    border-color: var(--sand);
}

/* Registration-closed notice */

.notice {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.35rem 1.4rem;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.45);
    margin-bottom: 2rem;
}

.notice__mark {
    width: 30px;
    height: 30px;
    flex: none;
    color: var(--madder);
    margin-top: 0.25rem;
}

.notice__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin: 0 0 0.4rem;
}

.notice p:last-child {
    margin: 0;
    color: var(--sand-deep);
}

.closed__what {
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.closed__list {
    margin: 0 0 1.5rem;
    padding-inline-start: 1.2rem;
    color: var(--sand-deep);
}

.closed__list li {
    margin-bottom: 0.4rem;
}

.form-actions {
    margin-top: 2rem;
}

.form-note {
    text-align: center;
    font-size: 0.88rem;
    color: var(--sand-deep);
    margin: 1rem 0 0;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
    background: var(--hair);
    color: var(--bone-dim);
    padding-block: 2.5rem;
    font-size: 0.9rem;
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.footer a {
    color: var(--sand);
}

/* --------------------------------------------------------------------------
   Motion — one orchestrated entrance, nothing scattered.
   -------------------------------------------------------------------------- */

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes weave {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

.hero__eyebrow,
.hero__title,
.hero__lede,
.hero__actions {
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
}

.hero__title {
    animation-delay: 0.08s;
}

.hero__lede {
    animation-delay: 0.16s;
}

.hero__band .sadu {
    animation: weave 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) 0.24s backwards;
    transform-origin: right center;
}

.hero__actions {
    animation-delay: 0.42s;
}

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

    .btn:hover {
        transform: none;
    }
}
