/*
Theme Name: Inkwell
Theme URI: https://example.com/inkwell
Author: Your Name
Author URI: https://example.com
Description: A clean, minimal, fast-loading blog theme with excellent ad placement support. Features a refined typographic style, sticky sidebar ads, in-feed ad slots, and full Gutenberg compatibility.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: inkwell
Tags: blog, minimal, clean, two-columns, custom-menu, featured-images, threaded-comments, translation-ready, full-width-template
*/

/* ============================================================
   CSS VARIABLES
============================================================ */
:root {
  --bg:        #f8f6f2;
  --surface:   #ffffff;
  --ink:       #1c1917;
  --ink-light: #57534e;
  --ink-faint: #a8a29e;
  --accent:    #b45309;
  --accent-h:  #92400e;
  --border:    #e7e5e4;
  --radius:    4px;

  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-sans:  'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --max-width:  1140px;
  --content-w:  720px;

  --space-xs:   0.375rem;
  --space-sm:   0.75rem;
  --space-md:   1.25rem;
  --space-lg:   2rem;
  --space-xl:   3.5rem;
}

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-h); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

img, video { display: block; max-width: 100%; height: auto; }

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-serif);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

p { margin-bottom: 1.25rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 0 0.75rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--ink-light);
}

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* ============================================================
   LAYOUT WRAPPERS
============================================================ */
.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.site-main    { flex: 1; }

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* ============================================================
   HEADER / NAV
============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(248,246,242,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 1.5rem;
}

.site-branding { flex-shrink: 0; }

.site-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
}
.site-title a { color: inherit; }
.site-title a:hover { color: var(--accent); }

.site-description {
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

/* Primary Navigation */
.main-navigation { display: flex; align-items: center; }

.main-navigation ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  gap: 0.25rem;
}

.main-navigation a {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-light);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  display: block;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a { color: var(--ink); background: var(--border); }

