/* ── Travel Photo Contest — vintage airmail postcard desk ───────────
   Sky-to-sea gradient, airmail chevron borders, postage-stamp
   corners, postmark circle, script place names, typewriter labels. */

:root {
  --sky: #7fb9d8;
  --sea: #3e7ea6;
  --airmail-red: #d64545;
  --airmail-navy: #2b4a7a;
  --paper: #fdfaf2;
  --paper-deep: #f3edda;
  --ink: #35404a;
  --ink-soft: #7f8c96;
  --line: #e3ddc9;
  --err: #d64545;
  --font-script: 'Caveat', cursive;
  --font-type: 'Special Elite', cursive;
  --font-body: 'Rubik', sans-serif;
}

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

.hidden { display: none !important; }

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--sky) 0%, var(--sea) 100%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.page { position: relative; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }

.flight-path {
  position: absolute;
  top: 30px;
  left: 0;
  width: 100%;
  height: 160px;
  pointer-events: none;
}

.wrap { position: relative; width: 100%; max-width: 660px; margin: 0 auto; padding: 0 24px; z-index: 1; }

main { flex: 1 0 auto; padding-bottom: 70px; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 56px 0 12px; color: #fff; }

.hero-inner { position: relative; }

.postmark {
  position: absolute;
  top: -22px;
  right: 2%;
  width: 92px;
  height: 92px;
  border: 2.5px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(12deg);
  font-family: var(--font-type);
  font-size: 0.72rem;
  line-height: 1.3;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.85);
}

.postmark::after {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
}

.kicker {
  font-family: var(--font-script);
  font-size: clamp(1.5rem, 6vw, 2rem);
  transform: rotate(-2deg);
  display: inline-block;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(43, 74, 122, 0.4);
}

.hero h1 {
  font-family: var(--font-type);
  font-size: clamp(1.9rem, 7.5vw, 2.9rem);
  line-height: 1.15;
  text-shadow: 0 3px 0 rgba(43, 74, 122, 0.35);
}

.hero .sub { margin-top: 14px; max-width: 480px; margin-left: auto; margin-right: auto; opacity: 0.94; font-weight: 500; }

.hero-cta { display: flex; justify-content: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ── Tabs ─────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 10px; margin: 32px 0 22px; }

.tab {
  flex: 1;
  font-family: var(--font-type);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 13px 10px;
  background: rgba(253, 250, 242, 0.4);
  color: var(--airmail-navy);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab:hover { background: rgba(253, 250, 242, 0.6); }

.tab.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(43, 74, 122, 0.3);
}

/* ── Airmail cards / notes ────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--paper);
  border-radius: 6px;
  padding: 34px 28px 30px;
  box-shadow: 0 14px 34px rgba(43, 74, 122, 0.35);
  margin-bottom: 18px;
}

/* airmail chevron border */
.card.airmail {
  border: 6px solid transparent;
  background-clip: padding-box;
}

.card.airmail::before {
  content: '';
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: 6px;
  background: repeating-linear-gradient(
    45deg,
    var(--airmail-red) 0 14px,
    var(--paper) 14px 28px,
    var(--airmail-navy) 28px 42px,
    var(--paper) 42px 56px
  );
}

