:root {
  --bg: #faf9f7;
  --text: #2e2e2e;
  --muted: #6f6f6f;
  --accent: #6b8e6b;
  --line: #e2e0dc;
  --radius: 12px;
  --space: clamp(16px, 3vw, 28px);
  --hero-x: 50%;
  --hero-y: 60%;
}

/* ================= RESET ================= */
*, *::before, *::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: 'Crimson Text', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
img, iframe {
  max-width: 100%;
  display: block;
}

/* ================= LAYOUT ================= */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 var(--space);
}
section {
  padding: calc(var(--space) * 1.2) 0;
}

/* ================= TYPOGRAPHY ================= */
h1 {
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.3em;
}
h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.4em;
}
h3 {
  margin: 18px 0 8px;
}
p {
  margin: 0 0 0.9em;
}
.sub {
  color: var(--muted);
}

/* ================= LINKS & BUTTONS ================= */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  filter: brightness(0.95);
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

/* ================= HERO ================= */
header.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: flex-end;
  text-align: center;
  padding-bottom: 60px;
  overflow: hidden;
}
header.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("images/kage5.jpg") no-repeat;
  background-size: cover;
  background-position: var(--hero-x) var(--hero-y);
  filter: brightness(0.82);
  z-index: 0;
}
header.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.2), rgba(0,0,0,.35));
  z-index: 0;
}
header.hero * {
  position: relative;
  z-index: 1;
  color: #fff;
}
.subtitle {
  font-style: italic;
  color: #eee;
}
.count {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}

/* ================= NAVBAR ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.75);
  border-bottom: 1px solid var(--line);
}
nav {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  overflow-x: auto;
  white-space: nowrap;
}
nav::-webkit-scrollbar {
  display: none;
}
nav a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  transition: all 0.2s ease;
}
nav a:hover,
nav a.active {
  color: var(--accent);
  border-color: currentColor;
  background: rgba(107,142,107,0.08);
}

/* ================= CARDS ================= */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

/* ================= PHOTO GRID ================= */
#kuvat {
  padding-top: 0;
}

.photo-grid {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

/* ================= MAP ================= */
.map-wrap {
  position: relative;
  margin-top: 10px;
  padding-bottom: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.map-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ================= RSVP FORM ================= */
.form {
  display: grid;
  gap: 14px;
}
.field {
  display: grid;
  gap: 6px;
}
label {
  font-size: 0.95rem;
  color: var(--muted);
}

input:not([type="radio"]):not([type="checkbox"]),
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  padding: 0;
}

.radio-row {
  display: flex;
  gap: 28px;
  align-items: center;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.radio-option span {
  color: var(--text);
}
.radio-option input[type="radio"] {
  margin: 0;
}

/* Radio column (bussikytydit) */
.radio-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Checkbox (menokyyti) */
.check-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.check-option input[type="checkbox"] {
  margin: 0;
}

/* Actions */
.actions {
  margin-top: 6px;
  display: flex;
  gap: 10px;
}

/* RSVP message */
.rsvp-message {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.rsvp-message.success {
  border-color: rgba(107,142,107,0.5);
}
.rsvp-message.error {
  border-color: rgba(180,74,83,0.55);
}

footer {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: var(--space) 0 calc(var(--space) * 1.4);
  color: var(--muted);
  font-style: italic;
}

#gate{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;

  background:
    radial-gradient(1200px 800px at 20% 20%, rgba(107,142,107,0.10), transparent 60%),
    radial-gradient(900px 700px at 80% 30%, rgba(107,142,107,0.08), transparent 55%),
    linear-gradient(135deg, #fbfaf8, #f1ede8);
}

#gate::before{
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
}

.gate-card{
  position: relative;
  width: min(420px, 92vw);
  padding: 34px 34px 26px;
  text-align: center;

  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226,224,220,0.9);
  border-radius: 18px;

  box-shadow:
    0 14px 42px rgba(0,0,0,0.12),
    0 2px 10px rgba(0,0,0,0.06);

  transform: translateY(6px);
  animation: gateIn .35s ease-out both;
}

@keyframes gateIn{
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(6px); }
}

.gate-card h1{
  margin: 0 0 10px;
  font-size: 1.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.gate-card p{
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.gate-card input{
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(226,224,220,1);
  background: rgba(255,255,255,0.9);

  font-family: inherit;
  font-size: 1rem;
  text-align: center;

  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}

.gate-card input:focus{
  border-color: rgba(107,142,107,0.7);
  box-shadow: 0 0 0 4px rgba(107,142,107,0.16);
  transform: translateY(-1px);
}

.gate-card button{
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(107,142,107,0.75);
  background: var(--accent);
  color: #fff;

  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0.02em;

  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, box-shadow .2s ease;
  box-shadow: 0 10px 22px rgba(107,142,107,0.18);
}

.gate-card button:hover{
  filter: brightness(0.97);
  transform: translateY(-1px);
}

.gate-card button:active{
  transform: translateY(0px);
}

.gate-card #error{
  margin-top: 10px;
  font-size: 0.95rem;
  color: #b44a53;
}

.gate-card a{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gate-card a:hover{
  filter: brightness(0.95);
}

/* ===== Login transition ===== */
#site {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .45s ease, transform .45s ease;
}

#site.is-visible {
  opacity: 1;
  transform: translateY(0);
}

#gate {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .35s ease, transform .35s ease, filter .35s ease;
}

#gate.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
  filter: blur(6px);
  pointer-events: none;
}

/* ================= LIGHTBOX ================= */
.photo-grid img[data-lightbox] {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.75);
  z-index: 10000;
}

.lightbox.is-open {
  display: flex;
}

.lightbox__inner {
  position: relative;
  max-width: min(920px, 96vw);
  max-height: min(90vh, 96vh);
}

.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.20);
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  cursor: zoom-out;
}

.lightbox__close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.lightbox__close:hover {
  filter: brightness(1.1);
}



/* Estää zoomin mobiles */
@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}


#ilmoittautuminen label {
  color: var(--text);
}

#ilmoittautuminen .sub {
  color: var(--text);
}

/* ================= RSVP POPUP MODAL ================= */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  padding: 18px;
}
.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal__box {
  position: relative;
  width: min(520px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.22);
}

.modal__box p {
  margin: 0 0 14px;
  color: var(--text);
}