.nav-subscribe {
  background: var(--ink);
  color: var(--bg) !important;
  border-radius: 2rem;
  padding: 0.38rem 1rem !important;
  font-size: 0.8rem !important;
}
.nav-subscribe:hover { background: var(--accent) !important; color: #fff !important; }

/* Hamburger */
.menu-toggle {
  display: none;
  background: none; border: none;
  cursor: pointer; padding: 0.4rem;
  color: var(--ink); font-size: 1.3rem;
}

/* ============================================================
   AD: LEADERBOARD (728×90) — Below header
============================================================ */
.ad-leaderboard-wrap {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1ede8;
  border: 1px dashed #d6cfc6;
  color: var(--ink-faint);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.ad-slot-leaderboard { width: 728px; max-width: 100%; height: 90px; }
.ad-slot-rectangle   { width: 300px; height: 250px; }
.ad-slot-infeed      { width: 100%; height: 90px; margin-block: 0.5rem; }
.ad-slot-footer      { width: 728px; max-width: 100%; height: 90px; }

/* ============================================================
   CONTENT AREA LAYOUT
============================================================ */
.content-area {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  padding-block: 3rem;
  align-items: start;
}

/* Full-width no sidebar */
.no-sidebar .content-area {
  grid-template-columns: 1fr;
  max-width: var(--content-w);
}

/* ============================================================
   HERO / FEATURED POST
============================================================ */
.featured-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.featured-hero__image {
  background: linear-gradient(135deg, #292524 0%, #78350f 100%);
  min-height: 320px;
  position: relative;
}

.featured-hero__image img {
  width: 100%; height: 100%;
  object-fit: cover; opacity: 0.85;
}

.featured-hero__label {
  position: absolute; bottom: 1.25rem; left: 1.25rem;
  background: var(--accent); color: #fff;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.2rem 0.65rem; border-radius: 2rem;
}

.featured-hero__body {
  padding: 2.5rem 2rem;
  display: flex; flex-direction: column; justify-content: center;
}

.featured-hero__cat {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.6rem;
}

.featured-hero__title {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin-bottom: 0.75rem;
}
.featured-hero__title a { color: var(--ink); }
.featured-hero__title a:hover { color: var(--accent); }

.featured-hero__excerpt {
  color: var(--ink-light);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.post-meta {
  font-size: 0.78rem; color: var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem;
  align-items: center;
}
.post-meta a { color: var(--ink-faint); }
.post-meta a:hover { color: var(--accent); }
.post-meta .sep { opacity: 0.4; }

/* ============================================================
   SECTION DIVIDER
============================================================ */
.section-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-header h2 {
  font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-light); white-space: nowrap;
}
.section-header::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* ============================================================
   POST CARDS — LOOP
============================================================ */
.posts-list { display: flex; flex-direction: column; gap: 0.5rem; }

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 160px 1fr;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.post-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
  transform: translateY(-1px);
}

.post-card__thumb {
  background: linear-gradient(135deg, #e7e5e4, #d6d3d1);
  overflow: hidden;
  position: relative;
  min-height: 130px;
}
.post-card__thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.35s ease;
}
.post-card:hover .post-card__thumb img { transform: scale(1.04); }

.post-card__body {
  padding: 1.1rem 1.25rem;
  display: flex; flex-direction: column; justify-content: center;
}

.post-card__cat {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.3rem;
}

.post-card__title {
  font-size: 1.05rem; margin-bottom: 0.4rem;
  line-height: 1.3;
}
.post-card__title a { color: var(--ink); }
.post-card__title a:hover { color: var(--accent); }

.post-card__excerpt {
  font-size: 0.85rem; color: var(--ink-light);
  margin-bottom: 0.6rem;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ============================================================
   PAGINATION
============================================================ */
.pagination {
  display: flex; justify-content: center;
  gap: 0.4rem; margin-top: 2.5rem; flex-wrap: wrap;
}
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem; color: var(--ink-light);
  transition: all 0.2s;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  background: var(--ink); color: var(--bg);
  border-color: var(--ink);
}

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar-inner { display: flex; flex-direction: column; gap: 1.75rem; position: sticky; top: 80px; }

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
}

.widget-title {
  font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 1rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Widget: Recent Posts */
.widget_recent_entries ul { list-style: none; padding: 0; margin: 0; }
.widget_recent_entries li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem; line-height: 1.4;
}
.widget_recent_entries li:last-child { border-bottom: none; padding-bottom: 0; }
.widget_recent_entries .post-date { display: block; font-size: 0.72rem; color: var(--ink-faint); margin-top: 0.15rem; }

/* Widget: Categories */
.widget_categories ul { list-style: none; padding: 0; margin: 0; }
.widget_categories li {
  display: flex; justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.widget_categories li:last-child { border-bottom: none; }

/* Widget: Search */
.widget_search .search-form { display: flex; gap: 0.4rem; }
.widget_search input[type="search"] {
  flex: 1; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 0.87rem;
  background: var(--bg); outline: none;
  transition: border-color 0.2s;
}
.widget_search input[type="search"]:focus { border-color: var(--ink); }
.widget_search input[type="submit"] {
  padding: 0.5rem 0.85rem;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 0.82rem;
  cursor: pointer; transition: background 0.2s;
}
.widget_search input[type="submit"]:hover { background: var(--accent); }

/* Widget: Tag Cloud */
.widget_tag_cloud .tagcloud { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.widget_tag_cloud a {
  font-size: 0.78rem !important;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 2rem;
  color: var(--ink-light);
  transition: all 0.2s;
  background: var(--bg);
}
.widget_tag_cloud a:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }

/* Newsletter Widget */
.widget-newsletter p { font-size: 0.85rem; color: var(--ink-light); margin-bottom: 0.85rem; }
.widget-newsletter input[type="email"] {
  width: 100%; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 0.87rem;
  background: var(--bg); outline: none;
  transition: border-color 0.2s; margin-bottom: 0.5rem;
}
.widget-newsletter input[type="email"]:focus { border-color: var(--ink); }
.widget-newsletter button {
  width: 100%; padding: 0.55rem;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 0.84rem; font-weight: 500;
  cursor: pointer; transition: background 0.2s;
}
.widget-newsletter button:hover { background: var(--accent); }

/* ============================================================
   SINGLE POST
============================================================ */
.single-post-header { margin-bottom: 2.5rem; }

.single-post-cat {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.75rem;
  display: block;
}

.single-post-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
}

.single-post-meta { margin-bottom: 1.5rem; }

.single-post-image {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
}
.single-post-image img { width: 100%; height: auto; max-height: 460px; object-fit: cover; }

/* Post content typography */
.entry-content {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink);
}
.entry-content h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; }
.entry-content h3 { font-size: 1.2rem; margin: 1.75rem 0 0.6rem; }
.entry-content a { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.entry-content a:hover { text-decoration-color: var(--accent); color: var(--accent); }
.entry-content img { border-radius: var(--radius); margin: 1.5rem auto; border: 1px solid var(--border); }
.entry-content pre {
  background: var(--ink); color: #e7e5e4;
  padding: 1.25rem; border-radius: var(--radius);
  overflow-x: auto; font-size: 0.88rem; margin-bottom: 1.5rem;
}
.entry-content code {
  background: var(--border); padding: 0.15rem 0.4rem;
  border-radius: 3px; font-size: 0.9em;
}
.entry-content pre code { background: none; padding: 0; }

/* In-Content Ad */
.ad-in-content {
  margin: 2rem auto;
  display: flex; justify-content: center;
}

/* Post Tags */
.post-tags { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-tags .label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.5rem; }
.post-tags a {
  display: inline-block;
  font-size: 0.78rem; padding: 0.25rem 0.65rem;
  border: 1px solid var(--border); border-radius: 2rem;
  color: var(--ink-light); margin: 0.2rem;
  transition: all 0.2s; background: var(--bg);
}
.post-tags a:hover { border-color: var(--ink); color: var(--ink); }

/* Author Box */
.author-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  display: flex; gap: 1.25rem; align-items: flex-start;
  margin-top: 2.5rem;
}
.author-box .author-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, var(--border), var(--accent));
}
.author-box .author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-box .author-name { font-family: var(--font-serif); font-size: 1rem; margin-bottom: 0.2rem; }
.author-box .author-bio { font-size: 0.87rem; color: var(--ink-light); }

