/* =========================================================
   1. DESIGN TOKENS
   Change colors, fonts and sizes here. Everything else reads from these.
   ========================================================= */
:root {
    /* Surfaces */
    --bg:            #0e0e10;
    --bg-alt:        #141417;
    --surface:       #1a1a1e;
    --surface-hover: #1f1f24;
    --border:        #26262b;
    --border-strong: #333338;

    /* Text */
    --text:          #ededed;   /* main text */
    --text-soft:     #8a8a92;   /* body copy, descriptions */
    --text-faint:    #5a5a62;   /* labels, indexes, footer */
    --white:         #ffffff;   /* header links, form labels */

    /* Accent */
    --accent:        #7c0000;

    /* Fonts */
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    /* Layout */
    --max: 1140px;
    --gutter: 24px;
    --header-height: 64px;
    --section-padding: 96px;
    --hero-padding-top: 140px;
    --hero-padding-bottom: 120px;
}

/* =========================================================
   2. BASE
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    padding-top: var(--header-height);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* Shared hover underline used by header and footer links */
.nav a::after,
.footer-nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav a:hover::after,
.footer-nav a:hover::after { width: 100%; }

/* =========================================================
   3. HEADER
   ========================================================= */
.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    height: var(--header-height);
    background: rgba(14, 14, 16, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.site-header.hidden { transform: translateY(-100%); }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
}

.header-right { display: flex; align-items: center; gap: 28px; }
.nav { display: flex; gap: 32px; }

.nav a {
    position: relative;
    padding-bottom: 2px;
    font-size: 14px;
    color: var(--white);
    transition: color 0.15s;
}

.nav a:hover { color: var(--accent); }

/* Live clock (Riyadh time) */
.riyadh-clock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--white);
    transition: color 0.2s;
    white-space: nowrap;
}

.riyadh-clock:hover { color: var(--text); }
.clock-time { font-weight: 500; letter-spacing: 0.02em; }
.clock-zone { font-size: 10px; color: var(--white); letter-spacing: 0.1em; }

/* =========================================================
   4. SHARED COMPONENTS
   ========================================================= */
.section-title {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text);
}

.section-index {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-faint);
    letter-spacing: 0.05em;
}

/* Arrow link used in the hero */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-strong);
    transition: border-color 0.2s, color 0.2s;
}

.link-arrow:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.link-arrow .arrow { transition: transform 0.2s; }
.link-arrow:hover .arrow { transform: translateX(4px); }

/* =========================================================
   5. HERO
   ========================================================= */
.hero {
    padding: var(--hero-padding-top) 0 var(--hero-padding-bottom);
    border-bottom: 1px solid var(--border);
}

.eyebrow,
.hero-title,
.hero-lede,
.hero-meta {
    animation: hero-fade 0.8s ease-out both;
}

.hero-title { animation-delay: 0.1s; }
.hero-lede  { animation-delay: 0.25s; }
.hero-meta  { animation-delay: 0.4s; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    margin-bottom: 40px;
}

.hero-title {
    font-size: clamp(36px, 5.5vw, 64px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--accent);
    max-width: 22ch;
    margin-bottom: 40px;
}

.hero-lede {
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-soft);
    max-width: 60ch;
    margin-bottom: 48px;
}

.hero-lede strong { color: var(--accent); font-weight: 500; }

