/* events.php — "FIND YOUR NEXT EXPERIENCE". Builds on home-brand.css (tokens, .tph-btn, .tph-kicker, .tph-partner). */

.tpe { background: var(--tph-white); }
.tpe h1, .tpe h2, .tpe h3 { color: inherit; }
.tpe-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tpe a:focus-visible, .tpe button:focus-visible, .tpe select:focus-visible, .tpe input:focus-visible { outline: 3px solid var(--tph-sky); outline-offset: 2px; }
.tpe-intro a:focus-visible, .tpe-collab a:focus-visible { outline-color: var(--tph-white); }
html.tpe-locked { overflow: hidden; }

/* ── 1. Introduction: compact blue band ─────────────────────── */
.tpe-intro { position: relative; overflow: hidden; isolation: isolate; padding: clamp(40px, 5vw, 64px) 0 clamp(92px, 9vw, 116px); background: linear-gradient(150deg, var(--tph-blue) 0%, var(--tph-blue-deep) 100%); color: var(--tph-white); }
.tpe-intro__shapes { position: absolute; right: 0; top: 0; width: min(55%, 760px); height: 100%; z-index: -1; fill: var(--tph-sky); opacity: .16; }
.tpe-intro__dots { position: absolute; right: max(16px, calc(50% - 620px)); bottom: 70px; width: 180px; height: 80px; z-index: -1; background-image: radial-gradient(circle, rgba(255,255,255,.7) 1.6px, transparent 2px); background-size: 22px 22px; opacity: .35; }
.tpe-intro h1 { max-width: 18em; font-size: clamp(30px, 3.8vw, 50px); line-height: 1.25; margin-bottom: 12px; }
.tpe-intro__lead { max-width: 44em; text-wrap: pretty; font-size: clamp(16px, 1.4vw, 19px); line-height: 1.7; font-weight: 300; color: rgba(255,255,255,.9); }
html[lang="en"] .tpe-intro__lead { font-weight: 200; }

/* ── 2. Search + filters: a white panel lifted over the band ── */
.tpe-find { position: relative; z-index: 2; scroll-margin-top: 96px; margin-top: clamp(-76px, -6vw, -60px); }
.tpe-find__box { display: grid; gap: 16px; padding: clamp(16px, 2vw, 22px); background: var(--tph-white); border: 1px solid var(--tph-line); border-radius: 20px; box-shadow: 0 24px 50px rgba(1, 50, 77, .12); }
.tpe-search { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 6px 6px 6px 18px; border: 1.5px solid var(--tph-line); border-radius: 999px; background: var(--tph-mist); transition: border-color .15s, background-color .15s; }
.tpe-search:focus-within { border-color: var(--tph-sky); background: var(--tph-white); }
.tpe-search > .tpe-ico { color: var(--tph-blue); }
.tpe-search input { flex: 1; min-width: 0; height: 46px; border: 0; background: none; font: 400 17px/1.4 var(--tph-th); color: var(--tph-ink); }
.tpe-search input::placeholder { color: #6b7a83; }
.tpe-search input:focus-visible { outline: none; }
.tpe-search input::-webkit-search-cancel-button { display: none; }
.tpe-search__go { min-height: 48px; padding-inline: 26px; }
.tpe-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: none; color: var(--tph-muted); cursor: pointer; }
.tpe-icon-btn:hover { background: rgba(1,79,119,.08); color: var(--tph-blue); }
.tpe-icon-btn .tpe-ico { width: 18px; height: 18px; }

