/* ═══════════════════════════════════════════════════════════════
   Tworzymy Seul v1.5 — Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
    --pal-0:      #1f4fbe;
    --pal-1:      #e11e2c;
    --pal-2:      #f6ef97;
    --pal-0-text: #ffffff;
    --pal-1-text: #ffffff;
    --pal-2-text: #1a1a1a;

    --hex-form-bg:  #f8f7ff;
    --hex-border:   #e0dff5;
    --hex-input-bg: #ffffff;
    --hex-label:    #4b4b6b;
    --hex-radius:   8px;
    --hex-shadow:   0 4px 20px rgba(31,79,190,.13);
}

/* ── Wrapper ─────────────────────────────────────────────────── */
.hex-wrap { max-width: 1200px; margin: 0 auto; padding: 32px 16px; font-family: inherit; }

/* ── Form ────────────────────────────────────────────────────── */
.hex-form-container {
    background: var(--hex-form-bg);
    border: 1px solid var(--hex-border);
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 56px;
    box-shadow: var(--hex-shadow);
}
.hex-form-title    { margin: 0 0 8px; font-size: 1.75rem; color: #1e1b4b; }
.hex-form-subtitle { margin: 0 0 28px; color: #6b7280; font-size: .97rem; line-height: 1.7; max-width: 660px; }

.hex-names-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(175px,1fr)); gap: 16px; margin-bottom: 20px; }
.hex-field { display: flex; flex-direction: column; gap: 6px; }
.hex-field--email   { max-width: 380px; margin-bottom: 16px; }
.hex-field--diocese { max-width: 380px; margin-bottom: 20px; }

.hex-field select {
    padding: 10px 14px; border: 1.5px solid var(--hex-border); border-radius: var(--hex-radius);
    background: var(--hex-input-bg); font-size: .97rem; color: #1f2937;
    transition: border-color .2s, box-shadow .2s; outline: none;
    cursor: pointer; appearance: auto; width: 100%;
}
.hex-field select:focus { border-color: var(--pal-0); box-shadow: 0 0 0 3px rgba(31,79,190,.15); }

