/* ContentConverter — 2010 Apple skeuomorphic theme.
   Dark linen desktop, OS X window chrome, glossy Aqua "gel" controls. */

:root {
  --text: #333;
  --muted: #6e6e73;
  --accent: #d6367c; /* instagram default */
}

body[data-platform="instagram"] { --accent: #d6367c; }
body[data-platform="facebook"]  { --accent: #3b5998; }
body[data-platform="tiktok"]    { --accent: #2b2b30; }
body[data-platform="x"]         { --accent: #2c3e50; }
body[data-platform="youtube"]   { --accent: #cc181e; }

/* Gel gradient stops derived from the accent — hard gloss line at 50%,
   the signature Aqua "wet button" look. */
:root, body {
  --gel-top: color-mix(in srgb, var(--accent) 55%, white);
  --gel-upper: color-mix(in srgb, var(--accent) 82%, white);
  --gel-lower: var(--accent);
  --gel-bottom: color-mix(in srgb, var(--accent) 72%, black);
  --gel-border: color-mix(in srgb, var(--accent) 58%, black);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Lucida Grande", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  background: url("textures/linen-dark.svg") repeat #3a3d42;
}

.desktop {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 24px;
}

/* ---------- OS X window chrome ---------- */

.window {
  width: 100%;
  max-width: 820px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  background: #ececec;
}

/* ---------- Toolbar with segmented control ---------- */

.toolbar {
  padding: 10px 14px;
  background: linear-gradient(180deg, #e8e8e8 0%, #d4d4d4 50%, #c6c6c6 51%, #b4b4b4 100%);
  border-bottom: 1px solid #7f7f7f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tabs {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #6f6f6f;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: none;
  border-right: 1px solid #8a8a8a;
  background: linear-gradient(180deg, #fdfdfd 0%, #e8e8e8 50%, #d6d6d6 51%, #c9c9c9 100%);
  color: #3f3f3f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

.tab:last-child { border-right: none; }

.tab:hover:not(.active) {
  background: linear-gradient(180deg, #f2f2f2 0%, #dcdcdc 50%, #cacaca 51%, #bcbcbc 100%);
}

.tab:active:not(.active) {
  background: linear-gradient(180deg, #c2c2c2 0%, #cecece 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

.tab.active {
  background: linear-gradient(180deg,
    var(--gel-top) 0%,
    var(--gel-upper) 50%,
    var(--gel-lower) 51%,
    var(--gel-bottom) 100%);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.tab-icon { display: inline-flex; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.4)); }
.tab.active .tab-icon { filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.3)); }
.tab-icon svg { width: 15px; height: 15px; fill: currentColor; }

/* ---------- Window content ---------- */

.window-content {
  background: url("textures/noise-light.svg") repeat #f5f5f7;
  padding: 30px 34px 34px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.hero { text-align: center; }

.hero h1 {
  font-size: clamp(1.45rem, 4vw, 2rem);
  margin: 0 0 6px;
  color: #2f2f33;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.hero p {
  color: var(--muted);
  margin: 0 0 24px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ---------- Form ---------- */

.url-form {
  display: flex;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
}

#url-input {
  flex: 1;
  padding: 12px 76px 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1px solid #9d9da2;
  border-top-color: #86868c;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfbfb, #fff 40%);
  color: var(--text);
  outline: none;
  min-width: 0;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.18),
    inset 0 1px 2px rgba(0, 0, 0, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.8);
}

#url-input:focus {
  border-color: color-mix(in srgb, var(--accent) 65%, #888);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.18),
    0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent),
    0 1px 0 rgba(255, 255, 255, 0.8);
}

.paste-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid #8f8f94;
  background: linear-gradient(180deg, #fefefe 0%, #ececec 50%, #dcdcdc 51%, #d0d0d5 100%);
  color: #3f3f44;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  font-family: inherit;
  font-weight: bold;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 20px; /* capsule, like an OS X scope button */
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 1px rgba(0, 0, 0, 0.15);
}

.paste-btn:active {
  background: linear-gradient(180deg, #c9c9ce, #dcdcdc);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.25);
}

/* ---------- Aqua gel buttons ---------- */

.gel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--gel-border);
  border-radius: 24px;
  background: linear-gradient(180deg,
    var(--gel-top) 0%,
    var(--gel-upper) 50%,
    var(--gel-lower) 51%,
    var(--gel-bottom) 100%);
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Curved shine cap — the Aqua highlight */
.gel::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 4%;
  right: 4%;
  height: 48%;
  border-radius: 24px 24px 40px 40px / 24px 24px 24px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.gel:hover:not(:disabled) { filter: saturate(1.15) brightness(1.05); }

.gel:active:not(:disabled) {
  background: linear-gradient(180deg,
    var(--gel-bottom) 0%,
    var(--gel-lower) 60%,
    var(--gel-upper) 100%);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.5);
}

.gel:disabled { opacity: 0.65; cursor: wait; }

.convert-btn {
  padding: 12px 28px;
  font-size: 0.98rem;
  min-width: 132px;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: relative;
  z-index: 1;
}

.btn-label { position: relative; z-index: 1; }

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

/* ---------- Error: OS X alert strip ---------- */

.error-box {
  max-width: 640px;
  margin: 18px auto 0;
  padding: 11px 16px;
  border-radius: 8px;
  border: 1px solid #c76b62;
  background: linear-gradient(180deg, #ffe9e6, #fbd2cc);
  color: #8c2b22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ---------- Result: inner pane ---------- */

.result-card {
  display: flex;
  gap: 20px;
  background: linear-gradient(180deg, #ffffff, #f2f2f4);
  border: 1px solid #a9a9ae;
  border-radius: 10px;
  padding: 18px;
  margin: 26px 0 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 6px rgba(0, 0, 0, 0.18);
}

.result-media { flex-shrink: 0; }

#result-thumb {
  width: 190px;
  max-height: 240px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  border: 1px solid #8a8a8f;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  padding: 3px;               /* photo-frame matte, iPhoto style */
  background: #fff;
}

.thumb-fallback {
  width: 190px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  background: linear-gradient(180deg, #e8e8ec, #d8d8de);
  border: 1px solid #ababb0;
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.result-body { flex: 1; min-width: 0; }

.result-body h2 {
  margin: 0 0 3px;
  font-size: 1.05rem;
  word-break: break-word;
  color: #2f2f33;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.result-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 14px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.download-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 320px;
}

.quality-label {
  font-size: 0.8rem;
  font-weight: bold;
  color: #55555a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Aqua-style popup button */
.select-wrap {
  position: relative;
  width: 100%;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: 22px;
  border-radius: 6px;
  background:
    linear-gradient(180deg,
      var(--gel-top) 0%,
      var(--gel-upper) 50%,
      var(--gel-lower) 51%,
      var(--gel-bottom) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.select-wrap::before {
  content: "▲\A▼";
  white-space: pre;
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 22px;
  text-align: center;
  font-size: 6px;
  line-height: 1.5;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.35);
  z-index: 1;
  pointer-events: none;
}

#quality-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 8px 36px 8px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  color: #3f3f44;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid #8f8f94;
  border-radius: 8px;
  background: linear-gradient(180deg, #fefefe 0%, #ececec 50%, #dcdcdc 51%, #d0d0d5 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 1px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

#quality-select:focus {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}

.download-btn {
  padding: 10px 22px;
  font-size: 0.92rem;
  text-decoration: none;
  width: 100%;
}

.download-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ---------- How-to: recessed well ---------- */

.how-to {
  background: linear-gradient(180deg, #e4e4e8, #ececf0);
  border: 1px solid #b4b4b9;
  border-radius: 10px;
  padding: 20px 26px;
  margin: 26px 0 0;
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.8);
}

.how-to h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: #3a3a3f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.how-to ol { margin: 0; padding-left: 20px; color: #55555a; }
.how-to li { margin-bottom: 8px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }

/* ---------- Footer on linen ---------- */

.site-footer {
  margin-top: 26px;
  max-width: 820px;
}

.site-footer p {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6);   /* letterpress into the linen */
  font-size: 0.78rem;
  text-align: center;
}

/* ---------- Mobile: window runs edge to edge, linen only below ---------- */

@media (max-width: 620px) {
  .desktop { padding: 0 0 24px; }
  .window {
    max-width: none;
    border-radius: 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  }
  .window-content { padding: 22px 16px 24px; }
  .url-form { flex-direction: column; }
  .convert-btn { width: 100%; }
  .result-card { flex-direction: column; }
  #result-thumb, .thumb-fallback { width: 100%; max-height: 300px; }
  .download-controls { max-width: none; }
  .tab { font-size: 0.72rem; padding: 8px 4px; gap: 4px; }
  .tab-icon svg { width: 13px; height: 13px; }
  .site-footer { padding: 0 16px; }
}
