/* static/css/app.css — ddd family design (shared with dddtwitter) */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #0f1419;
  --muted: #536471;
  --accent: #1d9bf0;
  --accent-dark: #1a8cd8;
  --accent-soft: #e8f3fd;
  --line: #e1e8ed;
  --error-bg: #fde8e8;
  --error-ink: #b3261e;
  --container: 1120px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
       "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
       background: var(--bg); color: var(--ink); line-height: 1.6; }
.hidden { display: none !important; }

/* ---------- header ---------- */
.header { display: flex; align-items: center; justify-content: space-between;
          max-width: var(--container); margin: 0 auto; padding: .9rem 1rem; }
.brand { display: inline-flex; align-items: center;
         font-weight: 800; font-size: 1.55rem; color: var(--ink); text-decoration: none; }
.brand-accent { color: var(--accent); }
.nav a { margin-left: 1.25rem; color: var(--muted); text-decoration: none;
         font-size: .92rem; font-weight: 600; }
.nav a:hover { color: var(--accent); }

/* ---------- language switcher (pure HTML <details>, crawlable links) ---------- */
.lang-menu { position: relative; }
.lang-menu summary { list-style: none; cursor: pointer; white-space: nowrap;
                     font-size: .9rem; font-weight: 600; color: var(--muted);
                     padding: .35rem .8rem; border: 1px solid var(--line);
                     border-radius: 999px; background: var(--card);
                     transition: color .15s ease, border-color .15s ease; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu[open] summary, .lang-menu summary:hover { color: var(--accent); border-color: var(--accent); }
.lang-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 20;
             list-style: none; margin: 0; padding: .4rem; min-width: 190px;
             max-height: 60vh; overflow-y: auto;
             background: var(--card); border: 1px solid var(--line); border-radius: 12px;
             box-shadow: 0 10px 28px rgba(15, 20, 25, .12); }
.lang-list a { display: block; padding: .35rem .7rem; border-radius: 8px;
               color: var(--ink); text-decoration: none; font-size: .9rem; }
.lang-list a:hover { background: var(--accent-soft); }
.lang-list a.current { color: var(--accent); font-weight: 700; }

/* ---------- hero: the search box is the primary CTA ---------- */
.hero { background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
        border-bottom: 1px solid var(--line);
        padding: 3.5rem 1rem 3rem; text-align: center; }
.hero h1 { font-size: clamp(1.45rem, 1rem + 2.2vw, 2.3rem); font-weight: 800;
           line-height: 1.3; max-width: 860px; margin: 0 auto 1rem; }
.hero h1 .accent { color: var(--accent); }
.subtitle { color: var(--muted); max-width: 640px; margin: 0 auto 1.9rem; }

.form { display: flex; flex-direction: column; gap: .7rem;
        max-width: 780px; margin: 0 auto;
        background: var(--card); padding: .5rem;
        border: 1px solid var(--line); border-radius: 16px;
        box-shadow: 0 10px 28px rgba(15, 20, 25, .08);
        transition: border-color .15s ease, box-shadow .15s ease; }
.form:focus-within { border-color: var(--accent);
        box-shadow: 0 10px 28px rgba(15, 20, 25, .08), 0 0 0 3px rgba(29, 155, 240, .25); }
.search-row { display: flex; gap: .55rem; align-items: stretch; }
.input-row { position: relative; flex: 1; min-width: 0; }
#url-input { width: 100%; min-height: 48px; border: 0; background: transparent;
             padding: .6rem 2.9rem .6rem 1rem; font-size: 1.05rem; color: var(--ink); }
#url-input:focus { outline: none; }
.icon-btn { position: absolute; top: 50%; right: .5rem; transform: translateY(-50%);
            background: none; border: none; font-size: 18px; cursor: pointer;
            min-height: 40px; padding: 0 .5rem; }
.btn { border: none; border-radius: 12px; cursor: pointer; font-weight: 700; }
.btn-download { min-height: 48px; padding: 0 1.7rem; font-size: 1.05rem;
                background: var(--accent); color: #fff; border-radius: 11px;
                white-space: nowrap;
                transition: background .15s ease, transform .1s ease; }
