/* Custom styles — dùng kèm Tailwind CDN (darkMode: class) */

/* Base */
html {
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: rgb(31 41 55);
  letter-spacing: -0.01em;
}
html.dark body {
  color: rgb(243 244 246);
  background-color: #030712; /* gray-950 fallback */
}

/* Link cards — Cupertino style: rounded-cupertino, glass surface */
.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.045);
  padding: 1rem 1.25rem;
  font-weight: 500;
  color: rgb(31 41 55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.link-card:hover {
  background: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
  transform: scale(1.01);
}
.link-card:active {
  transform: scale(0.99);
}
html.dark .link-card {
  background: rgb(31 41 55 / 0.88);
  border-color: rgba(255,255,255,0.065);
  color: rgb(243 244 246);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
}
html.dark .link-card:hover {
  background: rgb(55 65 81);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.25);
}

/* Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.22) transparent;
}
html.dark * {
  scrollbar-color: rgba(255,255,255,0.28) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.22);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.35);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
html.dark *::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.28);
}
html.dark *::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.45);
}

/* Dialog content (Markdown) — typography + One Dark code */
.dialog-content {
  font-size: 1rem;
  line-height: 1.7;
  color: #374151;
  letter-spacing: 0.01em;
}
html.dark .dialog-content {
  color: #e5e7eb;
}
.dialog-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.5em 0 0.5em;
  color: #111827;
  letter-spacing: -0.025em;
  line-height: 1.3;
  padding-bottom: 0.35em;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.dialog-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.35em 0 0.45em;
  color: #1f2937;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.dialog-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.15em 0 0.35em;
  color: #374151;
}
html.dark .dialog-content h1 {
  color: #f9fafb;
  border-bottom-color: rgba(255,255,255,0.08);
}
html.dark .dialog-content h2 {
  color: #f3f4f6;
}
html.dark .dialog-content h3 {
  color: #e5e7eb;
}
.dialog-content p {
  margin: 0.75em 0;
}
.dialog-content p:first-of-type {
  margin-top: 0;
}
.dialog-content ul,
.dialog-content ol {
  margin: 0.75em 0;
  padding-left: 1.6em;
}
.dialog-content li {
  margin: 0.35em 0;
}
.dialog-content li::marker {
  color: #6b7280;
}
html.dark .dialog-content li::marker {
  color: #d1d5db;
}
.dialog-content blockquote {
  margin: 1em 0;
  padding: 0.75em 1em 0.75em 1.25em;
  border-left: 4px solid #61afef;
  background: rgba(97, 175, 239, 0.06);
  color: #4b5563;
  border-radius: 0 8px 8px 0;
  font-style: normal;
}
html.dark .dialog-content blockquote {
  border-left-color: #61afef;
  background: rgba(97, 175, 239, 0.08);
  color: #e5e7eb;
}
.dialog-content a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.dialog-content a:hover {
  color: #1d4ed8;
  border-bottom-color: currentColor;
}
html.dark .dialog-content a {
  color: #60a5fa;
}
html.dark .dialog-content a:hover {
  color: #93c5fd;
}
.dialog-content code {
  font-family: 'SF Mono', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.22em 0.5em;
  border-radius: 6px;
  background: #282c34;
  color: #abb2bf;
  font-weight: 500;
  border: 1px solid rgba(0,0,0,0.15);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.dialog-content pre {
  margin: 1.25em 0;
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.8125rem;
  line-height: 1.6;
  background: #282c34;
  color: #abb2bf;
  border: 1px solid rgba(0,0,0,0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04) inset;
}
.dialog-content pre::before {
  content: '';
  display: block;
  height: 36px;
  background: #21252b;
  border-bottom: 1px solid rgba(0,0,0,0.2);
  padding: 0 14px;
  box-sizing: border-box;
  background-image:
    radial-gradient(circle at 12px 50%, #ff5f56 6px, transparent 6px),
    radial-gradient(circle at 28px 50%, #ffbd2e 6px, transparent 6px),
    radial-gradient(circle at 44px 50%, #27c93f 6px, transparent 6px);
  background-repeat: no-repeat;
  background-position: 12px 50%, 28px 50%, 44px 50%;
}
.dialog-content pre code {
  display: block;
  padding: 1rem 1.25rem;
  background: transparent;
  color: inherit;
  font-weight: 400;
  font-size: 1em;
  border: none;
  box-shadow: none;
}
.dialog-content hr {
  margin: 1.5em 0;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.08);
}
html.dark .dialog-content hr {
  border-top-color: rgba(255,255,255,0.1);
}
.dialog-content strong {
  font-weight: 600;
  color: inherit;
}
.dialog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}


/* Cupertino button system (dùng chung page/detail) */
.btn-cupertino-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.95);
  color: rgb(75 85 99);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.btn-cupertino-icon:hover {
  color: rgb(17 24 39);
  background: rgb(255 255 255);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.11);
}
.btn-cupertino-icon:active {
  transform: scale(0.98);
}
html.dark .btn-cupertino-icon {
  background: rgb(31 41 55 / 0.9);
  color: rgb(156 163 175);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
html.dark .btn-cupertino-icon:hover {
  color: rgb(243 244 246);
  background: rgb(55 65 81 / 0.95);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.btn-cupertino-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.95rem;
  border-radius: 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgb(55 65 81);
  background: rgb(255 255 255 / 0.82);
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.btn-cupertino-chip:hover {
  color: rgb(29 78 216);
  background: rgb(239 246 255 / 0.95);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.16);
}
.btn-cupertino-chip:active {
  transform: scale(0.99);
}
html.dark .btn-cupertino-chip {
  color: rgb(229 231 235);
  background: rgb(75 85 99 / 0.72);
  border-color: rgba(255, 255, 255, 0.30);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
html.dark .btn-cupertino-chip:hover {
  color: rgb(125 211 252);
  background: rgb(30 58 138 / 0.48);
  border-color: rgba(96, 165, 250, 0.62);
  box-shadow: 0 8px 18px rgba(30, 58, 138, 0.42);
}

.btn-cupertino-text {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: rgb(107 114 128);
  transition: color 0.18s ease;
}
.btn-cupertino-text:hover {
  color: rgb(55 65 81);
}
html.dark .btn-cupertino-text {
  color: rgb(156 163 175);
}
html.dark .btn-cupertino-text:hover {
  color: rgb(209 213 219);
}

/* Shared glass surfaces (index/page/detail) */
.surface-cupertino {
  background: rgb(255 255 255 / 0.84);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.13);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.09);
}
html.dark .surface-cupertino {
  background: rgb(31 41 55 / 0.8);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
}
.surface-cupertino-hover {
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.surface-cupertino-hover:hover {
  border-color: rgba(0, 0, 0, 0.19);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.13);
}
html.dark .surface-cupertino-hover:hover {
  border-color: rgba(255, 255, 255, 0.28);
}
.surface-cupertino-divider {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}
html.dark .surface-cupertino-divider {
  border-top-color: rgba(255, 255, 255, 0.07);
}

.btn-cupertino-icon-inverse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.btn-cupertino-icon-inverse:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border-color: rgba(255, 255, 255, 0.24);
}
.btn-cupertino-icon-inverse:active {
  transform: scale(0.98);
}