.hero-meta {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

/* =========================================================
   6. SECTIONS (shared layout)
   ========================================================= */
.section {
    padding: var(--section-padding) 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.section-alt { background: var(--bg-alt); }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 56px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

/* =========================================================
   7. ABOUT
   ========================================================= */
.about-grid,
.contact-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
}

.about-head,
.contact-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.about-body p {
    font-size: 17px;
    line-height: 1.75;
    color: var(--text-soft);
    max-width: 65ch;
    margin-bottom: 20px;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 40px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.fact dt {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    margin-bottom: 6px;
}

.fact dd { font-size: 15px; color: var(--text); }

/* =========================================================
   8. PROJECTS
   ========================================================= */
.work-list { list-style: none; display: flex; flex-direction: column; }
.work-item { border-bottom: 1px solid var(--border); }
.work-item:last-child { border-bottom: none; }

.work-link {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    align-items: start;
    padding: 32px 8px;
    transition: background 0.2s;
}

.work-link:hover { background: var(--surface); }

.work-meta { display: flex; flex-direction: column; gap: 6px; }
.work-year { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
.work-tag  { font-size: 13px; color: var(--text-soft); }
.work-info { display: flex; flex-direction: column; }

.work-title {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.015em;
    color: var(--accent);
    margin-bottom: 8px;
}

.work-desc {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-soft);
    max-width: 60ch;
    margin-bottom: 16px;
}

.work-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    padding-bottom: 3px;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.work-cta:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.work-cta-arrow { transition: transform 0.2s; }
.work-cta:hover .work-cta-arrow { transform: translate(3px, -3px); }

.work-item:hover .work-cta-arrow {
    animation: arrow-bounce 0.8s ease-in-out infinite;
}

/* =========================================================
   9. SKILLS
   ========================================================= */
.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 8px;
}

.skills-category {
    background: var(--surface);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.skills-category:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateY(-4px);
}

.skills-category-title {
    display: block;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.skills-category-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 10px;
    background: var(--accent);
    transform: translateY(-1px);
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.skills-list img {
    height: 28px;
    width: auto;
    transition: transform 0.2s ease, filter 0.2s ease;
    animation: badge-pop 0.4s ease-out both;
}

/* Staggered entrance for badges (delay = position * 0.02s) */
.skills-list img:nth-child(1)  { animation-delay: 0.02s; }
.skills-list img:nth-child(2)  { animation-delay: 0.04s; }
.skills-list img:nth-child(3)  { animation-delay: 0.06s; }
.skills-list img:nth-child(4)  { animation-delay: 0.08s; }
.skills-list img:nth-child(5)  { animation-delay: 0.10s; }
.skills-list img:nth-child(6)  { animation-delay: 0.12s; }
.skills-list img:nth-child(7)  { animation-delay: 0.14s; }
.skills-list img:nth-child(8)  { animation-delay: 0.16s; }
.skills-list img:nth-child(9)  { animation-delay: 0.18s; }
.skills-list img:nth-child(10) { animation-delay: 0.20s; }

.skills-list img:hover {
    transform: translateY(-3px) scale(1.06);
    filter: brightness(1.2) drop-shadow(0 4px 8px rgba(212, 255, 58, 0.2));
}

/* =========================================================
   10. CONTACT
   ========================================================= */
.contact-lede {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-soft);
    max-width: 55ch;
    margin-bottom: 4px;
}

.contact-channels {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    max-width: 100%;
    margin-top: 48px; /* space below the form and its status message */
}

.channel {
    position: relative;
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    color: inherit;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.channel:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateX(-4px);
}

/* Red bar that slides in on the left edge */
.channel::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 0;
    width: 2px;
    height: 100%;
    background: var(--accent);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.25s ease;
}

.channel:hover::before { transform: scaleY(1); }

.channel-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--bg);
    border-radius: 10px;
    color: var(--text-soft);
    transition: color 0.2s ease;
}

.channel-icon svg { width: 18px; height: 18px; }
.channel:hover .channel-icon { color: var(--accent); }

.channel-info { min-width: 0; }

.channel-name {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
}

.channel-arrow {
    font-size: 16px;
    color: var(--text-faint);
    transition: color 0.2s ease, transform 0.2s ease;
}

.channel:hover .channel-arrow {
    color: var(--accent);
    transform: translate(3px, -3px);
}

/* Contact form */
.contact-form {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white);
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--white);
    opacity: 0.6;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--accent);
    background: var(--surface-hover);
    box-shadow: 0 0 0 3px rgba(124, 0, 0, 0.15), 0 0 20px rgba(124, 0, 0, 0.1);
}

.form-field input:invalid:not(:placeholder-shown),
.form-field textarea:invalid:not(:placeholder-shown) {
    border-color: rgba(220, 38, 38, 0.6);
}

/* Honeypot field: hidden from people, visible to bots */
.hidden-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.form-submit {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.form-submit:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.form-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.form-submit-arrow { transition: transform 0.2s ease; }
.form-submit:hover .form-submit-arrow { transform: translate(3px, -3px); }

.form-status {
    min-height: 12px;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 13px;
    transition: color 0.2s ease;
}

.form-status.success { color: #4ade80; }
.form-status.error   { color: #f87171; }

/* =========================================================
   11. FOOTER
   ========================================================= */
.site-footer {
    padding: 30px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-faint);
}

.footer-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 28px;
}

.footer-nav a {
    position: relative;
    padding-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-soft);
    transition: color 0.2s ease;
}