.btn-download:hover { background: var(--accent-dark); }
.btn-download:active { transform: scale(.98); }
.btn-download:focus-visible { outline: 3px solid rgba(29, 155, 240, .45); outline-offset: 2px; }
.btn-download:disabled { opacity: .6; cursor: wait; }
.formats { list-style: none; display: flex; justify-content: center; flex-wrap: wrap;
           gap: .5rem; margin: .2rem 0 0; padding: 0; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px;
        padding: .22rem .85rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.error { margin: 0; padding: .55rem .9rem; border-radius: 10px;
         background: var(--error-bg); color: var(--error-ink); font-size: .9rem; text-align: start; }
.spinner { display: inline-block; width: 17px; height: 17px; vertical-align: middle;
           margin-right: 6px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
           border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- result card ---------- */
.result { max-width: 820px; margin: 1.5rem auto; padding: 0 1rem; }
.result-card { display: flex; gap: .9rem; text-align: start;
               background: var(--card); border: 1px solid var(--line);
               border-radius: 14px; padding: 1.2rem;
               box-shadow: 0 6px 20px rgba(15, 20, 25, .06); }
.thumb { width: 120px; border-radius: 10px; object-fit: cover; align-self: flex-start; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }
.result-meta { flex: 1; min-width: 0; }
.author { color: var(--muted); font-size: .9rem; margin-left: 6px; }
.title { margin: .35rem 0; font-size: 1rem; line-height: 1.45; }
.stats { display: flex; gap: .9rem; color: var(--muted); font-size: .88rem; }
.buttons { display: grid; gap: .6rem; margin-bottom: .8rem; }
.btn-dl { display: flex; align-items: center; justify-content: center; gap: .55rem;
          min-height: 48px; padding: .7rem 1.2rem; font-size: 1rem; font-weight: 700;
          color: #fff; background: var(--accent); border-radius: 999px;
          text-decoration: none;
          transition: background .15s ease, transform .1s ease; }
.btn-dl:hover { background: var(--accent-dark); }
.btn-dl:active { transform: scale(.98); }
.btn-dl:focus-visible { outline: 3px solid rgba(29, 155, 240, .45); outline-offset: 2px; }
.btn-dl svg { flex: none; }
.btn-secondary { background: var(--card); color: var(--muted); padding: .65rem 1.2rem;
                 border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--accent-soft); color: var(--ink); }

/* ---------- content sections ---------- */
.content.below { max-width: 820px; margin: 2.5rem auto; padding: 0 1rem; color: var(--ink); }
.content.below article { margin-bottom: 2.5rem; }
.content.below h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
.content.below h3 { font-size: .98rem; margin: 1.1rem 0 .25rem; }
.content.below p { color: var(--muted); line-height: 1.7; margin: 0 0 .6rem; font-size: .95rem; }
.steps { padding-inline-start: 1.3rem; margin: 0; }
.steps li { line-height: 1.7; margin-bottom: .5rem; font-size: .95rem; }
ul.features { list-style: none; margin: 1rem 0 0; padding: 0;
              display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.features li { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
               padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .25rem; }
.features .ico { font-size: 1.3rem; line-height: 1.2; }
.features strong { font-size: .98rem; }
.features span.desc { color: var(--muted); font-size: .88rem; }

/* ---------- footer ---------- */
.footer { max-width: var(--container); margin: 0 auto; text-align: start;
          color: var(--muted); font-size: .85rem; padding: 1.2rem 1rem;
          border-top: 1px solid var(--line); }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- legal / trust pages ---------- */
.content.below.legal h1 { font-size: 1.45rem; margin: 0 0 .3rem; }
.content.below.legal .legal-updated { color: var(--muted); font-size: .85rem;
                                      margin: 0 0 1.6rem; }
.content.below.legal h2 { margin: 1.8rem 0 .5rem; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 2.5rem 1rem 2.2rem; }
  .search-row { flex-direction: column; }
  .btn-download { width: 100%; }
  ul.features { grid-template-columns: 1fr; }
  .result-card { flex-direction: column; }
  .thumb { width: 100%; max-height: 300px; }
}
@media (max-width: 420px) {
  .header { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
  .nav a { margin: 0 8px; }
}

/* ---------- RTL (Arabic and other rtl locales) ---------- */
[dir="rtl"] .icon-btn { right: auto; left: .5rem; }
[dir="rtl"] #url-input { padding: .6rem 1rem .6rem 2.9rem; }
[dir="rtl"] .author { margin-left: 0; margin-right: 6px; }
