:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --surface: #fffaf1;
  --surface-strong: #fff4df;
  --text: #25221d;
  --muted: #716b61;
  --line: #ded4c2;
  --accent: #2f6f5e;
  --accent-strong: #1f4d41;
  --accent-soft: #d9eadf;
  --danger: #9f312c;
  --shadow: 0 24px 70px rgb(78 63 40 / 0.16);
  --radius: 22px;
  font-family: Avenir Next, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgb(47 111 94 / 0.12), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgb(198 149 82 / 0.18), transparent 24rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: 100dvh;
  padding-top: 18px;
}

.nav {
  position: sticky;
  top: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid rgb(37 34 29 / 0.08);
  border-radius: 999px;
  background: rgb(255 250 241 / 0.82);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 40px rgb(78 63 40 / 0.12);
}

.brand,
.nav-actions a,
.button {
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fffaf1;
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-actions a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: background 180ms ease, color 180ms ease;
}

.nav-actions a:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 28px;
  align-items: center;
  min-height: calc(100dvh - 104px);
  padding: 44px 0 34px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(3.25rem, 8vw, 6.9rem);
  line-height: 0.93;
  letter-spacing: -0.08em;
}

.hero-lede {
  max-width: 520px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
}

.hero-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

.button.primary {
  background: var(--accent);
  color: #fffaf1;
  box-shadow: 0 12px 34px rgb(47 111 94 / 0.28);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary,
.button.ghost {
  border-color: rgb(47 111 94 / 0.24);
  background: rgb(255 250 241 / 0.84);
  color: var(--accent-strong);
}

.button.ghost {
  width: 100%;
  margin-top: 12px;
}

.hero-card,
.panel,
.result-card,
.toast {
  border: 1px solid rgb(37 34 29 / 0.1);
  border-radius: var(--radius);
  background: rgb(255 250 241 / 0.9);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  transform: rotate(1.5deg);
}

.flow-row {
  padding: 22px;
  border-radius: calc(var(--radius) - 6px);
  background: var(--surface);
}

.flow-row.active {
  background: var(--accent-soft);
}

.flow-row span {
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 900;
}

.flow-row strong {
  display: block;
  margin: 8px 0;
  font-size: 1.18rem;
}

.flow-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

main {
  display: grid;
  gap: 24px;
  padding: 24px 0 56px;
}

.panel,
.result-card {
  padding: clamp(22px, 4vw, 34px);
}

.wide-panel {
  width: 100%;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(280px, 0.76fr) minmax(0, 1.24fr);
  gap: 24px;
  align-items: start;
}

.bottom-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin-bottom: 16px;
}

.section-heading h2,
.panel h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  letter-spacing: -0.055em;
  line-height: 1;
}

.section-heading p,
.panel > p {
  max-width: 640px;
  color: var(--muted);
  line-height: 1.65;
}

.browse-heading {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: end;
}

.profile-form,
.stack-form,
.filter-form,
.photo-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 750;
}

label small {
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgb(37 34 29 / 0.16);
  border-radius: 16px;
  background: #fffdf8;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  transition: border 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(47 111 94 / 0.14);
}

textarea {
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.notice {
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.result-card {
  margin-top: 18px;
  background: var(--surface-strong);
}

.access-code {
  display: block;
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: #25221d;
  color: #fffaf1;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.photo-manager {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.photo-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.photo-item,
.candidate-card,
.status-item {
  border: 1px solid rgb(37 34 29 / 0.1);
  border-radius: 18px;
  background: #fffdf8;
}

.photo-item {
  overflow: hidden;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.photo-item button {
  width: calc(100% - 16px);
  margin: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.candidate-card {
  display: grid;
  overflow: hidden;
}

.candidate-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-strong);
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.card-body h3 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.card-meta,
.tag-row,
.status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.tag {
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.status-list {
  display: grid;
  gap: 12px;
}

.status-item {
  padding: 16px;
}

.empty-state {
  border: 1px dashed rgb(37 34 29 / 0.18);
  border-radius: 18px;
  padding: 24px;
  color: var(--muted);
  background: rgb(255 250 241 / 0.58);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 14px 16px;
  color: var(--text);
}

.toast.error {
  border-color: rgb(159 49 44 / 0.32);
  color: var(--danger);
}

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .hero-card,
  .candidate-card {
    animation: rise-in 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes rise-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 680px);
  }

  .nav {
    align-items: flex-start;
    border-radius: 24px;
  }

  .nav-actions {
    display: none;
  }

  .hero-grid,
  .split-section,
  .bottom-section,
  .browse-heading,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    min-height: auto;
    padding: 42px 0 20px;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 5rem);
  }

  .hero-card {
    transform: none;
  }

  .span-2 {
    grid-column: auto;
  }

  .photo-form {
    grid-template-columns: 1fr;
  }
}
