/* ===== RESET ===== */
:root {
    --page-bg: #f7f3ed;
    --surface: #fffdf9;
    --header-bg: #f1e4d4;
    --header-bg-compact: rgba(241, 228, 212, 0.66);
    --header-bg-mobile: rgba(241, 228, 212, 0.95);
    --header-bg-mobile-compact: rgba(241, 228, 212, 0.52);
    --text: #252321;
    --heading: #211f1c;
    --subheading: #332d27;
    --muted: #675f56;
    --accent: #a8764b;
    --accent-dark: #825a38;
    --line: #dfd2c3;
    --shadow: 0 10px 28px rgba(49, 38, 28, 0.09);
    --dark-bg-y: 0%;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --page-bg: #11100f;
    --surface: rgba(31, 28, 25, 0.82);
    --header-bg: rgba(29, 25, 22, 0.78);
    --header-bg-compact: rgba(29, 25, 22, 0.58);
    --header-bg-mobile: rgba(29, 25, 22, 0.88);
    --header-bg-mobile-compact: rgba(29, 25, 22, 0.58);
    --text: #f4eee6;
    --heading: #fff7ee;
    --subheading: #f1dfca;
    --muted: #d2c2b0;
    --accent: #d1a06f;
    --accent-dark: #b98252;
    --line: rgba(226, 202, 175, 0.28);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--page-bg);
}

body {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    font-family: "Lato", Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--page-bg);
}

:root[data-theme="dark"] body {
    background-color: transparent;
}

:root[data-theme="dark"] body::before,
:root[data-theme="dark"] body::after {
    content: "";
    position: fixed;
    inset: -18px;
    pointer-events: none;
}

:root[data-theme="dark"] body::before {
    z-index: 0;
    background-image: url("background_dark_mode.png");
    background-repeat: no-repeat;
    background-position: center var(--dark-bg-y);
    background-size: cover;
    filter: blur(7px);
    transform: scale(1.04);
    opacity: 0.72;
}

:root[data-theme="dark"] body::after {
    z-index: 0;
    background: rgba(14, 12, 10, 0.58);
}

body > * {
    position: relative;
    z-index: 1;
}

/* ===== GLOBAL ===== */
section {
    padding: 60px 20px;
    max-width: 1100px;
    margin: 0 auto;
}

h1, h2, h3 {
    margin-bottom: 15px;
}

h1, h2, h3 {
    line-height: 1.2;
}

h2 {
    color: var(--heading);
    font-weight: 900;
}

h3 {
    color: var(--subheading);
}

p {
    margin-bottom: 15px;
    color: var(--muted);
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== NAVBAR ===== */
header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

header.is-compact {
    background: var(--header-bg-compact);
    box-shadow: 0 8px 22px rgba(49, 38, 28, 0.08);
}

header.is-compact nav {
    padding-top: 6px;
    padding-bottom: 6px;
}

header.is-compact .brand-logo {
    width: 56px;
}

nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: padding 0.25s ease, gap 0.25s ease;
}

nav h1 {
    margin-bottom: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    display: block;
    width: 86px;
    height: auto;
    transition: width 0.25s ease;
}

.form-disabled {
  position: relative;
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.overlay {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,0.4);
  font-size: 20px;
  font-weight: bold;
  backdrop-filter: blur(2px);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.nav-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

nav a {
    transition: color 0.2s ease;
}

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

.theme-toggle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 253, 249, 0.6);
    color: var(--text);
    box-shadow: 0 6px 16px rgba(49, 38, 28, 0.08);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
}

.theme-toggle-icon {
    display: block;
    font-size: 19px;
    line-height: 1;
}

:root[data-theme="dark"] .theme-toggle {
    background: rgba(31, 28, 25, 0.72);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

/* ===== HERO ===== */
#hero {
    text-align: center;
    padding: 110px 20px 95px;
}

#hero h2 {
    font-size: 32px;
    margin-bottom: 18px;
}

#hero p {
    max-width: 600px;
    margin: 0 auto 20px;
}

