/* =========================================================
   RESET
   ========================================================= */

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

/* =========================================================
   BASE LAYOUT
   ========================================================= */

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 100vh;
}

body.petition-modal-open {
    overflow: hidden;
}

header {
    text-align: center;
    padding: 1rem;
    line-height: 1.2;
}

main {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem;
}

/* =========================================================
   PETITION ENTRY
   ========================================================= */

.petition-entry {
    width: min(100%, 980px);
    margin: 0 auto 1rem;
    padding: 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #e7f5df, #f7fff2);
    border: 1px solid rgba(27, 77, 62, 0.18);
    box-shadow: 0 10px 26px rgba(27, 77, 62, 0.08);
    text-align: center;
}

.petition-entry h2 {
    color: #1b4d3e;
    font-size: clamp(1.05rem, 2vw, 1.45rem);
    margin-bottom: 0.45rem;
}

.petition-entry p {
    color: #34483f;
    line-height: 1.45;
    margin-bottom: 0.8rem;
}

.petition-open {
    border: 0;
    border-radius: 999px;
    background: #1b4d3e;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0.75rem 1.2rem;
    box-shadow: 0 8px 20px rgba(27, 77, 62, 0.18);
}

.petition-open:hover {
    background: #143a2f;
}

/* =========================================================
   PETITION MODAL
   ========================================================= */

.petition-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(14, 24, 20, 0.68);
}

.petition-modal[hidden] {
    display: none;
}

.petition-modal-card {
    position: relative;
    width: min(100%, 1080px);
    height: min(88vh, 860px);
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
}

.petition-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: #1b4d3e;
    color: #ffffff;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.petition-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

/* =========================================================
   INFO PORTAL
   ========================================================= */

.info-portal {
    width: min(100%, 1360px);
    display: grid;
    gap: 0.8rem;
}

.info-portal.no-overflow .carousel-nav,
.info-portal.no-overflow .tile-dots {
    visibility: hidden;
    pointer-events: none;
}

/* =========================================================
   CAROUSEL
   ========================================================= */

.carousel-frame {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
}

.carousel-nav {
    width: 44px;
    height: 64px;
    border-radius: 999px;
    font-size: 2.2rem;
    line-height: 1;
}

.carousel-nav:hover {
    background: #ffffff;
}

/* =========================================================
   TILE TRACK
   ========================================================= */

.tile-track {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    cursor: grab;
    padding: 1.15rem 1.4rem 1.35rem;
    touch-action: pan-y;
    user-select: none;
}

.tile-track::-webkit-scrollbar {
    display: none;
}

.tile-track.no-overflow {
    justify-content: center;
    cursor: default;
    overflow: visible;
}

.tile-track.is-dragging {
    cursor: grabbing;
}

.tile-shell {
    flex: 0 0 clamp(350px, 28vw, 440px);
    padding: 2.1rem 1.2rem;
    scroll-snap-align: center;
}

/* =========================================================
   TILE CARD
   ========================================================= */

.tile {
    width: 100%;
    height: clamp(340px, 48vw, 400px);
    border-radius: 12px;
    position: relative;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
    cursor: pointer;
    transform: rotate(-8deg);
    transform-origin: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    background: var(--tile-bg);
    border: 1px solid rgba(27, 77, 62, 0.18);
}

.tile:hover,
.tile:focus-visible {
    transform: rotate(-8deg) translateY(-6px) scale(1.025);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
    border-color: rgba(27, 77, 62, 0.34);
    outline: none;
}

.tile.is-disabled {
    filter: grayscale(0.9);
    opacity: 0.55;
}

/* =========================================================
   TILE CONTENT
   ========================================================= */

.tile-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    color: #2c3e50;
    line-height: 1.2;
    padding: 2rem 2rem 2.3rem;
    font-size: 0.8rem;
    transform: rotate(8deg);
    transform-origin: center;
}

.tile-content h2 {
    font-size: clamp(1rem, 1.7vw, 1.22rem);
    margin-bottom: 0.55rem;
    color: #1b4d3e;
}

.tile-content p {
    margin-bottom: 0.45rem;
    font-size: clamp(0.78rem, 1.25vw, 0.9rem);
}

.tile-content strong {
    font-weight: 700;
}

.tile-content u {
    text-underline-offset: 0.12em;
}

.tile-content .source-line {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: #42524b;
}

/* =========================================================
   TILE CONTROLS
   ========================================================= */

.tile-controls {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 2;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    transform: rotate(8deg);
    transform-origin: center;
}

.tile-controls button {
    min-height: 2rem;
    border-radius: 999px;
    padding: 0 0.75rem;
    font-weight: 700;
}

