/* ===========================================================================
   Ponyboy · IRL at Ponyboy
   Scroll-driven tear reveal. Deep red paper, warm cream, black ink.
   ========================================================================== */

:root {
  --red-paper:   #9b1c2c;
  --red-dark:    #721223;
  --red-ink:     #5c101c;
  --paper:       #e8d5b5;
  --paper-light: #f2e6ce;
  --paper-bright:#f8eed8;
  --ink:         #1a1a1a;
  --ink-soft:    #4a3f35;
  --ink-muted:   #7a6b5a;
  --error:       #a31626;
  --error-bg:    rgba(163, 22, 38, 0.08);
  --radius-sm:   10px;
  --radius:      16px;
  --radius-lg:   24px;
  --shadow:      0 24px 60px rgba(0, 0, 0, 0.18);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ===== Scroll-scrubbed tear reveal ===== */
/* Tall track creates the scroll distance; the sticky stage pins the video. */
.tear-track {
  position: relative;
  height: 420vh; /* ~320vh of tear scrub + ~100vh for the dive-through */
  background: var(--red-ink);
}

.tear-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: transparent; /* lets the form show through as the video fades */
  z-index: 2;
  pointer-events: none; /* scroll-driven only — never intercept clicks on the form beneath */
}

.tear-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* fills portrait phones edge-to-edge */
  display: block;
  pointer-events: none;
  background: var(--red-ink);
  transform-origin: 50% 46%; /* zoom into the torn opening */
  will-change: transform, opacity;
}

/* On landscape / desktop the 9:16 clip would crop the title, so show it
   whole and let its dark-red letterbox bars blend into the paper. */
@media (min-aspect-ratio: 1/1) {
  .tear-video { object-fit: contain; }
}

/* Scroll hint — fades out as the tear begins. */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255, 245, 235, 0.92);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.scroll-cue-text {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  letter-spacing: 0.02em;
}
.scroll-cue-arrow {
  font-size: 20px;
  animation: cue-bounce 1.6s ease-in-out infinite;
}
@keyframes cue-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* ===== Main paper / form ===== */
.paper {
  position: relative;
  z-index: 1; /* sits behind the sticky video so the dive zooms through into it */
  max-width: 720px;
  margin: -100vh auto 0; /* overlap the last viewport of the track for the dive */
  padding: 0 20px 60px;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.35), transparent 200px),
    var(--paper);
  transform-origin: 50% 22vh;
  will-change: transform, opacity;
}

.letterhead {
  text-align: center;
  padding: 110px 0 40px;
  animation: rise 0.9s ease-out both;
  animation-delay: 0.3s;
}

.stamp {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--red-paper);
  border: 1.5px solid var(--red-paper);
  padding: 8px 14px;
  margin: 0 0 22px;
  font-weight: 700;
}

.wordmark {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: clamp(44px, 10vw, 72px);
  margin: 0;
  line-height: 0.95;
  color: var(--ink);
}
.wordmark.script {
  font-family: "Dancing Script", cursive;
  font-size: clamp(52px, 12vw, 88px);
  font-weight: 700;
  line-height: 0.9;
}

.lede {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 20px;
  color: var(--ink-soft);
  margin: 10px 0 0;
}

/* ===== Application sheets ===== */
.application {
  background: var(--paper-light);
  border-radius: var(--radius-lg);
  padding: 10px 22px 34px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(155, 28, 44, 0.12);
  position: relative;
  animation: rise 0.9s ease-out both;
  animation-delay: 0.45s;
}
.application::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(155, 28, 44, 0.14);
  border-radius: calc(var(--radius-lg) - 10px);
  pointer-events: none;
}

.sheet {
  padding: 28px 0;
  border-bottom: 1px dashed rgba(155, 28, 44, 0.18);
  position: relative;
}
.sheet:last-of-type { border-bottom: none; }

.sheet-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--red-paper);
  margin: 0 0 20px;
}

.sheet-hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin: -12px 0 16px;
  line-height: 1.5;
}

/* ===== Fields ===== */
.field {
  display: block;
  margin: 0 0 20px;
  border: 0;
  padding: 0;
}
.field:last-child { margin-bottom: 0; }
.field--group { margin-bottom: 24px; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-paper);
  margin: 0 0 8px;
}
.field-label em {
  color: var(--red-dark);
  font-style: normal;
  margin-left: 2px;
}

.field-note {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin: 6px 0 0;
  line-height: 1.45;
}

.opt {
  color: var(--ink-muted);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

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

input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-bright);
  border: 1.5px solid rgba(74, 63, 53, 0.18);
  border-radius: var(--radius);
  padding: 15px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 72px; padding-top: 14px; }

input::placeholder, textarea::placeholder { color: var(--ink-muted); opacity: 0.75; }

input:hover, textarea:hover {
  background: #fff;
  border-color: rgba(74, 63, 53, 0.30);
}
input:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--red-paper);
  box-shadow: 0 0 0 4px rgba(155, 28, 44, 0.10);
  transform: translateY(-1px);
}

input.invalid, textarea.invalid,
.segmented.invalid,
.photo-drop.invalid,
.prefix.invalid {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 4px rgba(163, 22, 38, 0.10);
}