.tpe-bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.tpe-field { position: relative; display: grid; gap: 4px; min-width: 0; margin: 0; padding: 0; border: 0; }
.tpe-field > span, .tpe-field > legend { padding: 0; font-size: 13px; font-weight: 600; color: var(--tph-muted); }
.tpe-field select { width: 100%; height: 46px; padding: 0 38px 0 14px; appearance: none; border: 1.5px solid var(--tph-line); border-radius: 12px; background: var(--tph-white); font: 500 15px/1.2 var(--tph-th); color: var(--tph-ink); cursor: pointer; text-overflow: ellipsis; }
.tpe-field select:hover { border-color: #b4c8d4; }
.tpe-field > .tpe-ico--chev { position: absolute; right: 12px; bottom: 13px; width: 18px; height: 18px; color: var(--tph-blue); pointer-events: none; }
.tpe-field.is-set select { border-color: var(--tph-blue); background: #eef6fb; color: var(--tph-blue); font-weight: 600; }
.tpe-bar > .tpe-field:not(.tpe-price-field) { flex: 1 1 150px; max-width: 230px; }

.tpe-seg { display: inline-flex; padding: 3px; border: 1.5px solid var(--tph-line); border-radius: 12px; background: var(--tph-white); }
.tpe-price-field.is-set .tpe-seg { border-color: var(--tph-blue); }
.tpe-seg label { position: relative; }
.tpe-seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tpe-seg span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 9px; font-size: 15px; font-weight: 500; white-space: nowrap; color: var(--tph-ink); }
.tpe-seg input:checked + span { background: var(--tph-blue); color: var(--tph-white); font-weight: 600; }
.tpe-seg input:focus-visible + span { outline: 3px solid var(--tph-sky); outline-offset: 1px; }
.tpe-range { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; }
.tpe-range label { display: grid; gap: 4px; font-size: 12px; color: var(--tph-muted); }
.tpe-range input { width: 112px; height: 40px; padding: 0 10px; border: 1.5px solid var(--tph-line); border-radius: 10px; font: 500 15px/1 var(--tph-th); }
.tpe-range > span { padding-bottom: 10px; color: var(--tph-muted); }

.tpe-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: 14px; border-top: 1px solid var(--tph-line); }
.tpe-chips ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tpe-chips li button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 14px; border: 1px solid #b9d7ea; border-radius: 999px; background: #eef6fb; color: var(--tph-blue); font: 500 14px/1.2 var(--tph-th); cursor: pointer; }
.tpe-chips li button:hover { background: #ddeef8; border-color: var(--tph-sky); }
.tpe-chips li .tpe-ico { width: 15px; height: 15px; stroke-width: 2.2; }
.tpe-clear { min-height: 36px; padding: 0 4px; border: 0; background: none; color: var(--tph-blue); font: 600 14px/1.2 var(--tph-th); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.tpe-clear:disabled { color: #9aa8b0; text-decoration: none; cursor: default; }
.tpe-open-filters { display: none; }

/* ── 3. Featured event ─────────────────────────────────────── */
.tpe-featured { padding-top: clamp(40px, 5vw, 64px); }
.tpe-feature { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: clamp(8px, 1vw, 16px); padding: clamp(12px, 1.4vw, 18px); overflow: hidden; background: var(--tph-mist); border-radius: 22px; }
.tpe-feature__media { display: block; overflow: hidden; border-radius: 14px; background: #dce9f1; }
.tpe-feature__media img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .5s var(--tph-ease); }
.tpe-feature:hover .tpe-feature__media img { transform: scale(1.03); }
.tpe-feature__body { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: clamp(12px, 2.4vw, 32px); }
.tpe-feature__label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tpe-feature__label span { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--tph-blue); color: var(--tph-white); font-size: 13px; font-weight: 600; }
.tpe-feature__label span::before { content: ""; width: 14px; height: 3px; background: var(--tph-sky); transform: skewX(-24deg); }
.tpe-feature__label small { font-size: 12px; color: var(--tph-muted); }
.tpe-feature h2 { font-size: clamp(24px, 2.4vw, 34px); line-height: 1.3; }
.tpe-feature h2 a:hover { color: var(--tph-blue); }
.tpe-feature__short { font-size: 16px; line-height: 1.7; color: var(--tph-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tpe-feature__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--tph-line); }
.tpe-feature__foot .tph-btn { margin-left: auto; }

/* ── 4. Results ─────────────────────────────────────────────── */
.tpe-results { padding: clamp(44px, 5vw, 72px) 0 clamp(56px, 6vw, 88px); scroll-margin-top: 80px; }
.tpe-results:focus, .tpe-find:focus { outline: none; }
.tpe-results__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 26px; }
.tpe-results__head h2 { font-size: clamp(26px, 2.8vw, 38px); line-height: 1.3; color: var(--tph-ink); }
.tpe-results__head h2::after { content: ""; display: block; width: 44px; height: 4px; margin-top: 10px; background: var(--tph-sky); transform: skewX(-24deg); transform-origin: left; }
.tpe-results__head p { margin-top: 10px; font-size: 15px; color: var(--tph-muted); }
.tpe-sort { width: 220px; }

.tpe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2vw, 28px); }

