/* Arz & Iffah wedding site: shared styles for every page.
   Colours, fonts and sizes come from the Figma file. */

:root {
  --cream: #faf8f5;      /* page background */
  --ink: #302b28;        /* page titles */
  --ink-soft: #80766f;   /* date line under titles */
  --text: #000000;       /* information body text */
  --caption: #231f20;    /* "Be the first to add a photo" */
  --terracotta: #a6533e; /* "Add photos" bar */
  --line: #e7e0d9;       /* borders on the name panel */
  --beige: #f2eee9;      /* empty photo slots and avatar circles */
  --bar-height: 72px;
  --serif: "Inria Serif", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Make sure hidden things stay hidden, even if they have their own display */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--text);
  font-family: var(--sans);
  /* Fill the screen so content can be centred in the space below the header */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Keep pages phone-width on big screens */
.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Header (same on every page) ---------- */

.header {
  height: 160px;
  padding: 21px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  line-height: normal;
  color: var(--ink);
}

.subtitle {
  margin: 0;
  font-size: 12px;
  line-height: normal;
  color: var(--ink-soft);
}

.icon-button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  /* Bigger invisible tap area for fingers */
  position: relative;
}

.icon-button::after {
  content: "";
  position: absolute;
  inset: -10px;
}

.icon-button img {
  display: block;
  width: 24px;
  height: 24px;
}

/* ---------- Menu panel ---------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--cream);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s;
}

.menu.is-open {
  opacity: 1;
  visibility: visible;
}

.menu-inner {
  max-width: 480px;
  margin: 0 auto;
}

/* Same height and padding as .header, so ✕ sits exactly where ☰ was */
.menu-top {
  height: 160px;
  padding: 21px 24px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.menu-links {
  list-style: none;
  margin: 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-links a {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  color: var(--ink);
  text-decoration: none;
}

.menu-links a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

body.menu-open {
  overflow: hidden;
}

/* ---------- Home page ---------- */

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 30px;
}

.home-caption {
  flex: 1;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 20px;
  line-height: normal;
  color: var(--caption);
  text-align: center;
}

.invitation {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 448 / 637;
}

/* Leave room so the fixed bar never covers the artwork */
.home-page {
  padding-bottom: calc(var(--bar-height) + env(safe-area-inset-bottom));
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  height: calc(var(--bar-height) + env(safe-area-inset-bottom));
  padding: 0 0 env(safe-area-inset-bottom);
  border: 0;
  background: var(--terracotta);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 20px;
  line-height: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  cursor: pointer;
}

.bottom-bar img {
  display: block;
  width: 20px;
  height: 20px;
}

/* ---------- Photo wall ---------- */

.wall {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.card {
  min-width: 0;
  background: #ffffff;
}

.card-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--beige);
  overflow: hidden;
}

.card-photo img.photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* While sending or failed: the photo shows faded under the circle or retry */
.card.is-loading img.photo {
  opacity: 0.35;
}

/* Fainter, so "Tap to retry" stays readable */
.card.is-failed img.photo {
  opacity: 0.15;
}

.card-status {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--sans);
}

.card.is-loading .card-status.loading,
.card.is-failed .card-status.retry {
  display: flex;
}

.card-status.loading img {
  width: 44px;
  height: 44px;
  animation: spin 0.9s linear infinite;
}

.card-status.retry {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--terracotta);
}

.card-status.retry img {
  width: 24px;
  height: 24px;
}

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

.card-info {
  height: 50px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--beige);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}

.card-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-time {
  flex-shrink: 0;
  margin: 0;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* Sent photos can be tapped to open the feed */
.card.is-done .card-photo {
  cursor: pointer;
}

/* ---------- Enlarged feed ---------- */

/* While the feed is open, the grid page and "Add photos" bar step aside */
body.feed-open .page,
body.feed-open .bottom-bar {
  display: none;
}

.feed {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* Stays at the top while scrolling, so ← is always in reach */
.feed-top {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cream);
}

.feed-back {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
}

.feed-back::after {
  content: "";
  position: absolute;
  inset: -11px;
}

.feed-back img {
  display: block;
  width: 22px;
  height: 22px;
}

/* Jumping to a photo leaves room for the sticky bar */
.feed-item {
  scroll-margin-top: 64px;
}

.feed-info {
  height: 54px;
  padding: 0 20px;
  gap: 10px;
  background: #ffffff;
}

/* Whole photo, never cropped */
.feed-item img.photo {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Name panel (first time only) ---------- */

.name-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  max-width: 480px;
  min-height: calc(280px + env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 12px rgba(0, 0, 0, 0.07);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
}

.name-panel.is-open {
  transform: translateY(0);
  visibility: visible;
}

.name-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.name-entry {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.name-label {
  font-size: 13px;
  font-weight: 600;
  line-height: normal;
  color: var(--ink);
}

/* 16px text stops iPhones zooming in when typing */
.name-input {
  width: 100%;
  height: 54px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.name-input::placeholder {
  color: #b5aca5;
  opacity: 1;
}

.name-input:focus {
  outline: none;
  border-color: var(--ink-soft);
}

.name-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.name-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.choose-button {
  height: 54px;
  border: 0;
  border-radius: 14px;
  background: var(--terracotta);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.choose-button img {
  display: block;
  width: 20px;
  height: 20px;
}

/* Faded until a name is typed */
.choose-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.name-reassurance {
  margin: 0;
  font-size: 12px;
  line-height: normal;
  color: var(--ink-soft);
  text-align: center;
}

.panel-close {
  position: absolute;
  top: 7px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.panel-close img {
  display: block;
  width: 36px;
  height: 36px;
}

/* ---------- Information page ---------- */

.info-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 28px 72px;
  font-size: 16px;
  font-weight: 300;
  line-height: 20px;
}

.info-main p {
  margin: 0 0 20px;
}

.info-main p.tight {
  margin-bottom: 0;
}

.info-main strong {
  font-weight: 700;
}

.info-main ul {
  margin: 0 0 20px;
  padding-left: 48px;
}

.info-main a {
  color: inherit;
  text-decoration: underline;
}

/* ---------- Ride-back note (5pm 15 Nov to 11:59pm 16 Nov) ---------- */

/* With the note showing, content starts at the top and leaves room for the bar */
body.ride-open .info-main {
  justify-content: flex-start;
  padding-bottom: calc(var(--bar-height) + env(safe-area-inset-bottom) + 24px);
}

.ride-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
  color: var(--terracotta);
}

.ride-rules {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
}

.info-main .ride-note ul {
  margin: 0;
  padding-left: 24px;
}
