/*
Theme Name: AILog GP
Theme URI: https://ailog.cloud
Description: AILog child theme for GeneratePress. Clean professional tech-blog layout, bilingual, SEO-structured.
Author: AILog
Template: generatepress
Version: 1.1.0
Text Domain: ailog-gp
*/

:root {
  --ail-bg: #f8fafc;
  --ail-card: #ffffff;
  --ail-border: #e2e8f0;
  --ail-border-2: #cbd5e1;
  --ail-text: #0f172a;
  --ail-muted: #334155;
  --ail-muted-2: #64748b;
  --ail-accent: #2563eb;
  --ail-accent-hover: #1d4ed8;
  --ail-accent-light: #eff6ff;
  --ail-accent-2: #7c3aed;
  --ail-code-bg: #0f172a;
  --ail-code-text: #e2e8f0;
  --ail-radius: 12px;
  --ail-shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
  --ail-shadow-md: 0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --ail-shadow-lg: 0 10px 30px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
}

body {
  background: var(--ail-bg);
  color: var(--ail-text);
  font-size: 17px;
  line-height: 1.75;
}

a { color: var(--ail-accent); }
a:hover, a:focus { color: var(--ail-accent-hover); }

/* Header */
.site-header {
  background-image: linear-gradient(135deg, #dbeafe 0%, #e9e0ff 50%, #cffafe 100%);
  background-color: #dbeafe;
  border-bottom: 1px solid #c7d7f5;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ail-accent), var(--ail-accent-2), #06b6d4);
}
.inside-header { padding: .8rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.main-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px; margin: 0; }
.main-title a {
  color: #1e3a8a;
  background-image: linear-gradient(135deg, #1d4ed8, #6d28d9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}
.site-description { color: #334155; }

/* Theme toggle */
.ail-theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--ail-card);
  color: var(--ail-muted);
  border: 1px solid var(--ail-border);
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: background 600ms ease, color 600ms ease, border-color .2s;
}
.ail-theme-toggle:hover { color: var(--ail-accent); border-color: var(--ail-accent); background: var(--ail-card); }
.ail-theme-toggle:focus-visible { outline: 2px solid var(--ail-accent); outline-offset: 2px; }
.ail-theme-toggle .ail-icon { width: 1rem; height: 1rem; display: block; }
.ail-theme-toggle .ail-icon-sun { display: none; }
html[data-theme="dark"] .ail-theme-toggle .ail-icon-sun { display: block; }
html[data-theme="dark"] .ail-theme-toggle .ail-icon-moon { display: none; }

/* Navigation */
.main-navigation {
  background: var(--ail-card);
  border-bottom: 1px solid var(--ail-border);
}
.main-navigation a { color: var(--ail-text); font-weight: 500; }
.main-navigation ul ul {
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  border-radius: 10px;
  box-shadow: var(--ail-shadow-md);
}
.main-navigation .current-menu-item > a { color: var(--ail-accent); }

/* Headings */
h1, h2, h3, h4, h5, h6 { color: var(--ail-text); line-height: 1.3; }
h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -.5px; }
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2.2em;
  padding-bottom: .35em;
  border-bottom: 1px solid var(--ail-border);
}
h3 { font-size: 1.2rem; font-weight: 700; }

/* Article card */
.inside-article {
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  border-radius: var(--ail-radius);
  box-shadow: var(--ail-shadow-sm);
  transition: box-shadow .25s cubic-bezier(.4,0,.2,1), transform .25s cubic-bezier(.4,0,.2,1);
}
.blog .inside-article:hover,
.archive .inside-article:hover {
  box-shadow: var(--ail-shadow-lg);
  transform: translateY(-2px);
  border-color: var(--ail-border-2);
}
.entry-content p { margin-bottom: 1.15em; }
.entry-content ul, .entry-content ol { margin-bottom: 1.2em; padding-left: 1.5em; }

/* Breadcrumb */
.ail-breadcrumb {
  font-size: .85rem;
  color: var(--ail-muted);
  background: var(--ail-bg);
  border: 1px solid var(--ail-border);
  border-radius: 8px;
  padding: .5rem .8rem;
  margin-bottom: 1rem;
}
.ail-breadcrumb a { color: var(--ail-accent); text-decoration: none; }
.ail-breadcrumb a:hover { text-decoration: underline; }

