/*
Theme Name: Jahirul (GeneratePress Child)
Theme URI: https://www.jahirul.com
Description: Minimal, reading-first styling for Mohammad Jahirul Islam's personal site and blog. Child theme of GeneratePress.
Author: Mohammad Jahirul Islam
Template: generatepress
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: jahirul
*/

/* ------------------------------------------------------------------
   1. Tokens
   GeneratePress supplies --contrast, --contrast-2, --contrast-3,
   --base, --base-2, --base-3 and --accent (Customizer > Colors).
   Everything below builds on those so the palette stays in one place.
   ------------------------------------------------------------------ */
:root {
  --border: #e5e7eb;
  --code-bg: #0d1117;
  --code-text: #e6edf3;
  --radius: 8px;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

/* ------------------------------------------------------------------
   2. Base typography
   ------------------------------------------------------------------ */
body {
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--contrast);
  overflow-wrap: anywhere;
}

h1.entry-title,
.page-header h1,
h1.page-title { font-size: 36px; margin-bottom: 10px; letter-spacing: -0.02em; }

.entry-content h2 { font-size: 26px; margin: 1.8em 0 0.6em; }
.entry-content h3 { font-size: 21px; font-weight: 600; margin: 1.5em 0 0.5em; }
.entry-content h4 { font-size: 18px; font-weight: 600; margin: 1.4em 0 0.5em; }
.entry-content > :first-child { margin-top: 0; }

.entry-content p,
.entry-content ul,
.entry-content ol,
.entry-content figure,
.entry-content table { margin-bottom: 1.4em; }
.entry-content li { margin-bottom: 0.35em; }
.entry-content li > ul,
.entry-content li > ol { margin-top: 0.35em; margin-bottom: 0; }
.entry-content strong { font-weight: 600; }

.entry-content a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.entry-content a:hover { color: var(--accent); text-decoration-thickness: 2px; }

.entry-content blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.25em;
  border-left: 3px solid var(--accent);
  color: var(--contrast-2);
  font-style: normal;
}
.entry-content blockquote p:last-child { margin-bottom: 0; }
.entry-content hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.entry-content img { height: auto; border-radius: var(--radius); }
.entry-content figcaption { font-size: 14px; color: var(--contrast-2); margin-top: 0.5em; text-align: left; }
.entry-content table { font-size: 15px; border-collapse: collapse; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 8px 12px; }

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------
   3. Header and navigation
   ------------------------------------------------------------------ */
.site-header { border-bottom: 1px solid var(--border); }
.inside-header { padding-top: 18px; padding-bottom: 18px; }
.main-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

.main-navigation .main-nav ul li a {
  font-size: 15px;
  font-weight: 500;
  padding-left: 14px;
  padding-right: 14px;
}
.main-navigation .menu-bar-items .menu-bar-item > a { padding-left: 10px; padding-right: 10px; }
.mobile-menu-control-wrapper .menu-toggle,
.mobile-menu-control-wrapper .menu-toggle:hover,
.mobile-menu-control-wrapper .menu-toggle:focus { background-color: transparent; }

/* Desktop: a short accent underline marks the current page. */
@media (min-width: 769px) {
  .main-navigation .main-nav ul li[class*="current-menu-"] > a { position: relative; }
  .main-navigation .main-nav ul li[class*="current-menu-"] > a::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 18px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }
}
/* Mobile: the inline toggle wrapper already carries the search icon, so hide the duplicate. */
@media (max-width: 768px) {
  .has-inline-mobile-toggle #site-navigation .menu-bar-items { display: none; }
  .main-navigation .main-nav ul li[class*="current-menu-"] > a { font-weight: 600; }
}

/* ------------------------------------------------------------------
   4. Home intro
   ------------------------------------------------------------------ */
.home-intro {
  padding: 10px 0 30px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.home-intro__text {
  font-size: 20px;
  line-height: 1.5;
  margin: 0 0 14px;
  max-width: 58ch;
  color: var(--contrast);
}
.home-intro__text strong { font-weight: 700; }
.home-intro__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0;
  font-size: 15px;
}
.home-intro__links a { text-decoration: none; color: var(--accent); font-weight: 500; }
.home-intro__links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.home-topics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--contrast-2);
}
.home-topics a {
  display: inline-block;
  padding: 0 11px;
  line-height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--contrast-2);
}
.home-topics a:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------------
   5. Post list (home, archives, search)
   ------------------------------------------------------------------ */
