/* ==========================================================================
   Aqeeb Studio — Instagram Downloader
   Design tokens
   ========================================================================== */

:root {
  --ink: #080b14;
  --panel: #10151f;
  --panel-raised: #161c29;
  --line: #232b3d;
  --text: #edf1f7;
  --text-muted: #8a93a6;
  --accent: #33d690;
  --accent-ink: #06110c;
  --accent-soft: rgba(51, 214, 144, 0.14);
  --amber: #f2b84b;
  --danger: #f26d6d;

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

  --wrap: 1120px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.wrap {
  max-width: var(--wrap);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  border-bottom: 1px solid var(--line);
  padding-top: 18px;
  padding-bottom: 18px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.brand-mark {
  display: inline-flex;
  color: var(--accent);
  line-height: 0;
}

.primary-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.primary-nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 999px;
  transition:
    color 0.15s,
    background 0.15s;
}

.primary-nav a:hover {
  color: var(--text);
  background: var(--panel);
}

.primary-nav a.is-active {
  color: var(--accent-ink);
  background: var(--accent);
}

.primary-nav a.is-disabled {
  opacity: 0.55;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-top: clamp(40px, 7vw, 88px);
  padding-bottom: clamp(40px, 7vw, 88px);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero-copy h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  max-width: 18ch;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 46ch;
  margin: 0 0 28px;
}

.fetch-form {
  display: flex;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  max-width: 560px;
}

.fetch-form input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 13px 14px;
  outline: none;
  min-width: 0;
}

.fetch-form input::placeholder {
  color: var(--text-muted);
}

.fetch-form button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    transform 0.12s,
    opacity 0.15s;
}

.fetch-form button:hover {
  opacity: 0.92;
}
.fetch-form button:active {
  transform: scale(0.97);
}
.fetch-form button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(6, 17, 12, 0.35);
  border-top-color: var(--accent-ink);
  display: none;
  animation: spin 0.7s linear infinite;
}

.fetch-form button.is-loading .btn-spinner {
  display: inline-block;
}
.fetch-form button.is-loading .btn-label {
  display: none;
}

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

.trust-strip {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.status {
  margin-top: 14px;
  font-size: 0.92rem;
  min-height: 1.4em;
}
.status.is-error {
  color: var(--danger);
}
.status.is-ok {
  color: var(--accent);
}

.notice {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  color: var(--text-muted);
  max-width: 480px;
}

/* --- Hero device mock ------------------------------------------------- */

.hero-device {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.device-frame {
  width: min(260px, 100%);
  aspect-ratio: 9 / 18;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  position: relative;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.device-notch {
  width: 70px;
  height: 6px;
  border-radius: 4px;
  background: var(--line);
  margin: 0 auto 10px;
}

.device-screen {
  width: 100%;
  height: calc(100% - 24px);
  border-radius: 18px;
  background: var(--ink);
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
}

.device-idle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px;
}

.pulse-ring {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.6;
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.device-screen img,
.device-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.device-pause-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(8, 11, 20, 0.65);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.15s,
    transform 0.12s;
}
.device-pause-btn:hover {
  background: rgba(8, 11, 20, 0.85);
}
.device-pause-btn:active {
  transform: scale(0.92);
}

.device-badge {
  position: absolute;
  bottom: 18px;
  right: calc(50% - 130px - 46px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.6);
}

.device-badge .heart {
  color: var(--amber);
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-copy h1 {
    max-width: none;
  }
  .device-frame {
    width: min(220px, 60vw);
  }
  .device-badge {
    right: auto;
    left: 50%;
    transform: translateX(70px);
  }
}

/* ==========================================================================
   Result section
   ========================================================================== */

.result-section {
  padding-top: 12px;
  padding-bottom: 40px;
}

.result-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.result-caption {
  color: var(--text);
  font-size: 0.95rem;
  margin: 0 0 14px;
}

.result-stats {
  display: flex;
  gap: 18px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.result-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.result-item {
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.result-item .thumb {
  aspect-ratio: 1 / 1;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.result-item .thumb img,
.result-item .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-item a.download-btn {
  text-align: center;
  padding: 10px 8px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-outline {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.download-all-btn {
  display: block;
  width: 100%;
  max-width: 560px;
  margin-top: 14px;
  text-align: center;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    opacity 0.15s;
}

.download-all-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  border-color: var(--line);
  color: var(--text-muted);
}

.download-all-btn:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.download-all-btn:not(:disabled):hover {
  opacity: 0.9;
}

/* ==========================================================================
   Steps
   ========================================================================== */

.steps {
  padding-top: 56px;
  padding-bottom: 56px;
  border-top: 1px solid var(--line);
}

.steps h2,
.features h2,
.faq h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 32px;
}

.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.steps-list li {
  display: flex;
  gap: 14px;
}

.step-index {
  font-family: var(--font-mono);
  color: var(--accent);
  border: 1px solid var(--line);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.steps-list h3 {
  margin: 4px 0 6px;
  font-size: 1.02rem;
}

.steps-list p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.92rem;
}

@media (max-width: 780px) {
  .steps-list {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Features
   ========================================================================== */

.features {
  padding-top: 56px;
  padding-bottom: 56px;
  border-top: 1px solid var(--line);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.feature {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  background: var(--panel);
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-family: var(--font-display);
}

.feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   FAQ
   ========================================================================== */

.faq {
  padding-top: 56px;
  padding-bottom: 72px;
  border-top: 1px solid var(--line);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 18px;
  background: var(--panel);
}

.faq-item summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 500;
  list-style: none;
  position: relative;
  padding-right: 28px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item p {
  color: var(--text-muted);
  margin: 0 0 16px;
  font-size: 0.92rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--line);
  padding-top: 32px;
  padding-bottom: 20px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 2px;
}

.footer-by {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 0 0 12px;
}

.footer-disclaimer {
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 46ch;
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 16px;
  font-size: 0.88rem;
}

.footer-links a {
  text-decoration: none;
  color: var(--text-muted);
}
.footer-links a:hover {
  color: var(--text);
}

.footer-copy {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 28px 0 0;
}

/* ==========================================================================
   Error page
   ========================================================================== */

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
}

.error-content {
  text-align: center;
}

.error-code {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.error-content h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0 0 24px;
}
