/* =========================================================
   Tibiarok — shared site shell
   ---------------------------------------------------------
   Loaded by EVERY page right after css/vendor/bootstrap.min.css:

     index.html, en/index.html   (landing)    + css/style.css + css/mediaqueries.css
     docs/index.html             (Game Docs)  + docs/styles.css
     404.html
     downloads/, en/downloads/, jogar/, en/play/                + css/pages.css

   This file is the visual identity: palette, the gold pixel frame,
   the single responsive navbar with pill links, the double gold
   title rule and the translucent gold-bordered panel. Page layout
   stays in css/style.css (landing) and docs/styles.css (Game Docs).
   Image URLs are relative to this file (css/), so they resolve from
   any page depth. Behaviour for the navbar toggler lives in js/site.js.
   ========================================================= */

:root {
    --tr-navy: #081929;                 /* page background */
    --tr-gold: #dea84c;                 /* panel border */
    --tr-gold-line: #dda74c;            /* hr.stylish */
    --tr-panel-bg: rgba(0, 0, 0, 0.3);  /* translucent panel */
    --tr-nav-bg: rgba(0, 0, 0, 0.5);    /* navbar band */
    --tr-radius: 15px;
    --tr-text: #fafafa;
    --tr-text-muted: rgba(255, 255, 255, 0.65);
    /* The pixel frame scales as one piece: 1 on desktop, .75 on tablets, .5 on phones. */
    --frame-scale: 1;
}
@media (max-width: 991.98px) { :root { --frame-scale: 0.75; } }
@media (max-width: 575.98px) { :root { --frame-scale: 0.5; } }

html {
    min-width: 100%;
    min-height: 100%;
    scroll-behavior: smooth;
}
body {
    padding: 0;
    margin: 0;
    background-color: #081929;
}
button, a.btn, button:hover, a.btn:hover, a.btn:active, a.btn:visited, a.btn:not(:disabled):not(.disabled):active {
    border-radius: .25rem!important;
    border-color: transparent !important;
}

/* TITLE RULE — the double gold line under every section title */
hr.stylish {
    overflow: visible; /* For IE */
    height: 15px;
    border-style: solid;
    border-color: #dda74c;
    border-width: 1px 0 0 0;
    border-radius: 20px;
    margin-bottom: 0px;
    margin-top: 10px;
    width: 100%;
}

    hr.stylish:before { /* Not really supposed to work, but does */
        display: block;
        content: "";
        height: 15px;
        margin-top: -15px;
        border-style: solid;
        border-color: #dda74c;
        border-width: 0 0 1px 0;
        border-radius: 20px;
    }

/* PANEL — translucent box with the thin gold border.
   The landing uses it as `.row.content` inside `.container`;
   the Game Docs and 404 page use the standalone `.tr-panel` alias. */
.container .content, .tr-panel {
    padding: 8px 16px;
    border-radius: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid #dea84c;
}

/* FRAME — gold pixel-art border fixed around the viewport.
   All sizes are the artwork's natural size times --frame-scale. */
.frame {
    z-index: 1031;
    position: fixed;
    pointer-events: none;
}

#frame-left {
    left: 0;
    height: 100%;
    width: calc(15px * var(--frame-scale));
    background-image: url(../images/frame/frame-left.png);
    background-size: calc(12px * var(--frame-scale)) auto;
    image-rendering: pixelated;
    background-repeat-x: no-repeat;
    background-repeat-y: repeat;
}

#frame-right {
    right: -3px;
    height: 100%;
    width: calc(15px * var(--frame-scale));
    background-image: url(../images/frame/frame-right.png);
    background-size: calc(12px * var(--frame-scale)) auto;
    image-rendering: pixelated;
    background-repeat-x: no-repeat;
    background-repeat-y: repeat;

}

#frame-top {
    width: 100%;
    height: calc(42px * var(--frame-scale));
    background-image: url(../images/frame/frame-big-top.png);
    background-size: auto calc(40px * var(--frame-scale));
    image-rendering: pixelated;
    background-repeat-x: repeat;
    background-repeat-y: no-repeat;
}
#frame-top-left {
    top: 0;
    left: 0;
}
#frame-top-left img {
    width: calc(340px * var(--frame-scale));
    height: auto;
    image-rendering: pixelated;
}
#frame-top-right {
    top: 1px;
    right: 0;
}
#frame-top-right img {
    width: calc(150px * var(--frame-scale));
    height: auto;
    image-rendering: pixelated;
}

