:root {
  --ink: #10231c;
  --moss: #1f4d3a;
  --leaf: #2f7a56;
  --foam: #e7f2ec;
  --sand: #f3efe6;
  --line: rgba(16, 35, 28, 0.12);
  --warn: #b45309;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 24px 60px rgba(16, 35, 28, 0.12);
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sand);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, #d7ebe1 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #efe4cf 0%, transparent 50%),
    linear-gradient(180deg, #f7f4ec 0%, #ebe6da 100%);
  color: var(--ink);
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.top, main, footer { position: relative; z-index: 1; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
}

.brand {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.6rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}

nav a {
  color: var(--moss);
  text-decoration: none;
  font-weight: 500;
}

.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
  animation: rise 0.7s ease both;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--leaf);
}

.logo-hero {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(3.4rem, 10vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0.9rem auto 1.8rem;
  max-width: 28rem;
  font-size: 1.15rem;
  color: rgba(16, 35, 28, 0.72);
}

.panel {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 0.85rem;
  box-shadow: var(--shadow);
  animation: rise 0.85s 0.08s ease both;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  font: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input[type="url"]:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 122, 86, 0.18);
}

button {
  border: 0;
  border-radius: var(--radius);
  padding: 0.95rem 1.35rem;
  font: inherit;
  font-weight: 700;
  background: var(--ink);
  color: #f7f4ec;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

button:hover { background: var(--moss); }
button:active { transform: translateY(1px); }
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0.15rem;
  font-size: 0.92rem;
  color: rgba(16, 35, 28, 0.7);
}
.status.error { color: var(--danger); }

.result {
  max-width: 820px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem 2rem;
  animation: rise 0.55s ease both;
}

.hidden { display: none !important; }

.meta {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.meta img {
  width: 160px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 12px;
  background: var(--foam);
  border: 1px solid var(--line);
}

.meta h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.meta p {
  margin: 0;
  color: rgba(16, 35, 28, 0.65);
  font-size: 0.95rem;
}

.formats {
  display: grid;
  gap: 0.6rem;
}

.format {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.format span {
  font-weight: 600;
}

.format small {
  display: block;
  margin-top: 0.15rem;
  font-weight: 400;
  color: rgba(16, 35, 28, 0.55);
}

.format button {
  padding: 0.65rem 1rem;
  background: var(--leaf);
}

.progress-wrap {
  margin-top: 1.25rem;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(16, 35, 28, 0.08);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--moss), var(--leaf));
  transition: width 0.25s ease;
}

#progressText {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  color: rgba(16, 35, 28, 0.7);
}

.how {
  max-width: 820px;
  margin: 1rem auto 3rem;
  padding: 0 1.5rem;
  text-align: left;
}

.how h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 2rem;
  margin: 0 0 0.75rem;
}

.how ol {
  margin: 0;
  padding-left: 1.2rem;
  color: rgba(16, 35, 28, 0.78);
  line-height: 1.7;
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: rgba(16, 35, 28, 0.5);
  font-size: 0.85rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 1fr; }
  .meta img { width: 100%; }
  .format { flex-direction: column; align-items: stretch; }
}