/* Related Posts */
.related-posts { margin-top: 3rem; }
.related-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; margin-top: 1.25rem; }
.related-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.related-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.07); }
.related-card__thumb {
  height: 130px; overflow: hidden;
  background: linear-gradient(135deg, #e7e5e4, #d6d3d1);
}
.related-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-card__body { padding: 0.85rem 1rem; }
.related-card__cat { font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.25rem; }
.related-card__title { font-size: 0.9rem; line-height: 1.35; }
.related-card__title a { color: var(--ink); }
.related-card__title a:hover { color: var(--accent); }

/* ============================================================
   COMMENTS
============================================================ */
.comments-area { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.comments-title { font-size: 1.2rem; margin-bottom: 1.5rem; }

.comment-list { list-style: none; padding: 0; }
.comment { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.comment-author { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; }
.comment-metadata { font-size: 0.75rem; color: var(--ink-faint); margin-bottom: 0.6rem; }
.comment-content p { font-size: 0.92rem; margin-bottom: 0; }

.comment-form label { font-size: 0.85rem; font-weight: 500; display: block; margin-bottom: 0.3rem; }
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%; padding: 0.55rem 0.85rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 0.9rem;
  background: var(--bg); outline: none; margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--ink); }
.comment-form textarea { min-height: 130px; resize: vertical; }
.comment-form .form-submit input[type="submit"] {
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--radius);
  padding: 0.6rem 1.5rem;
  font-family: var(--font-sans); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: background 0.2s;
}
.comment-form .form-submit input[type="submit"]:hover { background: var(--accent); }

/* ============================================================
   FOOTER
============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-top: 3rem;
}

.footer-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}

.footer-brand .site-title { font-size: 1.5rem; margin-bottom: 0.5rem; }
.footer-brand .site-description { font-size: 0.82rem; color: var(--ink-light); max-width: 28ch; }

.footer-col h4 { font-family: var(--font-serif); font-size: 0.95rem; margin-bottom: 1rem; }
.footer-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-col ul a { font-size: 0.85rem; color: var(--ink-light); }
.footer-col ul a:hover { color: var(--accent); }

.footer-ad {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  display: flex; justify-content: center;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; color: var(--ink-faint);
}
.footer-bottom a { color: var(--ink-faint); }
.footer-bottom a:hover { color: var(--accent); }

/* ============================================================
   PAGE: 404
============================================================ */
.error-404 {
  text-align: center; padding: 6rem 1rem;
}
.error-404 .error-code {
  font-family: var(--font-serif);
  font-size: 7rem; line-height: 1;
  color: var(--border); margin-bottom: 1rem;
}
.error-404 h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.error-404 p { color: var(--ink-light); margin-bottom: 2rem; }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1024px) {
  .content-area { grid-template-columns: 1fr 260px; gap: 2rem; }
  .featured-hero { grid-template-columns: 1fr; }
  .featured-hero__image { min-height: 220px; }
  .footer-widgets { grid-template-columns: 1fr 1fr; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .content-area { grid-template-columns: 1fr; }
  .sidebar-inner { position: static; }
  .post-card { grid-template-columns: 120px 1fr; }
  .footer-widgets { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.4rem; text-align: center; }
  .related-grid { grid-template-columns: 1fr; }
  .menu-toggle { display: block; }
  .main-navigation { display: none; position: absolute; top: 62px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 1rem; }
  .main-navigation.toggled { display: block; }
  .main-navigation ul { flex-direction: column; gap: 0; }
  .main-navigation a { padding: 0.55rem 0.75rem; }
}

@media (max-width: 480px) {
  .post-card { grid-template-columns: 1fr; }
  .post-card__thumb { min-height: 180px; }
  .ad-slot-leaderboard { width: 320px; height: 50px; }
}