/* Entry meta row */
.ail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  font-size: .875rem;
  color: var(--ail-muted-2);
  margin: .5rem 0 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--ail-border);
}
.ail-meta .ail-cat a {
  background: var(--ail-accent-light);
  color: var(--ail-accent);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: .15rem .65rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-decoration: none;
}

/* Table of contents */
.ail-toc {
  background: var(--ail-bg);
  border: 1px solid var(--ail-border);
  border-left: 3px solid var(--ail-accent);
  border-radius: var(--ail-radius);
  padding: 1rem 1.15rem;
  margin: 0 0 1.75rem;
}
.ail-toc > strong { display: block; margin-bottom: .5rem; font-size: .95rem; color: var(--ail-text); }
.ail-toc ol { margin: 0 0 0 1.1rem; padding: 0; }
.ail-toc li { margin: .2rem 0; font-size: .95rem; }
.ail-toc a { color: var(--ail-muted); text-decoration: none; }
.ail-toc a:hover { color: var(--ail-accent); text-decoration: underline; }

/* Disclosure */
.disclosure {
  background: var(--ail-accent-light);
  border: 1px solid #dbeafe;
  border-radius: var(--ail-radius);
  padding: .9rem 1.1rem;
  margin: 1.5rem 0;
  font-size: .9rem;
}
.disclosure strong { display: block; color: var(--ail-accent-hover); margin-bottom: .3rem; }
.disclosure p { margin: 0; color: var(--ail-muted); }

/* FAQ */
.ail-faq details {
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  border-radius: var(--ail-radius);
  padding: .75rem 1rem;
  margin-bottom: .6rem;
  box-shadow: var(--ail-shadow-sm);
}
.ail-faq summary { cursor: pointer; font-weight: 600; color: var(--ail-text); }
.ail-faq details[open] summary { color: var(--ail-accent); }
.ail-faq p { margin: .6rem 0 0; color: var(--ail-muted); font-size: .95rem; }

/* Author box */
.ail-authorbox {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--ail-bg);
  border: 1px solid var(--ail-border);
  border-radius: var(--ail-radius);
  padding: 1rem 1.15rem;
  margin: 2rem 0;
}
.ail-authorbox img { border-radius: 50%; flex: 0 0 auto; }
.ail-authorbox .ail-author-name { font-weight: 700; color: var(--ail-text); }
.ail-authorbox p { margin: .25rem 0 0; color: var(--ail-muted); font-size: .9rem; }

/* Related */
.ail-related h2 { border-bottom: none; margin-bottom: .8rem; }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.related-list li {
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  border-left: 3px solid var(--ail-accent);
  border-radius: 8px;
  padding: .7rem .95rem;
  box-shadow: var(--ail-shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.related-list li:hover { transform: translateX(2px); box-shadow: var(--ail-shadow-md); }
.related-list a { text-decoration: none; font-weight: 500; }

/* Language switcher */
.lang-switcher { list-style: none; display: flex; gap: .4rem; margin: 0; padding: 0; }
.lang-switcher a {
  display: inline-block;
  border: 1px solid var(--ail-border);
  border-radius: 6px;
  padding: .1rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ail-muted-2);
  text-decoration: none;
}
.lang-switcher a[aria-current="page"] {
  color: var(--ail-accent);
  border-color: var(--ail-accent);
  background: var(--ail-accent-light);
}

/* Footer links */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  justify-content: center;
  padding: 1rem;
  font-size: .9rem;
  background: var(--ail-card);
  border-top: 1px solid var(--ail-border);
}
.footer-links a { color: var(--ail-muted); text-decoration: none; }
.footer-links a:hover { color: var(--ail-accent); text-decoration: underline; }
.site-info { color: var(--ail-muted); font-size: .875rem; }
.site-info a { color: var(--ail-accent); }
.entry-summary, .entry-content > p { color: var(--ail-text); }
.entry-meta, .posted-on, .byline { color: var(--ail-muted); }

/* Sidebar widgets */
.sidebar .widget {
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  border-radius: var(--ail-radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--ail-shadow-sm);
}
.sidebar .widget-title { font-size: 1rem; font-weight: 700; color: var(--ail-text); }
.sidebar a { text-decoration: none; }
.sidebar li { margin-bottom: .35rem; }