#hero a {
    display: inline-block;
    padding: 12px 25px;
    background: var(--accent);
    color: white;
    border-radius: 5px;
    transition: 0.3s;
    font-weight: 700;
}

#hero a:hover {
    background: var(--accent-dark);
}

/* ===== OFERTA ===== */
#oferta article {
    position: relative;
    background: rgba(255, 253, 249, 0.6);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
    cursor: default;
    margin-bottom: 30px;
}

:root[data-theme="dark"] #oferta article {
    background: rgba(31, 28, 25, 0.66);
}

#oferta article::before {
    content: "";
    position: absolute;
    top: 24px;
    left: 0;
    width: 3px;
    height: 38px;
    border-radius: 0 4px 4px 0;
    background: rgba(168, 118, 75, 0.48);
}

#oferta article h3 {
    margin-bottom: 10px;
}

#oferta article p {
    margin-bottom: 0;
}

#oferta h2 {
    grid-column: 1 / -1;
}

/* ===== REALIZACJE ===== */
#realizacje {
    display: block;
}

#realizacje article {
    background: var(--surface);
    padding: 10px;
    border-radius: 8px;
}

#realizacje img {
    width: 100%;
    border-radius: 5px;
}

.portfolio-preview {
    display: block;
    position: relative;
    border-radius: 8px;
    outline-offset: 5px;
    transition: transform 0.2s ease;
}

.portfolio-preview:hover,
.portfolio-preview:focus-visible {
    transform: translateY(-3px);
}

.portfolio-preview:hover .auto-carousel,
.portfolio-preview:focus-visible .auto-carousel {
    border-color: rgba(168, 118, 75, 0.72);
    box-shadow: 0 14px 36px rgba(49, 38, 28, 0.16);
}

.portfolio-preview:hover .portfolio-cta,
.portfolio-preview:focus-visible .portfolio-cta {
    background: var(--accent-dark);
}

.portfolio-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-weight: 900;
}

.portfolio-cta::after {
    content: ">";
    font-size: 18px;
    line-height: 1;
}

.portfolio-cta {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    padding: 10px 14px;
    border-radius: 5px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 18px rgba(49, 38, 28, 0.22);
    transition: background-color 0.2s ease;
}

.auto-carousel {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-slide {
    min-width: 100%;
}

.carousel-slide img {
    display: block;
    width: 100%;
    height: 420px;
    object-fit: cover;
}

.carousel-slide p {
    padding: 15px;
    margin-bottom: 0;
    font-weight: bold;
}

.gallery-page {
    background-color: var(--page-bg);
}

.gallery-nav {
    min-height: 62px;
}

.gallery-nav h1 {
    margin-bottom: 0;
}

.back-link {
    display: inline-block;
    padding: 8px 14px;
    background: var(--accent);
    color: white;
    border-radius: 5px;
}

.back-link:hover {
    background: var(--accent-dark);
    color: white;
}

.gallery-page header nav a {
    font-weight: bold;
}

.realization-side-nav {
    display: none;
    position: fixed;
    top: 92px;
    right: 20px;
    z-index: 900;
    width: 240px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.realization-side-nav nav {
    display: block;
    max-width: none;
    padding: 0;
}

.realization-side-nav h2 {
    margin-bottom: 12px;
    font-size: 18px;
}

.realization-side-nav ul {
    display: grid;
    gap: 10px;
    list-style: none;
}

.realization-side-nav a {
    display: block;
    font-size: 14px;
    line-height: 1.35;
}

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

.realization-section {
    max-width: 1100px;
    padding: 70px 20px;
}

.realization-section + .realization-section {
    border-top: 1px solid var(--line);
}

.realization-section h2 {
    margin-bottom: 25px;
}

.realization-carousel .carousel-slide img {
    height: 620px;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    background: rgba(168, 118, 75, 0.92);
}

.carousel-button:hover {
    background: rgba(130, 90, 56, 0.95);
}

.carousel-button.prev {
    left: 15px;
}

.carousel-button.next {
    right: 15px;
}

/* ===== WSPÓŁPRACA ===== */
#wspolpraca ol {
    padding-left: 20px;
}

/* ===== KONTAKT ===== */
form {
    margin-top: 20px;
}

input, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
}