.tile-controls button:hover {
    background: #ffffff;
}
.tile-pdf-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: #123d26;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.tile-pdf-button:hover {
    filter: brightness(1.08);
}
/* =========================================================
   SHARED BUTTON STYLE
   ========================================================= */

.tile-controls button,
.carousel-nav,
.tile-dot,
.dialog-close {
    border: 0;
    background: rgba(255, 255, 255, 0.84);
    color: #1b4d3e;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* =========================================================
   TILE DOTS
   ========================================================= */

.tile-dots {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    min-height: 20px;
}

.tile-dot {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    padding: 0;
    background: #c6cec2;
    box-shadow: none;
}

.tile-dot.is-active {
    background: #1b4d3e;
}

/* =========================================================
   MANAGE TOOLBAR
   ========================================================= */

.manage-toolbar {
    display: flex;
    justify-content: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.manage-toolbar[hidden] {
    display: none;
}

.manage-toolbar button,
.manage-toolbar a {
    border: 0;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    background: #1b4d3e;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
}

/* =========================================================
   DIALOG
   ========================================================= */

.tile-dialog {
    border: 0;
    border-radius: 10px;
    padding: 0;
    max-width: min(92vw, 720px);
    width: 720px;
    color: #25302c;
    background: transparent;
}

.tile-dialog::backdrop {
    background: rgba(18, 28, 24, 0.58);
}

.dialog-card {
    position: relative;
    border-radius: 10px;
    background: #ffffff;
    padding: 2.2rem;
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.24);
    max-height: 86vh;
    overflow: auto;
}

.dialog-card h2 {
    color: #1b4d3e;
    margin-bottom: 1rem;
}

.dialog-body p {
    margin-bottom: 0.9rem;
    line-height: 1.55;
}

.dialog-link {
    display: inline-flex;
    margin-top: 0.5rem;
    color: #1b4d3e;
    font-weight: 700;
}

.dialog-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    font-size: 1.3rem;
}

.dialog-close:hover {
    background: #ffffff;
}

/* =========================================================
   EDIT CARD
   ========================================================= */

.edit-card {
    display: grid;
    gap: 0.8rem;
}

.edit-card label {
    display: grid;
    gap: 0.35rem;
    font-weight: 700;
    color: #2d3a35;
}

.edit-card input,
.edit-card textarea {
    width: 100%;
    border: 1px solid #cfd8ca;
    border-radius: 8px;
    padding: 0.7rem;
    font: inherit;
}

.format-toolbar {
    display: flex;
    gap: 0.35rem;
}

.format-toolbar button {
    width: 2.2rem;
    height: 2rem;
    border: 1px solid #cfd8ca;
    border-radius: 7px;
    background: #f7faf5;
    color: #1b4d3e;
    cursor: pointer;
}

.edit-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.edit-actions button {
    border: 0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    background: #1b4d3e;
    color: #ffffff;
    cursor: pointer;
}

.format-hint {
    color: #5d6964;
    font-size: 0.86rem;
    line-height: 1.35;
}

/* =========================================================
   INFO BOX / CONTACT
   ========================================================= */

.info-box {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 600px;
    margin: 2rem auto;
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    text-align: center;
}

.info-box h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1b4d3e;
}

.info-box p {
    margin-bottom: 1rem;
}

.info-box a {
    color: #4caf50;
    text-decoration: none;
}

.info-box a:hover {
    text-decoration: underline;
}

.info-box form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-box form label {
    font-size: 1rem;
    text-align: left;
    margin-bottom: 0.2rem;
    color: #555;
}

.info-box form input,
.info-box form textarea {
    font-size: 1rem;
    padding: 0.5rem;
    border: 1px solid #dddddd;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

.info-box form textarea {
    height: 100px;
    resize: none;
}

.info-box form button {
    padding: 0.7rem;
    background-color: #4caf50;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.info-box form button:hover {
    background-color: #45a049;
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
    text-align: center;
    padding: 1rem;
    background-color: #333333;
    color: #ffffff;
    width: 100%;
}

footer a {
    color: #4caf50;
    margin: 0 0.5rem;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 720px) {
    header {
        padding-top: 0.75rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    main {
        padding: 0.65rem 0;
    }

    .carousel-frame {
        grid-template-columns: minmax(0, 1fr);
    }

    .carousel-nav {
        display: none;
    }

    .tile-track {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0.8rem 5vw 1.15rem;
    }

    .tile-shell {
        flex-basis: 90vw;
        padding: 2rem 0.9rem;
    }

    .tile {
        height: min(72vh, 420px);
    }

    .tile-content {
        padding: 2.5rem 1.25rem 1.4rem;
    }

    .tile-dialog {
        width: 92vw;
    }

    .dialog-card {
        padding: 1.5rem;
    }
}