/* Home hero */
.ail-home-hero {
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1px solid #dbeafe;
  border-radius: var(--ail-radius);
  padding: 1.6rem 1.7rem;
  margin-bottom: 1.5rem;
}
.ail-home-hero h1 { margin: 0 0 .35rem; font-size: 1.9rem; }
.ail-home-hero p { margin: 0; color: var(--ail-muted); }

/* Code */
.entry-content pre {
  background: var(--ail-code-bg);
  color: var(--ail-code-text);
  border-radius: var(--ail-radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: .9rem;
  box-shadow: var(--ail-shadow-md);
}
.entry-content code {
  background: var(--ail-accent-light);
  color: var(--ail-accent-hover);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .9em;
}
.entry-content pre code { background: none; color: inherit; padding: 0; }

/* Tables */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  border-radius: var(--ail-radius);
  overflow: hidden;
  box-shadow: var(--ail-shadow-sm);
}
.entry-content th, .entry-content td { border: 1px solid var(--ail-border); padding: .6rem .8rem; text-align: left; }
.entry-content th { background: var(--ail-bg); font-weight: 700; }

/* Images */
.entry-content img, .post-image img { border-radius: var(--ail-radius); height: auto; }

/* Contextual internal links inside body copy */
.entry-content a.ail-inline-link {
  color: var(--ail-accent);
  text-decoration: underline;
  text-decoration-color: rgba(37,99,235,.35);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  font-weight: 500;
  transition: color .2s, text-decoration-color .2s, background-color .2s;
}
.entry-content a.ail-inline-link:hover,
.entry-content a.ail-inline-link:focus {
  color: var(--ail-accent-hover);
  text-decoration-color: currentColor;
  background: var(--ail-accent-light);
  border-radius: 3px;
}
html[data-theme="dark"] .entry-content a.ail-inline-link { text-decoration-color: rgba(96,165,250,.4); }
html[data-theme="dark"] .entry-content a.ail-inline-link:hover,
html[data-theme="dark"] .entry-content a.ail-inline-link:focus { background: var(--ail-accent-light); }

/* Forms: keep placeholders readable */
input[type="text"], input[type="email"], input[type="url"], input[type="search"], textarea {
  background: var(--ail-card);
  border: 1px solid var(--ail-border);
  color: var(--ail-text);
  border-radius: 8px;
}
input::placeholder, textarea::placeholder { color: var(--ail-muted-2); opacity: 1; }
input:focus, textarea:focus { border-color: var(--ail-accent); outline: 2px solid rgba(37,99,235,.15); }

