/*
Theme Name: Soul & Syntax
Theme URI: https://ajitabhpandey.info
Author: Ajitabh Pandey
Author URI: https://ajitabhpandey.info
Description: A mobile-first, single-column blogging theme built around the duality of Soul & Syntax — contemplative serif typography for essays, terminal monospace for systems writing. Signature element: the shirorekha, a Devanagari-style top rule that headlines hang from. Includes automatic dark mode.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: soul-syntax
Tags: blog, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ---------------------------------------------------------------------------
   Tokens
--------------------------------------------------------------------------- */
:root {
  --paper: #faf9f5;
  --paper-2: #f1efe8;
  --ink: #22252e;
  --ink-soft: #565b68;
  --indigo: #3a4a8f;      /* nili — links, emphasis */
  --turmeric: #c07a0e;    /* shirorekha rule, selection */
  --leaf: #1f7a5c;        /* terminal green — code, tech chips */
  --rule: #ddd9cd;
  --code-bg: #1a1e28;
  --code-fg: #c9e8d4;

  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 66ch;
  --gutter: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131720;
    --paper-2: #1a1f2b;
    --ink: #e7e5de;
    --ink-soft: #9aa0ad;
    --indigo: #8d9be0;
    --turmeric: #d9963a;
    --leaf: #5cc49a;
    --rule: #2b3140;
    --code-bg: #0d1017;
    --code-fg: #b8dcc6;
  }
}

/* ---------------------------------------------------------------------------
   Base — mobile first
--------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
}

::selection { background: var(--turmeric); color: #fff; }

img { max-width: 100%; height: auto; }

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--turmeric); }

:focus-visible {
  outline: 2px solid var(--turmeric);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: .6rem 1rem;
  z-index: 100;
  font-family: var(--mono);
  font-size: .85rem;
}
.skip-link:focus { left: 0; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
}

/* ---------------------------------------------------------------------------
   Signature: the shirorekha — a top rule the headline hangs from
--------------------------------------------------------------------------- */
.shirorekha {
  display: inline-block;
  border-top: 4px solid var(--turmeric);
  padding-top: .35rem;
}

/* ---------------------------------------------------------------------------
   Masthead
--------------------------------------------------------------------------- */
.site-header {
  padding: 1.75rem 0 1rem;
}

.brand { display: flex; align-items: center; gap: .85rem; }

.brand .custom-logo { width: 44px; height: 44px; border-radius: 6px; }

.site-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.site-title a { color: inherit; text-decoration: none; }
.site-title .amp {
  font-style: italic;
  color: var(--turmeric);
  font-weight: 400;
  padding-inline: .1em;
}
.site-title .syntax {
  font-family: var(--mono);
  font-weight: 500;
  font-size: .92em;
}

.site-tagline {
  margin: .2rem 0 0;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-soft);
}

/* Nav */
.nav-toggle {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: .85rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--ink);
  padding: .45rem .9rem;
  cursor: pointer;
}
.nav-toggle::before { content: "$ "; color: var(--leaf); }

.site-nav { display: none; padding-top: .75rem; }
.site-nav.is-open { display: block; }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-family: var(--mono);
  font-size: .9rem;
}
.site-nav a {
  display: block;
  padding: .4rem 0;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.site-nav a:hover,
.site-nav .current-menu-item > a { color: var(--turmeric); }

.header-rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.25rem 0 0;
}

/* ---------------------------------------------------------------------------
   Post ledger (home / archives)
--------------------------------------------------------------------------- */
.ledger { padding: 1.5rem 0 2rem; }

.archive-title {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}
.archive-title strong { color: var(--turmeric); font-weight: 600; }

.entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.entry:first-child { padding-top: .5rem; }

.entry-date {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-soft);
  display: block;
  margin-bottom: .45rem;
}

.entry-title {
  margin: 0 0 .5rem;
  font-size: 1.35rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
}
.entry-title a { color: inherit; text-decoration: none; }
.entry-title a:hover { color: var(--indigo); }

.entry-thumb { display: block; margin: .75rem 0; }
.entry-thumb img {
  border-radius: 8px;
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.entry-excerpt { margin: .5rem 0 .75rem; color: var(--ink-soft); font-size: .97rem; }

/* Category chips as shell paths */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .6rem;
  font-family: var(--mono);
  font-size: .74rem;
  margin-top: .25rem;
}
.chips a {
  text-decoration: none;
  color: var(--leaf);
  background: var(--paper-2);
  border-radius: 5px;
  padding: .18rem .55rem;
}
.chips a::before { content: "~/"; opacity: .65; }
.chips a:hover { color: var(--paper); background: var(--leaf); }

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-family: var(--mono);
  font-size: .85rem;
  padding: 1.75rem 0 0;
}
.pagination .page-numbers {
  padding: .35rem .75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
}
.pagination .current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------------------------------------------------------------------------
   Single post / page
--------------------------------------------------------------------------- */
.post { padding: 2rem 0 2.5rem; }

.post-header { margin-bottom: 1.75rem; }

