/* Spill: a tipped bottle pours a pool of wine; the work happens in the pool. */
:root { --paper: #FBF3EA; --ink: #2B1B21; --muted: #6B5960; --wine: #7E1734; --wine-light: #C2405F; --wine-deep: #A3274A; --foil: #E8A13A; --line: #E3C4CD; }
body.spill { background: var(--wine); color: var(--ink); }
.spill a { color: var(--wine); }
.spill a:hover { color: #5C0F25; }
.w { fill: var(--wine); }
.wl { stroke: var(--wine-light); }

.spill .top { background: var(--paper); position: relative; }
.spill .brand { font-family: Fraunces, Georgia, serif; font-style: italic; font-weight: 700; font-size: 28px; text-decoration: none; }
.spill .site-head nav a { color: var(--ink); }
.spill .hero { position: relative; padding-block: 48px 24px; }
.spill .hero-text { max-width: 640px; display: flex; flex-direction: column; gap: 18px; }
.spill h1 { font-family: Fraunces, Georgia, serif; font-weight: 600; font-size: clamp(42px, 6vw, 68px); line-height: 0.98; letter-spacing: -0.02em; }
.spill h1 em { font-weight: 500; color: var(--wine); }
.spill .lede { font-size: 19px; max-width: 30em; }
.spill .kicker { font-size: 15px; font-weight: 600; color: var(--wine); }

/* The bottle hangs from the hero and pours down into the pool's edge. */
.spill .bottle { position: absolute; right: 40px; bottom: -140px; width: 420px; height: 700px; z-index: 2; overflow: visible; pointer-events: none; }
.spill .bottle.small { width: 300px; height: 500px; bottom: -100px; }
.spill .edge { width: 100%; height: 160px; background: var(--paper); }
.spill .pool { background: var(--wine); color: var(--paper); padding: 8px 0 24px; position: relative; }
.spill .pool a { color: var(--paper); }

.spill .card { background: #FFFFFF; color: var(--ink); border-radius: 22px; padding: 26px; box-shadow: 0 18px 40px rgba(60, 8, 22, 0.35); position: relative; z-index: 3; }
.spill .card a { color: var(--wine); }
.spill form.card { max-width: 780px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 22px; }
.spill .drop { border-color: var(--line); }
.spill .drop input[type=file]::file-selector-button { background: var(--wine); color: #FFFFFF; }
.spill .controls { display: flex; flex-direction: column; gap: 14px; }
.spill .field select { border: 1.5px solid var(--line); background: #FFFFFF; }
.spill details.source summary, .spill .note { color: var(--muted); }
.spill .pour { height: 52px; border: 0; border-radius: 999px; background: var(--wine); color: #FFFFFF; font-weight: 600; font-size: 17px; }
.spill .pour:hover { background: #5C0F25; }
.spill .error { grid-column: 1 / -1; background: #FBE7EC; color: #6E1430; }

.spill .export { margin-top: 64px; }
.spill .export h2, .spill .result h2.big { font-family: Fraunces, Georgia, serif; font-style: italic; font-weight: 600; font-size: 32px; margin-bottom: 18px; }
.spill .apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.spill .apps article { border: 1.5px solid rgba(251, 243, 234, 0.35); border-radius: 16px; padding: 20px; }
.spill .apps h3 { font-size: 17px; margin-bottom: 6px; }
.spill .apps p { color: #F1DCE2; font-size: 15px; }
.spill .site-foot { color: #F1DCE2; border-top: 1px solid rgba(251, 243, 234, 0.25); margin-top: 56px; }

/* Result */
.spill .route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.spill .route span { padding: 4px 12px; border-radius: 999px; border: 1.5px solid var(--ink); }
.spill .route span.to { background: var(--wine); border-color: var(--wine); color: #FFFFFF; }
.spill .stats { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 0 0 24px; }
.spill .stats div { font-size: 15px; color: #F1DCE2; }
.spill .stats strong { display: block; font-family: Fraunces, Georgia, serif; font-size: 40px; line-height: 1.1; color: var(--paper); }
.spill .result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px; align-items: start; }
.spill .card h2 { font-size: 18px; margin-bottom: 10px; }
.spill .result .card { display: flex; flex-direction: column; gap: 20px; }
.spill .fileicon { flex: none; width: 46px; height: 54px; border-radius: 8px; background: #F7E3E8; color: #6E1430; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-size: 11px; font-weight: 700; }
.spill .file small { color: var(--muted); font-size: 14px; }
.spill .get { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 22px; border-radius: 999px; background: var(--wine); color: #FFFFFF !important; font-weight: 600; text-decoration: none; }
.spill .steps li::before { border: 1.5px solid var(--wine); color: var(--wine); }
.spill .spilled { background: var(--paper); }
.spill .spilled p { color: var(--muted); }
.spill .losses dt, .spill .losses dd { border-color: var(--line); }
.spill .losses dd { color: var(--muted); }
.spill details.read { margin-top: 24px; color: var(--paper); }
.spill details.read summary { cursor: pointer; font-weight: 600; }
.spill .files li { border-color: rgba(251, 243, 234, 0.25); }
.spill .files small { color: #F1DCE2; }
.spill .again { margin-top: 28px; display: flex; gap: 18px; flex-wrap: wrap; font-weight: 600; }

/* The bottle is 560px above the pool's edge (420px for the small one), so
   the hero is at least that tall wherever the bottle shows; otherwise the
   bottle would climb into the masthead. */
@media (min-width: 1101px) {
  .spill .hero { min-height: 560px; }
  .spill .hero.short { min-height: 420px; }
}
@media (max-width: 1100px) {
  .spill .bottle { display: none; }
  .spill .edge { height: 90px; }
}

/* --- Motion (app.js): the pour flows, the pool rises with the upload --- */
.spill .detected.good { background: #FBEFF2; color: #5C0F25; }
.spill .detected.bad { background: #FFF4E0; color: #6B4A00; }
.spill .bottle { transition: transform 0.4s ease; transform-origin: 85% 15%; }
.spill .surface { transition: transform 0.25s ease-out; transform: translateY(calc(var(--level, 0) * -46px)); }
.spill.busy .flow { stroke-dasharray: 22 16; animation: flow 0.6s linear infinite; }
.spill.busy .ripple { transform-box: fill-box; transform-origin: center; animation: ripple 1s ease-out infinite; }
.spill.busy .ripple.outer { animation-delay: 0.5s; }
.spill.landed .ripple { transform-box: fill-box; transform-origin: center; animation: splash 0.35s ease-out forwards; }
.spill.dragging .bottle { transform: rotate(-7deg); }
.spill.dragging .drop { border-color: var(--wine); background: #FBEFF2; }
@keyframes flow { to { stroke-dashoffset: -38; } }
@keyframes ripple { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }
@keyframes splash { to { transform: scale(2.4); opacity: 0; } }
