/*------------------------------------------------------------------
[Site specific styles — امیرحسین شاه محمدی]

1. Utilities the compiled Tailwind build does not ship
2. Portrait treatment
3. Section polish
4. Print stylesheet (resume hand-out)
------------------------------------------------------------------*/

/*------------------------------------------------------------------
    [1. Missing utilities]
    ------------------------------------------------------------------*/

.gap-1\.5 {
    gap: 0.375rem;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.text-md {
    font-size: 1rem;
    line-height: 1.5rem;
}

.gap-y-2 {
    row-gap: 0.5rem;
}

@media (min-width: 1024px) {
    .lg\:gap-6 {
        gap: 1.5rem;
    }
}

@media (min-width: 768px) {
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Dana FaNum maps latin digits onto Persian glyphs, which is wrong for
   e-mail addresses and other verbatim identifiers. */
.latin {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Unlike `break-words`, this also shrinks the element's min-content width,
   so a long e-mail address cannot widen its grid track. */
.break-anywhere {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/*------------------------------------------------------------------
    [2. Portrait treatment]
    ------------------------------------------------------------------*/

.hero-image img {
    display: block;
    width: 100%;
    height: auto;
    background-color: #fff;
    border-radius: 1rem;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
}

.minfo__sidebar .user-info img {
    -o-object-fit: cover;
       object-fit: cover;
    -o-object-position: center top;
       object-position: center top;
}

/*------------------------------------------------------------------
    [3. Section polish]
    ------------------------------------------------------------------*/

.logo-slider .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 3rem;
}

.skills-slider .swiper-slide .icon {
    min-height: 2.75rem;
}

/* The scrollspy marks a section active once its top reaches the top of the
   viewport. Removing the template's map left #contact shorter than one
   screen, so on tall viewports it could never scroll that far and the last
   nav item stayed dark. Give it a screen's worth of height. */
#contact {
    min-height: calc(100vh - 4rem);
}

/*------------------------------------------------------------------
    [4. Print stylesheet]
    ------------------------------------------------------------------*/

@media print {

    .minfo__nav__wrapper,
    .mobile-menu,
    .mobile-menu-bar,
    .menu-overlay,
    .bg-lines,
    .custom_cursor_one,
    .custom_cursor_two,
    #preloader,
    #scroll-top,
    .skills-slider-navigation,
    .logo-slider,
    #contact form,
    .buttons {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
        color: #000 !important;
    }

    .minfo__contentBox,
    .minfo__sidebar__wrapper {
        max-width: 100% !important;
        position: static !important;
        transform: none !important;
    }

    [data-scroll-index] > div {
        border: 1px solid #ddd !important;
        background: #fff !important;
        page-break-inside: avoid;
    }

    .text-black,
    .dark\:text-white,
    h1, h2, h3, h4, h5, h6 {
        color: #000 !important;
    }
}

/*------------------------------------------------------------------
    [5. Desktop layout: keep content clear of the fixed rails]
    The sidebar (right) and nav rail (left) are position:fixed from
    1280px up. The template sized the content box as if the page were
    LTR, so between 1280px and ~1900px the sidebar covered the hero.
    Reserve their width explicitly and centre sections in what is left.
    ------------------------------------------------------------------*/

@media (min-width: 1280px) {
    .minfo__contentBox {
        max-width: none;
        margin-left: 7.75rem;   /* nav rail: 1rem offset + 5.1rem rail + gap */
        margin-right: 22.5rem;  /* sidebar: 1rem offset + 20rem card + gap */
    }

    .minfo__contentBox > section,
    .minfo__contentBox > footer {
        margin-left: auto;
        margin-right: auto;
    }

    /* Never taller than the viewport; scroll inside instead of clipping. */
    .minfo__sidebar__wrapper {
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        scrollbar-width: none;
    }

    .minfo__sidebar__wrapper::-webkit-scrollbar {
        display: none;
    }
}

@media (min-width: 1536px) {
    .minfo__contentBox {
        margin-left: 10.5rem;   /* 3.5rem offset + rail + gap */
        margin-right: 28.5rem;  /* 3.5rem offset + 22.75rem card + gap */
    }
}

/* Short laptop screens (e.g. 1366x768 with browser chrome) */
@media (min-width: 1280px) and (max-height: 820px) {
    .minfo__sidebar .user-info {
        margin-top: 1.75rem;
    }

    .minfo__sidebar .user-info > a {
        width: 7rem;
        height: 7rem;
    }

    .minfo__sidebar .user-meta-info {
        margin-top: 1rem;
        margin-bottom: 1rem;
        padding-top: 1rem;
    }

    .minfo__sidebar .user-meta-info .space-y-3 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0.4rem;
    }
}

/* Short screens: the nav rail (menu + share + languages) must fit too */
@media (min-width: 1280px) and (max-height: 760px) {
    .minfo__nav__wrapper {
        gap: 0.5rem;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .minfo__nav__wrapper .menu {
        margin-top: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .minfo__nav__wrapper .menu .space-y-2 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0.25rem;
    }

    .minfo__nav__wrapper .lang-switch a {
        min-width: 1.9rem;
        height: 1.9rem;
    }
}

/*------------------------------------------------------------------
    [6. RTL fixes]
    Tailwind's space-x-* puts the gap on the left of each following
    sibling, which is the wrong side in RTL (icons touched their text).
    ------------------------------------------------------------------*/

[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]),
[dir="rtl"] .space-x-4 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

/*------------------------------------------------------------------
    [7. Language switcher]
    ------------------------------------------------------------------*/

.lang-switch {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    line-height: 1;
}

.lang-switch--vertical {
    flex-direction: column;
}

.lang-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.45rem;
    border: 1px solid #e5e5e5;
    border-radius: 9999px;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.lang-switch a[lang="fa"] {
    font-family: dana-3, Tahoma, sans-serif;
}

.dark .lang-switch a {
    border-color: #2f2f2f;
    color: #fff;
}

.lang-switch a:hover,
.lang-switch a:focus-visible,
.lang-switch a[aria-current="page"] {
    background-color: #00bc91;
    border-color: #00bc91;
    color: #fff;
}

/* Mobile top bar: name, switcher and hamburger on one line */
.mobile-menu-bar .name span {
    white-space: nowrap;
}

.mobile-menu-bar .name,
.mobile-menu-bar .name a {
    min-width: 0;
}

/* The Latin name is much wider than the Persian one: let it take two lines */
html[lang="en"] .mobile-menu-bar .name span {
    white-space: normal;
    font-size: 0.9rem;
    line-height: 1.15;
}

.mobile-menu-bar .lang-switch a {
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 0.3rem;
}

@media (max-width: 400px) {
    .mobile-menu-bar .name {
        font-size: 0.95rem;
    }

    .mobile-menu-bar .name img {
        width: 1.6rem;
        height: 1.6rem;
    }

    .mobile-menu-bar .hamburger {
        width: 2.75rem;
        height: 2.75rem;
    }
}

/*------------------------------------------------------------------
    [8. Per-language type]
    Dana FaNum draws Latin digits as Persian ones — right for fa, wrong
    for en/ar. English uses the system UI face; Arabic keeps Dana for
    Arabic letters only (font.css: dana-ar, unicode-range) so digits
    and Latin words fall through to the system face.
    ------------------------------------------------------------------*/

html[lang="en"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[lang="ar"] {
    font-family: dana-ar, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", sans-serif;
}

/* Visible keyboard focus */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #00bc91;
    outline-offset: 2px;
}