/* Buttons: 600ms flash feedback */
button, .button, input[type="submit"] {
  background: var(--ail-accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: .5rem 1rem;
  font-weight: 600;
  transition: background 600ms ease, color 600ms ease, transform .15s;
}
button:hover, .button:hover, input[type="submit"]:hover { background: var(--ail-accent-hover); color: #fff; }
button:active, input[type="submit"]:active { transform: translateY(1px); }

@media (max-width: 768px) {
  body { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
  .ail-authorbox { flex-direction: column; }
  .site-header { position: static; }
}

/* ============================================================
   DARK MODE
   Applied only when html[data-theme="dark"] is set by the
   toggle (or by the no-flash inline script reading the saved
   preference / prefers-color-scheme). Same tokens, dark values.
   ============================================================ */
html[data-theme="dark"] {
  --ail-bg: #0b1220;
  --ail-card: #111a2b;
  --ail-border: #203044;
  --ail-border-2: #2a3d55;
  --ail-text: #e6edf7;
  --ail-muted: #c2cfe0;
  --ail-muted-2: #9fb0c8;
  --ail-accent: #60a5fa;
  --ail-accent-hover: #93c5fd;
  --ail-accent-light: #16223a;
  --ail-accent-2: #a78bfa;
  --ail-code-bg: #060b14;
  --ail-code-text: #e2e8f0;
  --ail-shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --ail-shadow-md: 0 4px 12px rgba(0,0,0,.55);
  --ail-shadow-lg: 0 10px 30px rgba(0,0,0,.6);
  color-scheme: dark;
}

html[data-theme="dark"] body { background: var(--ail-bg); color: var(--ail-text); }

html[data-theme="dark"] .site-header {
  background-image: linear-gradient(135deg, #16223a 0%, #221c46 50%, #0d2b38 100%);
  background-color: #16223a;
  border-bottom-color: var(--ail-border);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}

html[data-theme="dark"] .main-navigation,
html[data-theme="dark"] .main-navigation ul ul { background: var(--ail-card); border-color: var(--ail-border); }
html[data-theme="dark"] .main-navigation a { color: var(--ail-text); }
html[data-theme="dark"] .main-navigation .current-menu-item > a { color: var(--ail-accent); }

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 { color: #fff; }
html[data-theme="dark"] h2 { border-bottom-color: var(--ail-border); }

html[data-theme="dark"] .inside-article,
html[data-theme="dark"] .comments-area,
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .paging-navigation,
html[data-theme="dark"] .sidebar .widget,
html[data-theme="dark"] .footer-widgets,
html[data-theme="dark"] .site-info,
html[data-theme="dark"] .footer-links {
  background: var(--ail-card);
  border-color: var(--ail-border);
  color: var(--ail-text);
}

html[data-theme="dark"] .entry-content p,
html[data-theme="dark"] .entry-summary { color: var(--ail-text); }
html[data-theme="dark"] .entry-title a { color: #fff; }
html[data-theme="dark"] .entry-title a:hover { color: var(--ail-accent); }
html[data-theme="dark"] .entry-meta,
html[data-theme="dark"] .ail-meta,
html[data-theme="dark"] .site-info,
html[data-theme="dark"] .footer-links a { color: var(--ail-muted); }

html[data-theme="dark"] a { color: var(--ail-accent); }
html[data-theme="dark"] a:hover, html[data-theme="dark"] a:focus { color: var(--ail-accent-hover); }

html[data-theme="dark"] .ail-breadcrumb { background: var(--ail-bg); border-color: var(--ail-border); color: var(--ail-muted); }
html[data-theme="dark"] .ail-toc { background: var(--ail-bg); border-color: var(--ail-border); border-left-color: var(--ail-accent); }
html[data-theme="dark"] .ail-toc a { color: var(--ail-muted); }
html[data-theme="dark"] .ail-toc a:hover { color: var(--ail-accent); }

html[data-theme="dark"] .disclosure { background: var(--ail-accent-light); border-color: var(--ail-border); }
html[data-theme="dark"] .disclosure strong { color: var(--ail-accent-hover); }
html[data-theme="dark"] .disclosure p { color: var(--ail-muted); }

html[data-theme="dark"] .ail-meta .ail-cat a {
  background: var(--ail-accent-light);
  color: var(--ail-accent);
  border-color: var(--ail-border);
}

html[data-theme="dark"] .ail-authorbox,
html[data-theme="dark"] .ail-authorbox-enhanced { background: var(--ail-card); border-color: var(--ail-border); }
html[data-theme="dark"] .ail-authorbox .ail-author-name,
html[data-theme="dark"] .ail-authorbox-enhanced .ail-author-name { color: #fff; }
html[data-theme="dark"] .ail-authorbox p,
html[data-theme="dark"] .ail-authorbox-enhanced .ail-author-bio { color: var(--ail-text); }
html[data-theme="dark"] .ail-authorbox-enhanced .ail-author-credentials { color: var(--ail-muted-2); }
html[data-theme="dark"] .ail-authorbox-enhanced .ail-author-expertise { color: var(--ail-muted); }
html[data-theme="dark"] .ail-authorbox-enhanced .ail-author-expertise strong { color: #fff; }

html[data-theme="dark"] .related-list li,
html[data-theme="dark"] .ail-faq details { background: var(--ail-card); border-color: var(--ail-border); }

html[data-theme="dark"] .ail-home-hero {
  background: linear-gradient(135deg, #16223a, #1c1836);
  border-color: var(--ail-border);
}
html[data-theme="dark"] .ail-home-hero p { color: var(--ail-muted); }

html[data-theme="dark"] .entry-content table { background: var(--ail-card); border-color: var(--ail-border); }
html[data-theme="dark"] .entry-content th,
html[data-theme="dark"] .entry-content td { border-color: var(--ail-border); }
html[data-theme="dark"] .entry-content th { background: var(--ail-bg); color: #fff; }

html[data-theme="dark"] .entry-content pre { background: var(--ail-code-bg); color: var(--ail-code-text); }
html[data-theme="dark"] .entry-content code { background: var(--ail-accent-light); color: var(--ail-accent-hover); }

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea {
  background: #16223a;
  border-color: var(--ail-border);
  color: var(--ail-text);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--ail-muted-2); }

html[data-theme="dark"] .ail-theme-toggle { background: var(--ail-card); color: var(--ail-muted); border-color: var(--ail-border); }
html[data-theme="dark"] .ail-theme-toggle:hover { color: var(--ail-accent); border-color: var(--ail-accent); }

html[data-theme="dark"] .lang-switcher a { color: var(--ail-muted); border-color: var(--ail-border); }
html[data-theme="dark"] .lang-switcher a[aria-current="page"] {
  color: var(--ail-accent);
  border-color: var(--ail-accent);
  background: var(--ail-accent-light);
}

html[data-theme="dark"] button,
html[data-theme="dark"] .button,
html[data-theme="dark"] input[type="submit"] { background: var(--ail-accent); color: #05101f; }
html[data-theme="dark"] button:hover,
html[data-theme="dark"] input[type="submit"]:hover { background: var(--ail-accent-hover); color: #05101f; }

html[data-theme="dark"] .main-title a {
  color: #bfdbfe;
  background-image: linear-gradient(135deg, #93c5fd, #c4b5fd);
}
html[data-theme="dark"] .site-description { color: var(--ail-muted); }

/* GeneratePress emits high-specificity inline CSS for these; match it. */
html[data-theme="dark"] .main-navigation .main-nav ul li a,
html[data-theme="dark"] .main-navigation .menu-toggle,
html[data-theme="dark"] .main-navigation .menu-bar-items { color: var(--ail-text); }
html[data-theme="dark"] .main-navigation .main-nav ul li:not([class*="current-menu-"]):hover > a,
html[data-theme="dark"] .main-navigation .main-nav ul li:not([class*="current-menu-"]):focus > a {
  color: var(--ail-accent);
  background-color: var(--ail-accent-light);
}
html[data-theme="dark"] .main-navigation .main-nav ul li[class*="current-menu-"] > a {
  color: var(--ail-accent);
  background-color: var(--ail-accent-light);
}
html[data-theme="dark"] .sidebar .widget .widget-title,
html[data-theme="dark"] .footer-widgets .widget-title { color: #fff; }
html[data-theme="dark"] .inside-article,
html[data-theme="dark"] .comments-area,
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .paging-navigation,
html[data-theme="dark"] .one-container .container { color: var(--ail-text); background-color: var(--ail-card); }
html[data-theme="dark"] .inside-article a,
html[data-theme="dark"] .paging-navigation a,
html[data-theme="dark"] .comments-area a,
html[data-theme="dark"] .page-header a { color: var(--ail-accent); }
html[data-theme="dark"] .entry-meta { color: var(--ail-muted); }
html[data-theme="dark"] .entry-meta a { color: var(--ail-muted); }
html[data-theme="dark"] .entry-meta a:hover { color: var(--ail-accent); }
html[data-theme="dark"] .sidebar .widget { color: var(--ail-text); background-color: var(--ail-card); }
html[data-theme="dark"] .sidebar .widget a { color: var(--ail-accent); }
html[data-theme="dark"] .site-info { color: var(--ail-muted); background-color: var(--ail-card); }
html[data-theme="dark"] .navigation-search input[type="search"],
html[data-theme="dark"] .main-navigation .main-nav ul li.search-item.active > a {
  color: var(--ail-text);
  background-color: var(--ail-card);
}

/* The generic dark button rule must not repaint the toggle chip. */
html[data-theme="dark"] button.ail-theme-toggle {
  background: var(--ail-card);
  color: var(--ail-muted);
  border: 1px solid var(--ail-border);
}
html[data-theme="dark"] button.ail-theme-toggle:hover {
  background: var(--ail-card);
  color: var(--ail-accent);
  border-color: var(--ail-accent);
}
button.ail-theme-toggle { background: var(--ail-card); color: var(--ail-muted); }
button.ail-theme-toggle:hover { background: var(--ail-card); color: var(--ail-accent); }



/* Smooth Scroll & TOC Sticky Header Offset */
html {
  scroll-behavior: smooth;
}
h1[id], h2[id], h3[id], h4[id], section[id] {
  scroll-margin-top: 85px;
}