.hex-optional { font-weight: 400; font-size: .75rem; color: #9ca3af; text-transform: none; letter-spacing: 0; }
.hex-field label { font-size: .82rem; font-weight: 600; color: var(--hex-label); text-transform: uppercase; letter-spacing: .04em; }
.hex-field input[type="text"],
.hex-field input[type="email"] {
    padding: 10px 14px; border: 1.5px solid var(--hex-border); border-radius: var(--hex-radius);
    background: var(--hex-input-bg); font-size: .97rem; color: #1f2937;
    transition: border-color .2s, box-shadow .2s; outline: none;
}
.hex-field input:focus       { border-color: var(--pal-0); box-shadow: 0 0 0 3px rgba(31,79,190,.15); }
.hex-field input.hex-invalid { border-color: #ef4444; }
.hex-field--consent { margin-bottom: 24px; }
.hex-checkbox-label { display:flex; align-items:flex-start; gap:10px; cursor:pointer; font-size:.85rem; color:#6b7280; line-height:1.5; }
.hex-checkbox-label input[type="checkbox"] { margin-top:2px; flex-shrink:0; accent-color:var(--pal-0); width:16px; height:16px; }

.hex-submit-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--pal-0); color: #fff; border: none;
    padding: 13px 32px; border-radius: 50px; font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: background .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 4px 14px rgba(31,79,190,.35);
}
.hex-submit-btn:hover:not(:disabled) { background: #163a9c; transform: translateY(-1px); }
.hex-submit-btn:disabled { opacity:.7; cursor:not-allowed; }

.hex-message { padding:12px 18px; border-radius:var(--hex-radius); margin-bottom:20px; font-size:.92rem; }
.hex-message--success { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.hex-message--error   { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }

/* ═══════════════════════════════════════════════════════════════
   HONEYCOMB GRID
   Flat-top hexagons. All sizing & positioning done by JS.
   Font sizes are set in px by JS → immune to OS/browser scaling.
   ═══════════════════════════════════════════════════════════════ */
.hex-grid {
    position: relative;
    width: 100%;
}

.hex-tile {
    position: absolute;
    left: var(--hx-cx, 0px);
    top:  var(--hx-cy, 0px);
    transform: translate(-50%, -50%);
}

/* Flat-top clip-path */
.hex-tile__inner {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-sizing: border-box;
    /* padding set inline by JS relative to tile size */
    transition: transform .25s ease, filter .25s ease;
    cursor: default;
    overflow: hidden;
}

/* Palette */
.hex-tile[data-gc="0"] .hex-tile__inner { background: var(--pal-0); }
.hex-tile[data-gc="1"] .hex-tile__inner { background: var(--pal-1); }
.hex-tile[data-gc="2"] .hex-tile__inner { background: var(--pal-2); }

.hex-tile[data-gc="0"] .hex-tile__number,
.hex-tile[data-gc="0"] .hex-tile__name  { color: var(--pal-0-text); }
.hex-tile[data-gc="1"] .hex-tile__number,
.hex-tile[data-gc="1"] .hex-tile__name  { color: var(--pal-1-text); }
.hex-tile[data-gc="2"] .hex-tile__number,
.hex-tile[data-gc="2"] .hex-tile__name  { color: var(--pal-2-text); }

.hex-tile:hover .hex-tile__inner { transform: scale(1.07); filter: brightness(1.08); z-index: 10; }

/* Text — sizes set in px by JS, not em/rem, so browser zoom doesn't break layout */
.hex-tile__number {
    font-weight: 800;
    opacity: .85;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 3px;
    flex-shrink: 0;
    white-space: nowrap;
}
.hex-tile__names {
    display: flex; flex-direction: column; align-items: center;
    gap: 1px; width: 82%;
    overflow: visible;
    padding-bottom: 4px;
}
.hex-tile__name {
    font-weight: 700; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.35;
}

/* entry animation */
.hex-tile--new .hex-tile__inner { animation: hexPop .5s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes hexPop {
    from { transform: scale(0) rotate(-15deg); opacity:0; }
    to   { transform: scale(1) rotate(0deg);   opacity:1; }
}

.hex-empty-note { text-align:center; color:#9ca3af; font-style:italic; margin-top:8px; }

/* ── Form responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .hex-form-container { padding: 24px 16px; }
    .hex-names-grid { grid-template-columns: 1fr 1fr; }
    .hex-form-title { font-size: 1.35rem; }
}

/* ── Required / optional indicators ─────────────────────────── */
.hex-required {
    color: #e11e2c;
    font-weight: 700;
    margin-left: 2px;
}
.hex-optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: .8em;
    margin-left: 4px;
}
.hex-field-hint {
    display: block;
    font-size: .78rem;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 5px;
}
.hex-legend {
    margin: 12px 0 0;
    font-size: .8rem;
    color: #9ca3af;
}


/* ═══════════════════════════════════════════════════════════════
   MODE SELECTOR — duże karty
   ═══════════════════════════════════════════════════════════════ */
.hex-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 36px;
}

.hex-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 28px 24px 24px;
    border: 2px solid var(--hex-border);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;        /* failsafe — nothing escapes */
}

.hex-mode-btn:hover {
    background: var(--pal-0);
    border-color: var(--pal-0);
    box-shadow: 0 8px 28px rgba(31,79,190,.25);
    transform: translateY(-3px);
}
.hex-mode-btn:hover .hex-mode-btn__title,
.hex-mode-btn:hover .hex-mode-btn__sub {
    color: #fff;
}

.hex-mode-btn--solo:hover {
    background: var(--pal-1);
    border-color: var(--pal-1);
    box-shadow: 0 8px 28px rgba(225,30,44,.25);
}
.hex-mode-btn--solo:hover .hex-mode-btn__title,
.hex-mode-btn--solo:hover .hex-mode-btn__sub {
    color: #fff;
}

.hex-mode-btn__icon {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 12px;
    display: block;
}

.hex-mode-btn__title {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #1e1b4b;
    letter-spacing: -.01em;
    line-height: 1.2;
    margin-bottom: 8px;
    width: 100%;
    word-break: break-word;
    hyphens: auto;
}

.hex-mode-btn__sub {
    display: block;
    font-size: .80rem;
    color: #6b7280;
    line-height: 1.5;
    width: 100%;
    word-break: break-word;
    hyphens: auto;
    white-space: normal;
}

@media (max-width: 540px) {
    .hex-mode-selector       { grid-template-columns: 1fr; }
    .hex-mode-btn            { padding: 22px 20px 20px; }
    .hex-mode-btn__icon      { font-size: 2rem; margin-bottom: 8px; }
    .hex-mode-btn__title     { font-size: 1rem; }
    .hex-mode-btn__sub       { font-size: .78rem; white-space: normal; word-break: break-word; hyphens: auto; }
}


/* Form header with close button */
.hex-form-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.hex-form-header .hex-form-title { margin: 0; flex: 1; }
.hex-form-close {
    background: none; border: none; font-size: 1.8rem; line-height: 1;
    color: #9ca3af; cursor: pointer; padding: 0 4px; transition: color .15s; flex-shrink: 0;
}
.hex-form-close:hover { color: #1e1b4b; }

.hex-submit-btn--solo { background: var(--pal-1); box-shadow: 0 4px 14px rgba(225,30,44,.3); }
.hex-submit-btn--solo:hover:not(:disabled) { background: #c0111e; }

/* Empty name slots */
.hex-tile__name--empty { opacity: .32; font-size: .65em !important; letter-spacing: .1em; }

/* Notes textarea in form */
.hex-form-container textarea {
    padding: 10px 14px; border: 1.5px solid var(--hex-border); border-radius: var(--hex-radius);
    background: var(--hex-input-bg); font-size: .97rem; color: #1f2937; font-family: inherit;
    width: 100%; box-sizing: border-box; transition: border-color .2s, box-shadow .2s;
    outline: none; margin-bottom: 16px;
}
.hex-form-container textarea:focus { border-color: var(--pal-0); box-shadow: 0 0 0 3px rgba(31,79,190,.15); }

@media (max-width: 540px) {
    .hex-mode-selector { grid-template-columns: 1fr; }
    .hex-mode-btn { padding: 24px 16px; }
    .hex-mode-btn__icon { font-size: 2.2rem; }
    .hex-mode-btn__title { font-size: 1.05rem; }
}

/* Honeypot — całkowicie niewidoczne dla ludzi */
.hex-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* ── Lista par imię+email w formularzu grupowym ─────────────── */
.hex-wrap .hex-persons-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.hex-wrap .hex-person-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: flex-end;
    padding: 12px 16px;
    background: rgba(31,79,190,.04);
    border: 1px solid var(--hex-border);
    border-radius: var(--hex-radius);
    box-sizing: border-box;
    width: 100%;
}
.hex-wrap .hex-person-row .hex-field {
    margin-bottom: 0;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}
.hex-wrap .hex-person-row .hex-field input[type="text"],
.hex-wrap .hex-person-row .hex-field input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    display: block;
}
@media (max-width: 600px) {
    .hex-wrap .hex-person-row {
        flex-direction: column;
    }
    .hex-wrap .hex-person-row .hex-field {
        width: 100%;
        flex: none;
    }
}

.hex-person-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--pal-0);
    color: #fff;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 700;
    margin-right: 4px;
    vertical-align: middle;
}
