/* Shared design tokens and components. ChatGPT-like palette, type scale, line icons and motion; own layout. */
@view-transition { navigation: auto; }

:root {
  color-scheme: dark;
  interpolate-size: allow-keywords; /* lets <details> animate to height:auto */
  --bg: #212121;
  --surface: #2f2f2f;
  --surface-2: #383838;
  --hover: #2f2f2f;
  --line: rgba(255, 255, 255, 0.1);
  --text: #ececec;
  --muted: #9b9b9b;
  --danger: #f87171;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #8ab4ff; outline-offset: 2px; }

::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.28s; animation-timing-function: var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page { max-width: 820px; margin: 0 auto; padding: 0 20px 72px; }
/* content eases in whenever a view appears */
.page > *, .view > * { animation: fadeUp 0.5s var(--ease) both; }
.page > *:nth-child(2), .view > *:nth-child(2) { animation-delay: 0.05s; }
.page > *:nth-child(3), .view > *:nth-child(3) { animation-delay: 0.1s; }
.page > *:nth-child(4), .view > *:nth-child(4) { animation-delay: 0.15s; }
.page > *:nth-child(n + 5), .view > *:nth-child(n + 5) { animation-delay: 0.2s; }

/* ---------- header ---------- */
.top {
  max-width: 1040px;
  margin: 0 auto;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.4s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 16px; margin-right: auto; }
.logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface);
  transition: transform 0.3s var(--spring);
}
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); }
.logo .eye { fill: var(--surface); }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}
.nav-link:hover { background: var(--hover); }
.nav-link:disabled { opacity: 0.4; cursor: default; }
.nav-link svg { flex: none; }

.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.progress > div { height: 100%; width: 0; background: var(--text); transition: width 0.3s var(--ease); }

/* ---------- buttons and shared motion ---------- */
.btn, .nav-link, .icon-btn, .tool-card, .saved-item, .linkish {
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease),
    transform 0.15s var(--ease), opacity 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:active, .icon-btn:active, .nav-link:active { transform: scale(0.96); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #d7d7d7; }
.btn:disabled { background: #4a4a4a; color: #8a8a8a; cursor: not-allowed; }
.btn.big { height: 48px; padding: 0 26px; font-size: 16px; }
.btn.outline { background: none; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.outline:hover { background: var(--hover); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.lead { color: var(--muted); font-size: 16px; margin: 0; }

/* ---------- home ---------- */
.tool-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon body" "icon go";
  column-gap: 20px;
  row-gap: 14px;
  align-items: start;
  margin-top: 24px;
  padding: 22px;
  background: var(--surface);
  border-radius: 24px;
  text-decoration: none;
}
.tool-card:hover { background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.tool-card:active { transform: translateY(0) scale(0.995); }
.tool-icon {
  grid-area: icon;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: transform 0.35s var(--spring);
}
.tool-icon .eye { fill: var(--bg); }
.tool-card:hover .tool-icon { transform: rotate(-6deg) scale(1.05); }
.tool-body { grid-area: body; min-width: 0; }
.tool-body h2 { font-size: 20px; font-weight: 600; margin: 2px 0 4px; }
.tool-body p { margin: 0; font-size: 15px; color: var(--muted); }
.tool-body p + p { margin-top: 4px; }
.tool-go { grid-area: go; justify-self: end; }
.tool-go svg { transition: transform 0.25s var(--ease); }
.tool-card:hover .tool-go svg { transform: translateX(3px); }

@media (max-width: 640px) {
  .tool-card { grid-template-columns: 1fr; grid-template-areas: "icon" "body" "go"; }
  .nav-link span { display: none; }
  .nav-link { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