input:focus, textarea:focus {
    border-color: var(--accent);
    outline: 2px solid rgba(168, 118, 75, 0.18);
}

.optional-field {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

button {
    padding: 12px 20px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    background: var(--accent-dark);
}

button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.form-status {
    min-height: 24px;
    margin-top: 12px;
    margin-bottom: 0;
    font-weight: 700;
}

.form-status.success {
    color: #2f6f45;
}

.form-status.error {
    color: #9f2f2f;
}

.form-status.loading {
    color: var(--muted);
}

/* ===== MATERIAŁY ===== */
.materials-section {
    max-width: 1100px;
    padding-top: 35px;
    padding-bottom: 35px;
    text-align: center;
}

.materials-section h2 {
    margin-bottom: 8px;
    font-size: 24px;
}

.materials-section p {
    max-width: 620px;
    margin: 0 auto 22px;
    font-size: 15px;
}

.secret-game-link {
    color: inherit;
}

.logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 18px 28px;
    padding: 22px;
    background: rgba(255, 253, 249, 0.58);
    border: 1px solid rgba(223, 210, 195, 0.7);
    border-radius: 8px;
}

:root[data-theme="dark"] .logos {
    background: rgba(31, 28, 25, 0.58);
    border-color: var(--line);
}

.logos img {
    display: block;
    max-width: 120px;
    max-height: 42px;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.68;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.logos img:hover {
    filter: grayscale(0);
    opacity: 0.95;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 20px;
    background: var(--header-bg);
    margin-top: 40px;
}

/* ===== RESPONSYWNOŚĆ ===== */
@media (min-width: 768px) {

    #hero h2 {
        font-size: 42px;
    }

    #oferta {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }

    .carousel-slide img {
        height: 520px;
    }

}

@media (min-width: 1024px) {

    #oferta {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .preview-carousel .carousel-slide img {
        height: 580px;
    }

    .realization-side-nav {
        display: block;
    }

    .gallery-page main {
        padding-right: 280px;
    }

    .gallery-page .realization-section {
        max-width: 980px;
    }

}

@media (max-width: 767px) {

    header {
        background: var(--header-bg-mobile);
    }

    header.is-compact {
        background: var(--header-bg-mobile-compact);
    }

    header.is-compact nav {
        padding-top: 4px;
        padding-bottom: 4px;
        gap: 8px;
    }

    header.is-compact .brand-logo {
        width: 28px;
    }

    header.is-compact nav ul {
        gap: 10px;
    }

    header.is-compact nav a {
        font-size: 13px;
    }

    nav {
        align-items: center;
        gap: 10px;
        flex-direction: row;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    nav ul {
        min-width: 0;
        flex: 1;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    nav ul::-webkit-scrollbar {
        display: none;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
    }

    .theme-toggle-icon {
        font-size: 17px;
    }

    nav li {
        flex: 0 0 auto;
    }

    nav a {
        font-size: 14px;
        white-space: nowrap;
    }

    .portfolio-cta {
        top: 12px;
        right: 12px;
        padding: 8px 11px;
        font-size: 14px;
    }

    .gallery-page .gallery-nav {
        align-items: center;
        flex-direction: row;
        gap: 12px;
        min-height: 56px;
        padding: 10px 20px;
    }

    .gallery-page .gallery-nav h1 {
        line-height: 1;
    }

    .brand-logo {
        width: 50px;
    }

    .gallery-page .back-link {
        padding: 7px 12px;
        white-space: nowrap;
    }

    .carousel-slide img,
    .realization-carousel .carousel-slide img {
        height: 320px;
    }

    .carousel-button {
        width: 38px;
        height: 38px;
        font-size: 24px;
    }

    .materials-section {
        padding-top: 28px;
        padding-bottom: 28px;
    }

    .logos {
        gap: 16px 22px;
        padding: 18px;
    }

    .logos img {
        max-width: 96px;
        max-height: 34px;
    }

}
