/* downloadsuno — warm analog console / editorial print */

:root {
  --ink: #131010;
  --ink-2: #1a1615;
  --ink-3: #221c1a;
  --paper: #f2ece1;
  --paper-dim: #a2988a;
  --ember: #ff6a2b;
  --ember-soft: #ffb389;
  --line: rgba(242, 236, 225, 0.13);
  --line-strong: rgba(242, 236, 225, 0.28);
  --radius: 2px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Karla', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- atmosphere ------------------------------------------------------- */

.grain {
  position: fixed;
  inset: -50%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: drift 7s steps(6) infinite;
}

@keyframes drift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-2%, 1%); }
  66%  { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

.glow {
  position: fixed;
  top: -28vh;
  right: -14vw;
  width: 70vw;
  height: 70vw;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255, 106, 43, 0.17), rgba(255, 106, 43, 0) 62%);
  filter: blur(12px);
}

/* ---- shell ------------------------------------------------------------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 104px) clamp(20px, 5vw, 56px) 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  grid-template-areas:
    'mast specs'
    'deck  specs'
    'result specs';
  column-gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

/* ---- masthead ---------------------------------------------------------- */

.masthead {
  grid-area: mast;
  animation: rise 0.9s var(--ease) both;
}

.kicker, .label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember);
  margin: 0 0 14px;
}

.wordmark {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(58px, 12vw, 132px);
  line-height: 0.86;
  letter-spacing: -0.02em;
  margin: 0;
}

.wordmark span {
  font-style: italic;
  color: var(--ember);
}

.lede {
  max-width: 46ch;
  margin: 26px 0 0;
  color: var(--paper-dim);
  font-weight: 300;
  font-size: 17px;
}

.lede em {
  font-style: normal;
  color: var(--paper);
  border-bottom: 1px solid var(--ember);
  padding-bottom: 1px;
}

/* ---- deck -------------------------------------------------------------- */

.deck {
  grid-area: deck;
  margin-top: clamp(34px, 6vw, 64px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0)) , var(--ink-2);
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.9);
  animation: rise 0.9s var(--ease) 0.08s both;
}

.deck-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.deck-head .label { margin: 0; }

.hint, .mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--paper-dim);
  margin: 0;
}

.entry {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

#input {
  flex: 1;
  min-width: 0;
  background: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--paper);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 14px;
  padding: 16px 18px;
  outline: none;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

#input::placeholder { color: rgba(162, 152, 138, 0.5); }

#input:focus {
  border-color: var(--ember);
  box-shadow: 0 0 0 1px rgba(255, 106, 43, 0.35), 0 0 34px -8px rgba(255, 106, 43, 0.45);
}

/* ---- buttons ----------------------------------------------------------- */

.btn {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius);
  padding: 0 26px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.16s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
}

.btn:active { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--ember);
  color: #1a0e07;
  font-weight: 500;
}

.btn.primary:hover:not(:disabled) { background: var(--ember-soft); }

.btn.ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--line-strong);
}

.btn.ghost:hover:not(:disabled) { border-color: var(--ember); color: var(--ember-soft); }

/* ---- samples ----------------------------------------------------------- */

.samples {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.samples .label { margin: 0 4px 0 0; color: var(--paper-dim); }

.chip {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--paper-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.chip:hover { color: var(--ember); border-color: var(--ember); background: rgba(255, 106, 43, 0.07); }

/* ---- pipeline ---------------------------------------------------------- */

.pipeline {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin: 26px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}

.pipeline li {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: rgba(162, 152, 138, 0.55);
  display: flex;
  gap: 9px;
  align-items: baseline;
  transition: color 0.35s var(--ease);
}

.pipeline li b {
  font-weight: 500;
  color: rgba(162, 152, 138, 0.4);
  transition: color 0.35s var(--ease);
}

.pipeline li.on { color: var(--paper); }
.pipeline li.on b { color: var(--ember); }

.status {
  margin: 18px 0 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--paper-dim);
  min-height: 1.4em;
}

.status.err { color: #ff7a6b; }
.status.ok { color: var(--ember-soft); }

/* ---- result ------------------------------------------------------------ */

.result {
  grid-area: result;
  margin-top: clamp(26px, 4vw, 40px);
  border-top: 1px solid var(--line);
  padding-top: clamp(26px, 4vw, 40px);
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 38px);
  align-items: start;
  animation: rise 0.7s var(--ease) both;
}

.cover {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink-2);
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.disc {
  position: absolute;
  inset: -18%;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.disc.on { opacity: 1; }
.disc.spin { animation: spin 4s linear infinite; }

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

.meta h2 {
  font-family: 'Instrument Serif', 'Noto Serif SC', Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.05;
  margin: 0 0 6px;
}

.meta .mono { word-break: break-all; }

audio {
  width: 100%;
  margin: 22px 0 20px;
  height: 38px;
  filter: invert(1) hue-rotate(180deg);
}

.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions .btn { padding: 13px 24px; }

.bar {
  margin-top: 20px;
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ember);
  transition: width 0.18s linear;
}

/* ---- language picker --------------------------------------------------- */

.langs { margin-bottom: 30px; }

.lang-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--paper-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.lang:hover { color: var(--ember-soft); border-color: var(--ember); }

.lang.on {
  color: var(--ember);
  border-color: var(--ember);
  background: rgba(255, 106, 43, 0.1);
}

/* ---- specs ------------------------------------------------------------- */

.specs {
  grid-area: specs;
  border-left: 1px solid var(--line);
  padding-left: clamp(18px, 2vw, 30px);
  animation: rise 0.9s var(--ease) 0.16s both;
}

.specs .label { color: var(--paper-dim); }

.specs dl { margin: 0; }

.specs dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.specs dt, .specs dd {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px;
  margin: 0;
}

.specs dt {
  color: rgba(162, 152, 138, 0.75);
  word-break: keep-all;
  overflow-wrap: normal;
}
.specs dd { color: var(--paper); text-align: right; }

.dim { color: rgba(162, 152, 138, 0.7); line-height: 1.7; }

/* ---- footer ------------------------------------------------------------ */

.foot {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px clamp(20px, 5vw, 56px) 46px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

/* ---- motion ------------------------------------------------------------ */

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: 'mast' 'deck' 'result' 'specs';
  }
  .specs { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 26px; }
  .result { grid-template-columns: 1fr; }
  .cover { max-width: 190px; }
}