.prefix {
  display: flex;
  align-items: center;
  background: var(--paper-bright);
  border: 1.5px solid rgba(74, 63, 53, 0.18);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.prefix:focus-within {
  background: #fff;
  border-color: var(--red-paper);
  box-shadow: 0 0 0 4px rgba(155, 28, 44, 0.10);
}
.prefix span {
  padding: 0 4px 0 16px;
  color: var(--ink-muted);
  font-weight: 700;
  font-size: 15px;
}
.prefix input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding-left: 4px;
  background: transparent;
}
.prefix input:focus { box-shadow: none; transform: none; }

/* ===== Photo ===== */
.photo-drop {
  display: block;
  position: relative;
  border: 2px dashed var(--red-paper);
  border-radius: var(--radius);
  background: var(--paper-bright);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.photo-drop:hover {
  background: #fff;
  border-color: var(--red-dark);
  box-shadow: var(--shadow-soft);
}
.photo-drop.dragover {
  background: #fff;
  border-color: var(--red-paper);
  border-style: solid;
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(155, 28, 44, 0.12), var(--shadow-soft);
}
.photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 18px;
  text-align: center;
}
.photo-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(155, 28, 44, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--red-paper);
  margin-bottom: 4px;
}
.photo-cta {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 19px;
  color: var(--red-paper);
}
.photo-preview {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: inherit;
}
.photo-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  background: none;
  border: none;
  color: var(--red-paper);
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.text-btn:hover {
  background: rgba(155, 28, 44, 0.08);
  color: var(--red-dark);
}

/* ===== Chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--red-paper);
  background: var(--paper-bright);
  border: 1.5px solid rgba(155, 28, 44, 0.22);
  border-radius: 999px;
  padding: 9px 16px 9px 14px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip::before {
  content: "✚";
  font-size: 11px;
  opacity: 0.6;
}
.chip:hover {
  background: #fff;
  border-color: rgba(155, 28, 44, 0.40);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] {
  background: var(--red-paper);
  color: var(--paper-light);
  border-color: var(--red-paper);
  box-shadow: 0 5px 14px rgba(155, 28, 44, 0.30);
}
.chip[aria-pressed="true"]::before {
  content: "✓";
  opacity: 1;
  font-weight: 800;
}

/* ===== Segmented radios ===== */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  text-align: center;
  padding: 14px 12px;
  border-radius: var(--radius);
  background: var(--paper-bright);
  border: 1.5px solid rgba(74, 63, 53, 0.18);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.segmented span:hover {
  background: #fff;
  border-color: rgba(74, 63, 53, 0.32);
  transform: translateY(-1px);
}
.segmented input:checked + span {
  background: var(--red-paper);
  border-color: var(--red-paper);
  color: var(--paper-light);
  box-shadow: 0 5px 16px rgba(155, 28, 44, 0.30);
}
.segmented input:focus-visible + span {
  box-shadow: 0 0 0 4px rgba(155, 28, 44, 0.18);
}

/* ===== Honeypot ===== */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ===== Submit ===== */
.form-error {
  background: var(--error-bg);
  border: 1px solid rgba(163, 22, 38, 0.25);
  color: var(--error);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 700;
  margin: 26px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: shake 0.35s ease;
}
.form-error::before {
  content: "•";
  font-size: 20px;
  line-height: 0.8;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.submit {
  width: 100%;
  margin-top: 28px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--paper-light);
  background: var(--red-paper);
  border: none;
  border-radius: 999px;
  padding: 18px 28px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(155, 28, 44, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.submit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.14) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(155, 28, 44, 0.42), inset 0 1px 0 rgba(255,255,255,0.20);
}
.submit:hover::after { transform: translateX(100%); }
.submit:active { transform: translateY(1px); }
.submit:disabled {
  opacity: 0.75;
  cursor: progress;
  transform: none;
}
.submit:disabled::after { transform: none; }

.submit-spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fineprint {
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
  margin: 14px 0 0;
  line-height: 1.5;
}

/* ===== Success ===== */
.success {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--paper);
  animation: fade 0.5s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.success-card {
  background: var(--paper-light);
  color: var(--ink);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(155, 28, 44, 0.15);
  animation: pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pop {
  0% { transform: scale(0.85) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.success-mark {
  font-size: 80px;
  line-height: 1;
  color: var(--red-paper);
  filter: drop-shadow(0 6px 14px rgba(155, 28, 44, 0.25));
}
.success-card h2 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 38px;
  color: var(--red-paper);
  margin: 18px 0 12px;
}
.success-card p { color: var(--ink-soft); margin: 0 auto 10px; max-width: 34ch; line-height: 1.6; }
.success-sub { font-weight: 700; color: var(--red-paper) !important; }

/* ===== Animations ===== */
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* No scroll-scrub: collapse the track to a single static reveal frame. */
  .tear-track { height: 100vh; }
  .scroll-cue { display: none; }
  .paper { margin-top: 0; } /* no dive overlap when motion is reduced */
}

/* ===== Responsive ===== */
@media (min-width: 480px) {
  .paper { padding: 0 28px 80px; }
  .letterhead { padding-top: 130px; }
  .application { padding-left: 34px; padding-right: 34px; }
  .sheet { padding: 34px 0; }
  .sheet-title { font-size: 32px; }
}

@media (min-width: 640px) {
  .paper { padding-top: 20px; }
  .application { padding: 14px 44px 46px; }
  .lede { font-size: 22px; }
}