/* postage stamp corner */
.card.airmail::after {
  content: '\1F30D';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 46px;
  height: 54px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  -webkit-mask-image: radial-gradient(circle at 0 0, transparent 3px, #000 3.5px);
  mask-image: radial-gradient(circle at 0 0, transparent 3px, #000 3.5px);
  -webkit-mask-size: 11px 11px;
  mask-size: 11px 11px;
}

.card h2 { font-family: var(--font-type); font-size: 1.4rem; margin-bottom: 6px; padding-right: 52px; }

.card-sub { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 20px; }

.note {
  margin: 18px 0;
  padding: 16px 20px;
  border-radius: 8px;
  background: var(--paper);
  text-align: center;
  box-shadow: 0 8px 20px rgba(43, 74, 122, 0.25);
}

/* ── Dropzone ─────────────────────────────────────────────────────── */
.drop {
  position: relative;
  border: 2px dashed var(--sea);
  border-radius: 8px;
  background: rgba(127, 185, 216, 0.1);
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  overflow: hidden;
  transition: background 0.15s ease;
}

.drop:hover { background: rgba(127, 185, 216, 0.2); }

.drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-inner { text-align: center; padding: 22px; }

.drop-icon { font-size: 2.2rem; display: block; margin-bottom: 8px; }

.drop-text { font-weight: 600; }

.drop-hint { color: var(--ink-soft); font-size: 0.85rem; margin-top: 4px; }

.preview { width: 100%; max-height: 300px; object-fit: cover; display: block; }

/* ── Fields ───────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label {
  display: block;
  font-family: var(--font-type);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 13px 15px;
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  transition: border-color 0.15s ease;
}

input:focus { outline: none; border-color: var(--sea); }
input.error { border-color: var(--err); }
input::placeholder { color: var(--ink-soft); opacity: 0.7; }

.form-error { color: var(--err); font-weight: 600; text-align: center; margin-top: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-type);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  line-height: 1.2;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--airmail-red); outline-offset: 2px; }

.btn-primary {
  background: var(--airmail-red);
  color: #fff;
  box-shadow: 0 5px 0 #a83030;
}

.btn-primary:hover:not(:disabled) { box-shadow: 0 7px 0 #a83030; }

.btn-ghost {
  background: rgba(253, 250, 242, 0.85);
  color: var(--airmail-navy);
  font-size: 0.85rem;
  padding: 11px 20px;
}

.btn-block { width: 100%; }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── My entry ─────────────────────────────────────────────────────── */
.my-photo-wrap { text-align: center; margin-bottom: 18px; }

.my-photo {
  max-width: 260px;
  width: 100%;
  border: 6px solid #fff;
  box-shadow: 0 10px 24px rgba(43, 74, 122, 0.3);
  transform: rotate(-1.5deg);
  margin-bottom: 12px;
}

.my-caption { font-family: var(--font-script); font-size: 1.35rem; }

.share-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* ── Gallery ──────────────────────────────────────────────────────── */
.gallery-head { text-align: center; margin-bottom: 22px; color: #fff; }

.gallery-head h2 { font-family: var(--font-type); font-size: 1.7rem; text-shadow: 0 2px 0 rgba(43, 74, 122, 0.35); }

.gallery-sub { opacity: 0.9; margin-top: 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.postcard {
  position: relative;
  background: var(--paper);
  border-radius: 4px;
  padding: 9px 9px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 20px rgba(43, 74, 122, 0.3);
}

.postcard:nth-child(odd) { transform: rotate(-1deg); }
.postcard:nth-child(even) { transform: rotate(0.8deg); }

.postcard:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 16px 32px rgba(43, 74, 122, 0.42); }

/* airmail edge strip */
.postcard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(
    45deg,
    var(--airmail-red) 0 10px,
    var(--paper) 10px 20px,
    var(--airmail-navy) 20px 30px,
    var(--paper) 30px 40px
  );
}

.postcard-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  margin: 8px 0 10px;
  border: 1px solid var(--line);
}

.postcard-place {
  font-family: var(--font-script);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--airmail-navy);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.postcard-msg {
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.postcard-author {
  font-family: var(--font-type);
  color: var(--ink-soft);
  font-size: 0.72rem;
  margin-top: 5px;
}

.postcard-votes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
}

.vote-count { font-weight: 700; color: var(--sea); font-size: 0.88rem; }

.vote-btn {
  font-family: var(--font-type);
  font-size: 0.78rem;
  padding: 8px 16px;
  background: var(--airmail-navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.vote-btn:hover:not(:disabled) { background: var(--sea); }
.vote-btn.is-voted { background: var(--paper-deep); color: var(--ink-soft); cursor: default; }

/* ── Empty / load more ────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 44px 20px;
  background: rgba(253, 250, 242, 0.9);
  border-radius: 8px;
}

.empty-icon { font-size: 2.4rem; display: block; margin-bottom: 10px; }

.empty-sub { color: var(--ink-soft); margin: 6px 0 18px; }

.load-wrap { text-align: center; margin-top: 26px; }

/* ── Lightbox ─────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(43, 74, 122, 0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lb-content {
  background: var(--paper);
  border-radius: 6px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}

.lb-img { width: 100%; max-height: 55vh; object-fit: contain; display: block; background: var(--paper-deep); }

.lb-meta { padding: 18px 22px 22px; }

.lb-caption { font-weight: 600; line-height: 1.5; }

.lb-author { font-family: var(--font-type); color: var(--ink-soft); font-size: 0.8rem; margin-top: 6px; }

.lb-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }

.lb-votes { font-weight: 700; color: var(--sea); }

.lb-close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 2rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  z-index: 2;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.6rem;
  background: rgba(253, 250, 242, 0.16);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  line-height: 1;
}

.lb-prev { left: 14px; }
.lb-next { right: 14px; }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--airmail-navy);
  color: #fff;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: 999px;
  z-index: 200;
  box-shadow: 0 10px 26px rgba(43, 74, 122, 0.5);
}

.toast-ok { background: var(--sea); }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 24px 20px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
}

#wbx-powered-by-slot { margin-top: 12px; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .lb-nav { display: none; }
  .postmark { display: none; }
}