.tpe-card { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--tph-white); border: 1px solid var(--tph-line); border-radius: 18px; transition: box-shadow .25s var(--tph-ease), transform .25s var(--tph-ease), border-color .25s; }
.tpe-card:hover { transform: translateY(-3px); border-color: #c4d6e1; box-shadow: 0 18px 36px rgba(1, 50, 77, .1); }
.tpe-card__media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #dce9f1; }
.tpe-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--tph-ease); }
.tpe-card:hover .tpe-card__media img { transform: scale(1.04); }
.tpe-card__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tpe-card__cat { max-width: 100%; padding: 3px 10px; border-radius: 999px; background: #eef6fb; color: var(--tph-blue); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpe-card__body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 18px 20px 20px; }
.tpe-card__kind { font: 600 12px/1.4 var(--tph-en); letter-spacing: .08em; text-transform: uppercase; color: var(--tph-sky); }
.tpe-card h3 { font-size: 19px; line-height: 1.42; }
.tpe-card h3 a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--tph-ink); }
.tpe-card h3 a:hover { color: var(--tph-blue); }

.tpe-meta { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 14.5px; line-height: 1.5; color: #3d4a51; }
.tpe-meta li { display: flex; gap: 9px; align-items: flex-start; }
.tpe-meta .tpe-ico { width: 18px; height: 18px; margin-top: 1px; color: var(--tph-blue); }
.tpe-meta span { min-width: 0; }
.tpe-meta small { display: block; font-size: 13.5px; color: var(--tph-muted); }

.tpe-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--tph-line); }
.tpe-price { font: 700 20px/1.2 var(--tph-en); color: var(--tph-blue); }
.tpe-price--lg { font-size: 26px; }
.tpe-status { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; font-size: 13.5px; font-weight: 600; }
.tpe-status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tpe-status small { font-weight: 500; padding: 2px 8px; border-radius: 999px; background: #fff4e5; color: #8a4b00; }
.tpe-status--open { color: #146c43; }
.tpe-status--full, .tpe-status--closed { color: #5c6870; }
.tpe-status--full i, .tpe-status--closed i { background: none; border: 1.5px solid currentColor; }
.tpe-status--cancelled { color: #a1251b; }
.tpe-status--cancelled i { border-radius: 0; width: 10px; height: 2px; }
.tpe-card.is-cancelled .tpe-card__media img { filter: grayscale(1); opacity: .7; }
.tpe-card.is-cancelled h3 a { text-decoration: line-through; text-decoration-thickness: 1px; }
.tpe-card__more { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 40px; color: var(--tph-blue); font-weight: 600; font-size: 15px; }
.tpe-card__more .tpe-ico { width: 17px; height: 17px; transition: transform .2s var(--tph-ease); }
.tpe-card__more:hover .tpe-ico { transform: translateX(3px); }

/* loading placeholders keep the card's exact shape so nothing jumps */
.tpe-card--skeleton { pointer-events: none; }
.tpe-card--skeleton .tpe-card__body i { display: block; height: 14px; border-radius: 7px; background: #e8eff4; }
.tpe-card--skeleton .tpe-card__body i:nth-child(1) { width: 35%; height: 11px; }
.tpe-card--skeleton .tpe-card__body i:nth-child(2) { width: 90%; height: 20px; }
.tpe-card--skeleton .tpe-card__body i:nth-child(3) { width: 70%; }
.tpe-card--skeleton .tpe-card__body i:nth-child(4) { width: 50%; margin-top: 34px; }
.tpe-card--skeleton .tpe-card__media, .tpe-card--skeleton .tpe-card__body i { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); background-size: 200% 100%; background-repeat: no-repeat; animation: tpe-shimmer 1.2s linear infinite; }
.tpe-card--skeleton .tpe-card__body { min-height: 196px; }
@keyframes tpe-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.tpe-state { display: grid; justify-items: center; gap: 10px; padding: clamp(40px, 6vw, 72px) 20px; text-align: center; background: var(--tph-mist); border-radius: 20px; }
.tpe-state h3 { font-size: 22px; color: var(--tph-blue); }
.tpe-state p { max-width: 32em; color: var(--tph-muted); line-height: 1.7; margin-bottom: 8px; }
.tpe-state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.tpe-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 40px; }
.tpe-pages ol { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tpe-pages button { min-width: 44px; height: 44px; padding: 0 14px; border: 1.5px solid var(--tph-line); border-radius: 12px; background: var(--tph-white); color: var(--tph-ink); font: 600 15px/1 var(--tph-th); cursor: pointer; }
.tpe-pages button:hover:not(:disabled) { border-color: var(--tph-blue); color: var(--tph-blue); }
.tpe-pages button[aria-current="page"] { background: var(--tph-blue); border-color: var(--tph-blue); color: var(--tph-white); }
.tpe-pages button:disabled { opacity: .45; cursor: default; }

.tpe-partner { padding-bottom: clamp(40px, 5vw, 64px); }

/* ── 5. Collaboration ───────────────────────────────────────── */
.tpe-collab { padding-bottom: clamp(56px, 7vw, 96px); }
.tpe-collab__box { position: relative; overflow: hidden; isolation: isolate; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; padding: clamp(28px, 4vw, 48px) clamp(24px, 4.5vw, 60px); border-radius: 22px; background: linear-gradient(140deg, var(--tph-blue), var(--tph-blue-deep)); color: var(--tph-white); }
.tpe-collab__shapes { position: absolute; right: 0; top: 0; width: 45%; height: 100%; z-index: -1; fill: var(--tph-sky); opacity: .18; }
.tpe-collab h2 { font-size: clamp(24px, 2.6vw, 34px); line-height: 1.3; margin-bottom: 6px; }
.tpe-collab p { max-width: 34em; line-height: 1.7; font-weight: 300; color: rgba(255,255,255,.88); }

/* ── Mobile filter sheet ────────────────────────────────────── */
.tpe-sheet { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; }
.tpe-sheet__backdrop { position: absolute; inset: 0; border: 0; background: rgba(1, 25, 38, .5); cursor: pointer; }
.tpe-sheet__box { position: relative; display: flex; flex-direction: column; width: 100%; max-height: 88dvh; background: var(--tph-white); border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.2); animation: tpe-up .25s var(--tph-ease); }
.tpe-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 10px 20px; border-bottom: 1px solid var(--tph-line); }
.tpe-sheet__head h2 { font-size: 20px; }
.tpe-sheet__body { display: grid; gap: 16px; padding: 18px 20px; overflow: auto; }
.tpe-sheet__body .tpe-seg { display: flex; }
.tpe-sheet__body .tpe-seg label { flex: 1; }
.tpe-sheet__body .tpe-seg span { justify-content: center; width: 100%; }
.tpe-sheet__body .tpe-range input { width: 100%; }
.tpe-sheet__body .tpe-range label { flex: 1; }
.tpe-sheet__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--tph-line); }
.tpe-sheet__foot .tph-btn { flex: 1; max-width: 260px; }
.tpe-sheet__foot .tph-btn small { font-weight: 500; opacity: .8; }
@keyframes tpe-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .tpe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tpe-bar > .tpe-field:not(.tpe-price-field) { max-width: none; }
}
@media (max-width: 860px) {
  .tpe-feature { grid-template-columns: minmax(0, 1fr); }
  .tpe-feature__foot .tph-btn { margin-left: 0; flex: 1 1 100%; }
  /* phones and small tablets: search plus a "ตัวกรอง" button that opens the sheet */
  .tpe-find__box { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 10px; }
  .tpe-bar { display: none; }
  .tpe-chips { grid-column: 1 / -1; }
  .tpe-open-filters { display: inline-flex; align-items: center; gap: 8px; height: 56px; padding: 0 16px; border: 1.5px solid var(--tph-line); border-radius: 999px; background: var(--tph-white); color: var(--tph-blue); font: 600 15px/1 var(--tph-th); cursor: pointer; }
  .tpe-open-filters b { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--tph-blue); color: var(--tph-white); font-size: 12px; }
  .tpe-search { min-height: 56px; }
  .tpe-search__go { display: none; }
}
@media (max-width: 600px) {
  .tpe-grid { grid-template-columns: minmax(0, 1fr); }
  .tpe-intro__dots { display: none; }
  .tpe-find__box { padding: 12px; border-radius: 18px; }
  .tpe-search { padding-left: 14px; }
  .tpe-search input { font-size: 16px; }
  .tpe-open-filters { width: 56px; padding: 0; justify-content: center; font-size: 0; position: relative; }
  .tpe-open-filters b { position: absolute; top: -4px; right: -4px; font-size: 11px; }
  .tpe-results__head { align-items: stretch; }
  .tpe-sort { width: 100%; }
  .tpe-collab__box .tph-btn { flex: 1 1 100%; }
  .tpe-pages > button { flex: 1; }
  .tpe-pages ol { order: -1; width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .tpe *, .tpe-sheet * { transition: none !important; animation: none !important; }
  .tpe-card:hover { transform: none; }
  .tpe-card:hover .tpe-card__media img, .tpe-feature:hover .tpe-feature__media img { transform: none; }
}