.post-title {
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.015em;
  margin: .75rem 0 .65rem;
}

.post-meta {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-soft);
}

.post-hero { margin: 1.5rem 0 0; }
.post-hero img { border-radius: 10px; display: block; }

/* Content */
.post-content { font-size: 1.0625rem; }
.post-content > * { margin-block: 1.1em; }

.post-content h2,
.post-content h3 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  margin-top: 2em;
}
.post-content h2 {
  font-size: 1.35rem;
  border-top: 3px solid var(--turmeric);
  padding-top: .4rem;
  display: inline-block;
}
.post-content h3 { font-size: 1.15rem; }

.post-content blockquote {
  margin-inline: 0;
  padding: .25rem 0 .25rem 1.1rem;
  border-left: 3px solid var(--indigo);
  font-style: italic;
  color: var(--ink-soft);
}

.post-content code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--paper-2);
  padding: .12em .35em;
  border-radius: 4px;
}

.post-content pre {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.6;
  border-top: 3px solid var(--leaf);
}
.post-content pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

.post-content hr {
  border: 0;
  text-align: center;
  margin: 2.25em 0;
}
.post-content hr::after {
  content: "॥";
  color: var(--turmeric);
  font-size: 1.2rem;
}

.post-content img { border-radius: 8px; }

.post-content .wp-caption, .post-content figure { max-width: 100%; }
.post-content .wp-caption-text, .post-content figcaption {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--ink-soft);
  margin-top: .4rem;
}

.post-content table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.post-content th, .post-content td { border: 1px solid var(--rule); padding: .5rem .7rem; text-align: left; }
.post-content th { font-family: var(--mono); font-size: .8rem; background: var(--paper-2); }

/* Post footer nav */
.post-nav {
  display: grid;
  gap: .75rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
  font-size: .92rem;
}
.post-nav .label {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink-soft);
  margin-bottom: .2rem;
}
.post-nav a { text-decoration: none; }

/* Comments */
.comments { padding: 1.5rem 0 2rem; border-top: 1px solid var(--rule); }
.comments-title { font-size: 1.15rem; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list .comment { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.comment-list .children { list-style: none; padding-left: 1.25rem; border-left: 2px solid var(--rule); margin-left: .25rem; }
.comment-meta { font-family: var(--mono); font-size: .78rem; color: var(--ink-soft); }
.comment-form label { display: block; font-family: var(--mono); font-size: .8rem; margin-bottom: .25rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.comment-form .submit,
.search-form .search-submit {
  font-family: var(--mono);
  font-size: .9rem;
  background: var(--indigo);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: .6rem 1.25rem;
  cursor: pointer;
}
.comment-form .submit:hover,
.search-form .search-submit:hover { background: var(--turmeric); }

/* Search */
.search-form { display: flex; gap: .5rem; margin: 1rem 0; }
.search-form .search-field {
  flex: 1;
  padding: .55rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .9rem;
}

/* 404 */
.error-404 { padding: 3rem 0; }
.error-404 .code {
  font-family: var(--mono);
  color: var(--leaf);
  background: var(--code-bg);
  display: inline-block;
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
}

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.75rem 0 2.5rem;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-soft);
}
.site-footer .prompt::before { content: "$ "; color: var(--leaf); }
.site-footer a { color: inherit; }

/* ---------------------------------------------------------------------------
   ≥ 720px — the ledger gains its date column
--------------------------------------------------------------------------- */
@media (min-width: 720px) {
  :root { --gutter: 2rem; }

  body { font-size: 1.125rem; }

  .site-header { padding-top: 2.5rem; }
  .site-title { font-size: 1.6rem; }

  .nav-toggle { display: none; }
  .site-nav { display: block; padding-top: 1.1rem; }
  .site-nav ul { flex-direction: row; gap: 1.5rem; }
  .site-nav a { border-bottom: 0; padding: 0; }

  .entry {
    display: grid;
    grid-template-columns: 9.5rem 1fr;
    column-gap: 1.5rem;
  }
  .entry-date { margin-bottom: 0; padding-top: .45rem; }
  .entry > *:not(.entry-date) { grid-column: 2; }

  .entry-title { font-size: 1.5rem; }
  .post-title { font-size: 2.25rem; }

  .post-nav { grid-template-columns: 1fr 1fr; }
  .post-nav .next { text-align: right; }
}

/* ---------------------------------------------------------------------------
   ≥ 1100px — wide screens: generous air, hero images breathe
--------------------------------------------------------------------------- */
@media (min-width: 1100px) {
  :root { --measure: 72ch; }

  .site-header { padding-top: 3.25rem; }

  .post-hero {
    width: min(100vw - 4rem, 60rem);
    margin-inline: calc((var(--measure) - min(100vw - 4rem, 60rem)) / 2);
  }
  .post-hero img { width: 100%; }
}

/* ---------------------------------------------------------------------------
   Reduced motion & print
--------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .site-nav, .nav-toggle, .comments, .site-footer .prompt { display: none; }
  body { background: #fff; color: #000; }
}