/* The corner logo IS the brand. This invisible link sits over its artwork
   so clicking the logo goes home from any page (the frame itself ignores clicks). */
.site-logo-link {
    position: fixed;
    top: 0;
    left: 0;
    width: calc(230px * var(--frame-scale));
    height: calc(140px * var(--frame-scale));
    z-index: 1032;
    display: block;
}

/* THE CURSOR — one gold cursor for the whole site, for whoever walks it by pad or keyboard: it travels from what had the focus to what has
   it now, as a game's menu cursor does, and draws above everything, so no panel clips it and no gold border hides it. It is Tibia's own
   target square in the colours of the frame (images/frame/focus-cursor.png, a 9-slice). All of it is CSS: it follows the focused element by
   anchor positioning, and scrolling needs nothing because it hangs from that element. anchor() ignores transforms, so nothing may lift or
   move a focused element (docs/styles.css reacts inside it instead). `#app` takes the focus on every route so that the page gets read, not
   so that it gets a cursor: tabindex="-1" is never this. A browser with no anchor positioning gets a plain gold ring. */
:focus-visible:not([tabindex="-1"]),
.pad-mode :focus:not([tabindex="-1"]) {
    outline: 3px solid #f6d57a;
    outline-offset: 3px;
}
@supports (anchor-name: --tr-cursor) {
    :focus-visible:not([tabindex="-1"]),
    .pad-mode :focus:not([tabindex="-1"]) {
        anchor-name: --tr-cursor;
        outline: none;
        animation: tr-cursor-strike .34s ease-out;
    }
    /* With nothing focused the anchor() fallbacks park it above the logo's corner, so the first press throws it out of there and losing the
       focus takes it home. Never show or hide it with :has(): restyling it in the frame the anchor moves makes it jump instead of glide. */
    body::after {
        --tr-cursor-gap: 6px;
        --tr-cursor-throw: .17s cubic-bezier(.2, 1.25, .4, 1); /* the small overshoot makes it feel thrown rather than slid */
        content: '';
        position: fixed;
        z-index: 1035; /* over the bar and the frame, under the pad's legend */
        position-anchor: --tr-cursor;
        top: calc(anchor(top, -60px) - var(--tr-cursor-gap));
        right: calc(anchor(right, 100vw) - var(--tr-cursor-gap));
        bottom: calc(anchor(bottom, 100vh) - var(--tr-cursor-gap));
        left: calc(anchor(left, -60px) - var(--tr-cursor-gap));
        box-sizing: border-box;
        border: 14px solid transparent;
        border-image: url(../images/frame/focus-cursor.png) 14 / 14px stretch;
        image-rendering: pixelated;
        box-shadow: 0 0 20px rgba(246, 213, 122, 0.28);
        pointer-events: none;
        transition: top var(--tr-cursor-throw), right var(--tr-cursor-throw), bottom var(--tr-cursor-throw), left var(--tr-cursor-throw);
        animation: tr-cursor-idle 1.1s step-end infinite;
    }
    /* Two frames, like the cursor of an old RPG. The handheld turns this and the strike off (docs/styles.css, .in-app). */
    @keyframes tr-cursor-idle {
        0% { border-image-outset: 0; }
        50% { border-image-outset: 2px; }
    }
    /* the light of the arrival, on what it arrived at */
    @keyframes tr-cursor-strike {
        from { filter: brightness(1.55); }
    }
    @media (prefers-reduced-motion: reduce) {
        :focus-visible:not([tabindex="-1"]),
        .pad-mode :focus:not([tabindex="-1"]) { animation: none; }
        body::after { transition: none; animation: none; }
    }
}

/* NAVBAR — one translucent band under the frame, bordered pill links,
   right-aligned so nothing sits under the corner logo. Collapses into a
   hamburger below its `navbar-expand-*` breakpoint (js/site.js toggles it). */
