/* ---------------------------------------------------------------------
   Lnky — token system
   bg-ink:      #0B1220   deep navy, primary background
   bg-surface:  #131B2E   card / raised surface
   bg-surface-2:#1B2540   hover / border-adjacent surface
   accent-gold: #FFC145   primary accent — the "link" color, used sparingly
   accent-mint: #5EEAD4   secondary accent — success / audio
   text-hi:     #F5F3ED   primary text
   text-lo:     #8B93A7   muted text
   line:        #232E4A   hairline borders
   -------------------------------------------------------------------- */

:root {
  --bg-ink: #0B1220;
  --bg-surface: #131B2E;
  --bg-surface-2: #1B2540;
  --accent-gold: #FFC145;
  --accent-gold-dim: #7A6329;
  --accent-mint: #5EEAD4;
  --text-hi: #F5F3ED;
  --text-lo: #8B93A7;
  --line: #232E4A;
  --danger: #FF6B6B;

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-lift: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-ink);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(255, 193, 69, 0.08), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(94, 234, 212, 0.06), transparent 45%);
  color: var(--text-hi);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.is-rtl {
  font-feature-settings: "kern" 1;
}

a { color: inherit; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  color: var(--accent-gold);
  width: 28px;
  height: 28px;
  display: inline-flex;
}
.brand-mark svg { width: 100%; height: 100%; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.lang-switch {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.lang-switch button {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: none;
  border: none;
  color: var(--text-lo);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-switch button.is-active {
  background: var(--accent-gold);
  color: #221a06;
}

/* ---------- hero ---------- */
.hero {
  padding: 72px 0 48px;
}

.hero-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-mint);
  margin: 0 0 18px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  white-space: pre-line;
  max-width: 16ch;
}

.hero-subtitle {
  color: var(--text-lo);
  font-size: 17px;
  max-width: 46ch;
  margin: 0 0 40px;
}

/* ---------- url form ---------- */
.url-form {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.url-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 6px 8px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
body.is-rtl .url-field { padding: 6px 16px 6px 8px; }

.url-field:focus-within {
  border-color: var(--accent-gold-dim);
  box-shadow: 0 0 0 4px rgba(255, 193, 69, 0.08);
}

.link-glyph {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--text-lo);
  display: inline-flex;
}
.link-glyph svg { width: 100%; height: 100%; }

.glyph-b, .glyph-c {
  transform-origin: center;
  transition: transform 0.4s ease;
}

.link-glyph.is-linking {
  color: var(--accent-gold);
}
.link-glyph.is-linking .glyph-a {
  animation: glyph-pulse 0.9s ease-in-out infinite;
}
.link-glyph.is-linking .glyph-b {
  animation: glyph-close-b 0.9s ease-in-out infinite;
}
.link-glyph.is-linking .glyph-c {
  animation: glyph-close-c 0.9s ease-in-out infinite;
}

@keyframes glyph-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
@keyframes glyph-close-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-1.5px, 1.5px); }
}
@keyframes glyph-close-c {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(1.5px, -1.5px); }
}

.url-field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text-hi);
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 12px 0;
}
.url-field input::placeholder { color: #4C5670; }
.url-field input:focus { outline: none; }

.paste-btn {
  flex: none;
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  color: var(--text-hi);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}
.paste-btn:hover { background: #24304F; }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  padding: 14px 24px;
  transition: transform 0.15s ease, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent-gold);
  color: #221a06;
}
.btn-primary:hover { background: #FFCE6B; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.submit-btn { align-self: stretch; }

.form-hint {
  color: var(--text-lo);
  font-size: 13px;
  margin: 4px 0 0;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  min-height: 0;
  margin: 0;
  display: none;
}
.form-error.is-visible { display: block; margin-top: 4px; }

/* ---------- result ---------- */
.result {
  width: 100%;
  max-width: 640px;
  margin-top: 32px;
  display: none;
  text-align: start;
}
.result.is-visible { display: block; }

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.result-title {
  font-weight: 600;
  margin: 0;
  font-size: 15px;
}

.result-author {
  color: var(--text-lo);
  font-size: 13px;
  margin: 4px 0 0;
  font-family: var(--font-mono);
}

.chip {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  color: var(--accent-mint);
  padding: 4px 10px;
  border-radius: 999px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.media-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.media-preview {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #000;
}

.media-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.media-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-lo);
}
.media-tag-alt { color: var(--accent-mint); }

.btn-download {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  background: var(--accent-gold);
  color: #221a06;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}
.btn-download.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-hi);
}

/* ---------- panels: history + how-it-works ---------- */
.panel-section {
  padding: 40px 0;
}

.two-col {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: start;
}

.history-card, .how-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-card h2, .how-card h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-lo);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.link-btn:hover { color: var(--text-hi); }

.history-empty {
  color: var(--text-lo);
  font-size: 14px;
  margin: 8px 0 0;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.history-item:hover { background: var(--bg-surface-2); }

.history-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-surface-2);
  flex: none;
}

.history-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.history-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-sub {
  font-size: 12px;
  color: var(--text-lo);
  font-family: var(--font-mono);
}

.history-open {
  flex: none;
  background: var(--bg-surface-2);
  border: 1px solid var(--line);
  color: var(--text-hi);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
}

.how-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.how-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.how-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--accent-gold-dim);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.how-step-title {
  font-weight: 600;
  margin: 0 0 2px;
  font-size: 14px;
}

.how-step-body {
  color: var(--text-lo);
  font-size: 13px;
  margin: 0;
}

/* ---------- trust ---------- */
.trust-section { padding: 0 0 60px; }

.trust-card {
  background: linear-gradient(135deg, rgba(255, 193, 69, 0.08), rgba(94, 234, 212, 0.05));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}

.trust-card h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 8px;
}

.trust-card p {
  color: var(--text-lo);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-lo);
  font-size: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 32px; }
  .url-field { padding: 6px 6px 6px 12px; flex-wrap: nowrap; }
  .paste-btn { padding: 8px 10px; font-size: 12px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 17px; }
  .hero-title { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .link-glyph.is-linking .glyph-a,
  .link-glyph.is-linking .glyph-b,
  .link-glyph.is-linking .glyph-c {
    animation: none;
  }
}