.footer-nav a:hover { color: var(--accent); }

/* =========================================================
   12. CUSTOM CURSOR
   ========================================================= */
html, body,
a, button, .skill-tag, .work-cta,
input, textarea, [role="button"] {
    cursor: none;
}

.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 25px;
    height: 25px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform;
    transition: width 0.25s ease, height 0.25s ease;
}

.cursor.is-hidden { opacity: 0; }

.cursor__ring,
.cursor__dashed {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.cursor__ring {
    border: 1px solid rgba(237, 237, 237, 0.35);
    transition: border-color 0.25s ease, transform 0.35s ease;
}

.cursor__dashed {
    inset: 6px;
    border: 1px dashed rgba(237, 237, 237, 0.4);
    animation: cursor-spin 12s linear infinite;
    transition: border-color 0.25s ease;
}

.cursor__line {
    position: absolute;
    background: var(--text);
    transition: background 0.25s ease, transform 0.25s ease, width 0.25s ease, height 0.25s ease;
}

.cursor__line--top,
.cursor__line--bottom {
    width: 1.5px;
    height: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.cursor__line--top    { top: -8px; }
.cursor__line--bottom { bottom: -8px; }

.cursor__line--left,
.cursor__line--right {
    width: 8px;
    height: 1.5px;
    top: 50%;
    transform: translateY(-50%);
}

.cursor__line--left  { left: -8px; }
.cursor__line--right { right: -8px; }

.cursor__dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--text);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: background 0.25s ease, transform 0.25s ease;
}

/* Hover state */
.cursor.is-hover .cursor__ring {
    border-color: var(--accent);
    transform: scale(1.15);
}

.cursor.is-hover .cursor__dashed {
    border-color: var(--accent);
    animation-duration: 4s;
}

.cursor.is-hover .cursor__line { background: var(--accent); }
.cursor.is-hover .cursor__line--top    { transform: translateX(-50%) translateY(-4px); }
.cursor.is-hover .cursor__line--bottom { transform: translateX(-50%) translateY(4px); }
.cursor.is-hover .cursor__line--right  { transform: translateY(-50%) translateX(4px); }
.cursor.is-hover .cursor__line--left   { transform: translateY(-50%) translateX(-4px); }

.cursor.is-hover .cursor__dot {
    background: var(--accent);
    transform: translate(-50%, -50%) scale(1.5);
}

/* Click state */
.cursor.is-click .cursor__ring {
    transform: scale(0.85);
    border-color: var(--accent);
}

.cursor.is-click .cursor__dot {
    background: var(--accent);
    transform: translate(-50%, -50%) scale(2.5);
}

/* =========================================================
   13. KEYFRAMES
   ========================================================= */
@keyframes cursor-spin { to { transform: rotate(360deg); } }

@keyframes hero-fade {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes badge-pop {
    0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes arrow-bounce {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(2px, -2px); }
}

/* =========================================================
   14. RESPONSIVE
   Ordered from wide to narrow screens.
   ========================================================= */
@media (max-width: 860px) {
    .work-link { grid-template-columns: 1fr; gap: 12px; }
    .about-grid,
    .contact-grid { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }

    .form-submit {
        width: 100%;
        justify-content: center;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .footer-nav { gap: 20px; }
}

@media (max-width: 600px) {
    :root {
        --hero-padding-top: 100px;
        --hero-padding-bottom: 80px;
        --section-padding: 64px;
    }

    .nav { gap: 18px; }
    .nav a { font-size: 13px; }
    .header-right { gap: 16px; }

    .section-head { margin-bottom: 36px; }

    .facts { grid-template-columns: 1fr; gap: 16px; }

    .skills-container { gap: 16px; }
    .skills-category { padding: 20px; }
    .skills-category-title { font-size: 17px; }
}

@media (max-width: 480px) {
    .channel-icon { width: 32px; height: 32px; }
    .channel-icon svg { width: 16px; height: 16px; }
}

@media (hover: none), (max-width: 768px) {
    html, body,
    a, button, .skill-tag, .work-cta { cursor: auto; }
    .cursor { display: none; }
}

/* Phones: the clock takes too much room in the header, so hide it */
@media (max-width: 480px) {
    .riyadh-clock { display: none; }
}