.one-container.blog .site-main > .post,
.one-container.archive .site-main > .post,
.one-container.search .site-main > article,
.one-container.blog .site-main > .post:not(:last-child),
.one-container.archive .site-main > .post:not(:last-child) {
  margin: 0;
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}
.one-container.blog .site-main > article:last-of-type,
.one-container.archive .site-main > article:last-of-type,
.one-container.search .site-main > article:last-of-type { border-bottom: 0; }

.blog .entry-title,
.archive .entry-title,
.search .entry-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}
.entry-title a:hover { color: var(--accent); }

.entry-header .entry-meta { font-size: 14px; color: var(--contrast-2); margin-top: 2px; }
.entry-meta .gp-icon { display: none; }
.entry-meta > span + span::before {
  content: "\00b7";
  margin: 0 8px;
  color: var(--contrast-3);
}
.entry-meta a { color: inherit; text-decoration: none; }
.entry-meta a:hover { color: var(--accent); }

.entry-summary { margin-top: 10px; }
.entry-summary p { margin-bottom: 0; }
.entry-summary .read-more {
  display: inline-block;
  margin-left: 2px;
  font-weight: 500;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
}
.entry-summary .read-more:hover { text-decoration: underline; text-underline-offset: 3px; }

.page-header { margin-bottom: 4px; }
.one-container .page-header,
.one-container .inside-page-header { padding: 0 0 20px; }
.page-header .page-title { font-size: 28px; margin-bottom: 6px; }
.page-header .archive-description,
.page-header .taxonomy-description { color: var(--contrast-2); font-size: 16px; }

.paging-navigation {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 0;
  font-size: 15px;
  font-weight: 500;
}
.paging-navigation a { text-decoration: none; }
.paging-navigation a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------
   6. Single post
   ------------------------------------------------------------------ */
.single .entry-header { margin-bottom: 28px; }
.single .entry-header .entry-meta { font-size: 15px; }

.post-hero { margin: 0 0 36px; }
.post-hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.single footer.entry-meta {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 2;
}
.single footer.entry-meta > span { display: block; }
.single footer.entry-meta > span + span::before { content: none; margin: 0; }
.single footer.entry-meta .tags-links a,
.single footer.entry-meta .cat-links a {
  display: inline-block;
  padding: 0 12px;
  margin: 0 6px 6px 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  line-height: 28px;
  text-decoration: none;
  color: var(--contrast-2);
  font-weight: 500;
}
.single footer.entry-meta .tags-links a:hover,
.single footer.entry-meta .cat-links a:hover { color: var(--accent); border-color: var(--accent); }

.single .post-navigation,
.single footer.entry-meta .post-navigation {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.5;
}
.single .post-navigation .nav-next { text-align: right; margin-left: auto; }
.single .post-navigation a { text-decoration: none; font-weight: 500; }
.single .post-navigation a:hover { text-decoration: underline; text-underline-offset: 3px; }