.site-nav.navbar {
    padding: calc(42px * var(--frame-scale) + 18px) 1rem .5rem;
    background: rgba(0,0,0,0.5);
    justify-content: flex-end;
}
.site-nav .navbar-toggler {
    margin: 0 24px 0 auto;
    border: 1px solid rgba(222, 168, 76, 0.6);
    background: rgba(0, 0, 0, 0.35);
}
.site-nav .navbar-toggler:focus { box-shadow: none; }
.site-nav .navbar-collapse {
    flex-grow: 0;
    justify-content: flex-end;
}
.site-nav .nav-pills {
    align-items: center;
    flex-wrap: nowrap;
}
/* Menu links: quiet text links with a gold underline — the ornate frame is the
   decoration, so the menu stays flat. Active page = gold text + gold line. */
.nav-item:last-child {
    padding-right: 24px;
}
.site-nav .nav-pills .nav-link,
.nav-link.secondary {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #e9e4d6;
    font-weight: 500;
    letter-spacing: .02em;
    padding: .55rem .9rem .45rem;
    margin-left: 4px;
    border-bottom: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.site-nav .nav-pills .nav-link:hover,
.site-nav .nav-pills .nav-link:focus {
    color: #fff;
    border-bottom-color: rgba(222, 168, 76, 0.5);
    text-decoration: none;
}
.site-nav .nav-pills .nav-link.active,
.nav-link.secondary.active {
    color: #f6d57a;
    background: transparent;
    border-bottom-color: var(--tr-gold);
}
button.nav-link {
    background: transparent;
    cursor: pointer;
    font: inherit;
}
.site-nav .nav-pills .nav-link.lang-switch {
    margin-left: 12px;
    padding: .3rem .6rem;
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    border: 1px solid rgba(222, 168, 76, 0.5);
    border-radius: 4px;
    color: #e9e4d6;
}
.site-nav .nav-pills .nav-link.lang-switch:hover { border-color: var(--tr-gold); color: #fff; }
.site-nav .nav-item .btn { margin-left: 14px; }

/* BUTTONS — one gold primary and one dark "ghost" secondary, on every page.
   Bootstrap's blue .btn-primary is remapped so page scripts can keep using it. */
.btn-primary, .btn-gold {
    color: #1a0f00 !important;
    background: linear-gradient(180deg, #f6d57a 0%, #dea84c 60%, #c28a2a 100%);
    box-shadow: 0 2px 10px rgba(222, 168, 76, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    font-weight: 600;
}
.btn-primary:hover, .btn-gold:hover,
.btn-primary:focus, .btn-gold:focus,
.btn-primary:not(:disabled):not(.disabled):active, .btn-gold:not(:disabled):not(.disabled):active {
    color: #000 !important;
    background: linear-gradient(180deg, #ffe08f 0%, #e6b25a 60%, #c99232 100%);
    box-shadow: 0 0 0 .2rem rgba(222, 168, 76, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary.disabled, .btn-primary:disabled, .btn-gold.disabled {
    background: linear-gradient(180deg, #f6d57a 0%, #dea84c 60%, #c28a2a 100%);
    opacity: .55;
}
.btn-ghost {
    color: #fafafa !important;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(222, 168, 76, 0.55) !important;
}
.btn-ghost:hover, .btn-ghost:focus {
    color: #fff !important;
    background: rgba(222, 168, 76, 0.14);
    border-color: var(--tr-gold) !important;
    box-shadow: none;
}
/* Search box inside the navbar (Game Docs) */
.site-nav .nav-search .form-control {
    width: 170px;
    margin-left: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(222, 168, 76, 0.5);
    color: #fff;
}
.site-nav .nav-search .form-control::placeholder { color: rgba(255, 255, 255, 0.55); }
.site-nav .nav-search .form-control:focus {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--tr-gold);
    color: #fff;
    box-shadow: 0 0 0 .2rem rgba(222, 168, 76, 0.25);
}

/* Collapsed state (below the page's navbar-expand-* breakpoint):
   the menu opens as a vertical list inside the same band. */
.site-nav .navbar-collapse:not(.show):not(.collapsing) { display: none; }
@media (max-width: 1199.98px) {
    .site-nav.navbar-expand-xl .navbar-collapse { flex-basis: 100%; margin-top: 10px; }
    .site-nav.navbar-expand-xl .nav-pills { flex-direction: column; align-items: stretch; width: 100%; }
    .site-nav.navbar-expand-xl .nav-item { padding-right: 0; }
    .site-nav.navbar-expand-xl .nav-item a, .site-nav.navbar-expand-xl .nav-item .nav-link { margin: 4px 0; display: block; text-align: center; }
    .site-nav.navbar-expand-xl .nav-item button.nav-link { width: 100%; }
    .site-nav.navbar-expand-xl .nav-item .btn { margin: 10px 0 4px; }
    .site-nav.navbar-expand-xl .nav-search { padding: 4px 0; }
    .site-nav.navbar-expand-xl .nav-search .form-control { width: 100%; margin: 0; }
}
@media (max-width: 991.98px) {
    /* on a short screen the open menu scrolls on its own, down to its last button */
    .site-nav.navbar-expand-lg .navbar-collapse { flex-basis: 100%; margin-top: 10px; max-height: calc(100vh - 110px); max-height: calc(100svh - 110px); overflow-y: auto; overscroll-behavior: contain; }
    .site-nav.navbar-expand-lg .nav-pills { flex-direction: column; align-items: stretch; width: 100%; }
    .site-nav.navbar-expand-lg .nav-item { padding-right: 0; }
    .site-nav.navbar-expand-lg .nav-item a, .site-nav.navbar-expand-lg .nav-item .nav-link { margin: 4px 0; display: block; text-align: center; }
    .site-nav.navbar-expand-lg .nav-item .btn { margin: 10px 0 4px; }
}
/* Expanded state: Bootstrap shows .navbar-collapse at the breakpoint; keep it in one row. */
@media (min-width: 992px) {
    .site-nav.navbar-expand-lg .navbar-collapse { display: flex !important; }
}
@media (min-width: 1200px) {
    .site-nav.navbar-expand-xl .navbar-collapse { display: flex !important; }
}

/* FOOTER — shared by every page */
.site-foot {
    border-top: 1px solid rgba(222, 168, 76, 0.35);
    padding: 18px 0 40px;
    font-size: .85rem;
    color: var(--tr-text-muted);
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
}
.site-foot .container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.site-foot a { color: var(--tr-text); }
.site-foot a:hover { color: #fff; }
.site-foot .foot-social img { width: 22px; height: 22px; vertical-align: -6px; margin-right: 6px; }

/* SEARCH DROPDOWN (Game Docs navbar): the box grows on focus, results list under it */
.site-nav .nav-search { position: relative; }
.site-nav .nav-search .form-control { transition: width .2s ease; }
@media (min-width: 1200px) {
    .site-nav .nav-search .form-control:focus { width: 260px; }
}
.nav-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1040;
    padding: 6px;
    background: rgba(5, 15, 26, 0.97);
    border: 1px solid rgba(222, 168, 76, 0.55);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
    text-align: left;
}
.nav-search-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    color: #fafafa;
    text-decoration: none;
}
.nav-search-item:hover, .nav-search-item.is-active { background: rgba(222, 168, 76, 0.14); color: #fff; text-decoration: none; }
.nav-search-art { display: block; width: 32px; height: 32px; object-fit: cover; border-radius: 4px; background: rgba(0, 0, 0, 0.4); }
.nav-search-text { display: flex; flex-direction: column; min-width: 0; }
.nav-search-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-search-label mark { background: transparent; color: #f6d57a; padding: 0; }
.nav-search-sub { font-size: .75rem; color: rgba(255, 255, 255, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-search-all, .nav-search-empty {
    display: block;
    margin-top: 4px;
    padding: 8px;
    font-size: .8rem;
    color: #e9e4d6;
    text-align: center;
    border-top: 1px solid rgba(222, 168, 76, 0.25);
}
.nav-search-all:hover { color: #fff; text-decoration: none; }
@media (max-width: 1199.98px) {
    .nav-search-results { position: static; width: 100%; max-height: 50vh; margin-top: 6px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