.author-box {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-top: 40px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--base);
}
.author-box__avatar {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}
.author-box__name { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.author-box__bio { font-size: 15px; color: var(--contrast-2); margin: 0; }
.author-box__links { font-size: 14px; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.author-box__links a { text-decoration: none; font-weight: 500; }
.author-box__links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------
   7. Pages
   ------------------------------------------------------------------ */
.page .entry-header { margin-bottom: 26px; }
.page .entry-content .lead,
.entry-content .lead { font-size: 19px; line-height: 1.55; color: var(--contrast-2); }
.wp-block-button.is-style-outline > .wp-block-button__link {
  color: var(--accent);
  border: 1px solid var(--accent);
  background: transparent;
}
.wp-block-buttons { gap: 12px; }

/* ------------------------------------------------------------------
   8. Forms and buttons
   ------------------------------------------------------------------ */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="number"],
textarea {
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 16px;
  background: var(--base-3);
  border: 1px solid var(--border);
  box-shadow: none;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus {
  border-color: var(--accent);
  background: var(--base-3);
}

button,
input[type="submit"],
input[type="button"],
a.button,
a.wp-block-button__link:not(.has-background) {
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  padding: 11px 20px;
  transition: background-color 0.15s ease;
}

.wpcf7 form { margin-top: 8px; }
.wpcf7 form p { margin-bottom: 18px; }
.wpcf7 label { display: block; font-weight: 500; font-size: 15px; }
.wpcf7 .wpcf7-form-control-wrap { display: block; margin-top: 6px; }
.wpcf7 input:not([type="submit"]),
.wpcf7 textarea { width: 100%; max-width: 100%; }
.wpcf7 input[type="submit"] { width: auto; }
.wpcf7 .wpcf7-not-valid-tip { font-size: 13px; color: #b42318; margin-top: 4px; }
.wpcf7 form .wpcf7-response-output {
  margin: 18px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
}
.wpcf7 form.sent .wpcf7-response-output { border-color: #16a34a; }
.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output { border-color: #b42318; }

/* ------------------------------------------------------------------
   9. Code
   ------------------------------------------------------------------ */
code, kbd, samp, pre { font-family: var(--font-mono); }
:not(pre) > code {
  font-size: 0.875em;
  background: var(--base);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  color: var(--contrast);
}
pre,
.wp-block-code,
.wp-block-preformatted {
  background: var(--code-bg);
  color: var(--code-text);
  border: 0;
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
pre code,
.wp-block-code code {
  display: block;
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
  white-space: pre;
  overflow-wrap: normal;
}
pre code.hljs { padding: 0; background: transparent; }
.wp-block-code { position: relative; }
.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  font: 500 12px/1.2 -apple-system, system-ui, "Segoe UI", sans-serif;
  color: #9aa4ae;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.wp-block-code:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: #e6edf3; background: #21262d; }
.code-copy.is-copied { color: #3fb950; border-color: #3fb950; opacity: 1; }

/* ------------------------------------------------------------------
   10. Footer
   ------------------------------------------------------------------ */
.site-info {
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--contrast-2);
  text-align: left;
}
.site-info .inside-site-info { padding-top: 26px; padding-bottom: 26px; }
.site-info .copyright-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 24px;
  width: 100%;
  float: none;
}
.site-info .credit { white-space: nowrap; }
.site-info .credit::before {
  content: "\00b7";
  margin: 0 8px;
  color: var(--contrast-3);
}
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-nav li { margin: 0; }
.site-info a { color: var(--contrast-2); text-decoration: none; }
.site-info a:hover { color: var(--contrast); }

/* ------------------------------------------------------------------
   11. Small screens
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .main-title { font-size: 18px; }
  .inside-header { padding: 12px 24px; }
  h1.entry-title,
  .page-header h1,
  h1.page-title { font-size: 28px; }
  .entry-content h2 { font-size: 23px; }
  .entry-content h3 { font-size: 19px; }
  .home-intro__text { font-size: 18px; }
  .blog .entry-title,
  .archive .entry-title,
  .search .entry-title { font-size: 20px; }
  .one-container .site-content { padding: 24px; }
  .site-info .inside-site-info { padding-left: 24px; padding-right: 24px; }
  .author-box { padding: 18px; gap: 14px; }
  pre, .wp-block-code, .wp-block-preformatted { padding: 14px 16px; font-size: 13.5px; }
  .code-copy { opacity: 1; }
}

/* ------------------------------------------------------------------
   12. Dark mode (follows the operating system preference)
   ------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root {
    --contrast: #e6edf3;
    --contrast-2: #9aa4ae;
    --contrast-3: #6e7681;
    --base: #161b22;
    --base-2: #0d1117;
    --base-3: #0d1117;
    --accent: #58a6ff;
    --border: #30363d;
    color-scheme: dark;
  }
  pre, .wp-block-code, .wp-block-preformatted { border: 1px solid var(--border); }
  button,
  input[type="submit"],
  input[type="button"],
  a.button,
  a.wp-block-button__link:not(.has-background) { background-color: var(--accent); color: #0d1117; }
  button:hover, button:focus,
  input[type="submit"]:hover, input[type="submit"]:focus,
  input[type="button"]:hover, input[type="button"]:focus,
  a.button:hover,
  a.wp-block-button__link:not(.has-background):hover { background-color: #79b8ff; color: #0d1117; }
  .wp-block-button.is-style-outline > .wp-block-button__link { background: transparent; color: var(--accent); }
  .entry-content img { opacity: 0.92; }
  .code-copy { background: #21262d; }
  .wpcf7 .wpcf7-not-valid-tip { color: #ff7b72; }
}
