/* ============================================
   INKWELL CHRONICLE THEME
   Visual DNA transferred from HTML5 UP Editorial
   ============================================
   Layout: Sidebar + main content (asymmetric)
   Typography: Serif headings + sans body (mixed)
   Palette: White base, warm gray sidebar, coral accent
   Rhythm: Thin ruled dividers, accent-bordered headers
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, video { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; }
ul, ol { list-style: none; }
article, aside, details, figcaption, figure, footer, header, main, nav, section { display: block; }

/* --- CSS Variables (Editorial palette transfer) --- */
:root {
  /* Core palette — warm neutral base with coral accent */
  --color-bg: #ffffff;
  --color-sidebar: #f4f5f6;
  --color-sidebar-alt: #eaecee;
  --color-accent: #e8605a;
  --color-accent-hover: #d9504a;
  --color-accent-subtle: rgba(232, 96, 90, 0.06);
  --color-heading: #363b40;
  --color-body: #6e777e;
  --color-border: rgba(200, 207, 212, 0.7);
  --color-border-strong: rgba(200, 207, 212, 1);
  --color-white: #ffffff;

  /* Typography — serif display + sans body */
  --font-heading: 'Georgia', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  /* Spacing rhythm */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 3.5rem;
  --space-xl: 5rem;
  --space-2xl: 6rem;

  /* Sidebar width */
  --sidebar-width: 22rem;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.35s ease;
}

/* --- Base Typography --- */
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-body);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.75em 0;
}

h1 { font-size: 2.8em; line-height: 1.2; margin-bottom: 0.5em; }
h2 { font-size: 1.65em; }
h3 { font-size: 1.25em; }
h4 { font-size: 1.05em; }

p { margin: 0 0 1.6em 0; }

a {
  color: var(--color-accent);
  border-bottom: 1px dotted var(--color-accent);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
a:hover {
  color: var(--color-accent-hover);
  border-bottom-color: var(--color-accent-hover);
}

strong, b { color: var(--color-heading); font-weight: 600; }
em, i { font-style: italic; }

blockquote {
  border-left: 3px solid var(--color-border-strong);
  font-style: italic;
  margin: 0 0 1.6em 0;
  padding: 0.5em 0 0.5em 1.8em;
}

code {
  background: rgba(230, 235, 237, 0.3);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.5em;
}

pre {
  margin: 0 0 1.6em 0;
  overflow-x: auto;
}
pre code {
  display: block;
  padding: 1em 1.4em;
  line-height: 1.75;
}

hr {
  border: 0;
  border-bottom: 1px solid var(--color-border);
  margin: var(--space-md) 0;
}

/* --- Section Header with accent underline (Editorial signature) --- */
.section-header {
  margin-bottom: var(--space-lg);
}
.section-header h2 {
  display: inline-block;
  padding-bottom: 0.45em;
  padding-right: 0.75em;
  border-bottom: 3px solid var(--color-accent);
  margin-bottom: 0;
}
.section-header p {
  font-family: var(--font-heading);
  font-size: 0.92em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-body);
  margin-top: 0.8em;
}

/* --- Layout: Wrapper (sidebar + main, flex row-reverse like Editorial) --- */
.site-wrapper {
  display: flex;
  flex-direction: row-reverse;
  min-height: 100vh;
}

/* --- Main Content Area --- */
.site-main {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}
.site-main > .inner {
  padding: 0 4.5em 1em 4.5em;
  max-width: 74em;
  margin: 0 auto;
}
.site-main > .inner > section,
.site-main > .inner > .content-section {
  padding: var(--space-xl) 0 var(--space-lg) 0;
  border-top: 2px solid var(--color-border);
}
.site-main > .inner > section:first-of-type,
.site-main > .inner > .content-section:first-of-type,
.site-main > .inner > .hero-section {
  border-top: 0 !important;
}

/* --- Top Header Bar (inside main, like Editorial) --- */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.8em 0;
}
.top-header .logo {
  border-bottom: 0;
  font-family: var(--font-heading);
  font-size: 1.1em;
  font-weight: 700;
  color: var(--color-heading);
}
.top-header .logo span {
  font-weight: 400;
  color: var(--color-body);
}
.top-header .logo:hover { color: var(--color-accent); }

/* --- Sidebar --- */
.site-sidebar {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  font-size: 0.9em;
  position: relative;
  transition: margin-left var(--transition-medium), box-shadow var(--transition-medium);
}
.site-sidebar .sidebar-inner {
  padding: 2em 2em 2.5em 2em;
  width: var(--sidebar-width);
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}
.site-sidebar .sidebar-inner > * {
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 2.5em;
  padding-bottom: 2.5em;
}
.site-sidebar .sidebar-inner > *:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Sidebar brand block (alt background like Editorial search bar) */
.sidebar-brand {
  background: var(--color-sidebar-alt);
  margin: -2em -2em 2.8em -2em !important;
  padding: 2em !important;
  border-bottom: 0 !important;
  width: calc(100% + 4em);
}
.sidebar-brand .brand-name {
  font-family: var(--font-heading);
  font-size: 1.5em;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 0.25em;
}
.sidebar-brand .brand-tagline {
  font-size: 0.92em;
  line-height: 1.5;
  margin-bottom: 0;
}

/* Sidebar navigation */
.sidebar-nav h3 {
  font-size: 1.15em;
  border-bottom: 3px solid var(--color-accent);
  display: inline-block;
  padding-bottom: 0.35em;
  padding-right: 0.6em;
  margin-bottom: 1.2em;
}
.sidebar-nav ul { margin: 0; padding: 0; }
.sidebar-nav li {
  border-top: 1px solid var(--color-border);
}
.sidebar-nav li:first-child { border-top: 0; }
.sidebar-nav li a {
  display: block;
  padding: 0.65em 0;
  color: var(--color-heading);
  border-bottom: 0;
  font-weight: 400;
  transition: color var(--transition-fast), padding-left var(--transition-fast);
}
.sidebar-nav li a:hover {
  color: var(--color-accent);
  padding-left: 0.5em;
}

/* Sidebar contact */
.sidebar-contact h3 {
  font-size: 1.15em;
  border-bottom: 3px solid var(--color-accent);
  display: inline-block;
  padding-bottom: 0.35em;
  padding-right: 0.6em;
  margin-bottom: 1em;
}
.sidebar-contact .contact-email {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  line-height: 1.5;
}
.sidebar-contact .contact-email::before {
  content: "✉";
  flex-shrink: 0;
  font-size: 1.1em;
  margin-top: 0.1em;
}
.sidebar-contact .contact-email a {
  word-break: break-all;
}

/* Sidebar footer / copyright */
.sidebar-footer {
  border-bottom: 0 !important;
}
.sidebar-footer .copyright {
  color: #9a9fa3;
  font-size: 0.88em;
  line-height: 1.6;
}

/* --- Mobile Sidebar Toggle --- */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1em;
  left: 1em;
  z-index: 1100;
  width: 44px;
  height: 44px;
  background: var(--color-sidebar);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 11px 9px;
  transition: background var(--transition-fast);
}
.sidebar-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-heading);
  border-radius: 1px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.sidebar-toggle:hover { background: var(--color-sidebar-alt); }

.sidebar-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-toggle.active span:nth-child(2) { opacity: 0; }
.sidebar-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 999;
}

/* --- Buttons (Ghost style — Editorial signature) --- */
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0 2em;
  height: 3.4em;
  line-height: 3.4em;
  border-radius: 4px;
  border-bottom: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-align: center;
}
.btn-outline {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--color-accent);
  color: var(--color-accent);
}
.btn-outline:hover {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}
.btn-primary {
  background: var(--color-accent);
  color: var(--color-white);
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-white);
}
.btn-large {
  font-size: 0.92em;
  height: 3.6em;
  line-height: 3.6em;
}

/* --- Hero Section (flex layout like Editorial banner) --- */
.hero-section {
  padding: var(--space-xl) 0 var(--space-lg) 0;
  display: flex;
  align-items: flex-start;
  gap: 3em;
}
.hero-content {
  flex: 1 1 55%;
  min-width: 0;
}
.hero-content h1 {
  margin-top: -0.08em;
}
.hero-content .hero-subtitle {
  font-size: 1.05em;
  margin-bottom: 1.8em;
}
.hero-content .hero-subtitle p { margin-bottom: 0.8em; }
.hero-content .hero-subtitle p:last-child { margin-bottom: 0; }
.hero-actions {
  margin-top: 2em;
}

/* --- Topics Grid (2-column icon+text like Editorial features) --- */
.topics-grid {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 var(--space-md) -2.5em;
  width: calc(100% + 2.5em);
}
.topic-item {
  display: flex;
  align-items: flex-start;
  margin: 0 0 2.5em 2.5em;
  width: calc(50% - 2.5em);
  position: relative;
}
.topic-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5em;
  height: 5em;
  margin-right: 1.5em;
  position: relative;
}
/* Diamond frame — rotated square border (Editorial signature element) */
.topic-icon::after {
  content: '';
  position: absolute;
  width: 3.8em;
  height: 3.8em;
  border: 2px solid var(--color-border-strong);
  border-radius: 3px;
  transform: rotate(45deg);
  top: 50%;
  left: 50%;
  margin-top: -1.9em;
  margin-left: -1.9em;
}
.topic-icon .icon-text {
  font-family: var(--font-heading);
  font-size: 1.5em;
  font-weight: 700;
  color: var(--color-accent);
  position: relative;
  z-index: 1;
}
.topic-body {
  flex: 1 1 0%;
  min-width: 0;
}
.topic-body h3 {
  font-size: 1.1em;
  margin-bottom: 0.4em;
}
.topic-body p:last-child { margin-bottom: 0; }

/* --- Posts Grid (flex wrap with pseudo-element dividers like Editorial) --- */
.posts-grid {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 var(--space-md) -3em;
  width: calc(100% + 3em);
}
.post-card {
  flex: 0 0 calc(50% - 3em);
  margin: 0 0 3em 3em;
  position: relative;
}
/* Vertical divider between columns */
.post-card:nth-child(2n)::before {
  content: '';
  position: absolute;
  left: -1.5em;
  top: 0;
  height: 100%;
  border-left: 1px solid var(--color-border);
}
/* Horizontal divider below rows */
.post-card::after {
  content: '';
  position: absolute;
  bottom: -1.5em;
  left: 0;
  width: 100%;
  border-bottom: 1px solid var(--color-border);
}
.post-card .post-image {
  display: block;
  margin-bottom: 1.2em;
  border-bottom: 0;
  overflow: hidden;
}
.post-card .post-image img {
  width: 100%;
  transition: transform var(--transition-medium);
}
.post-card .post-image:hover img {
  transform: scale(1.03);
}
.post-card .post-date {
  font-size: 0.82em;
  color: #9a9fa3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4em;
}
.post-card h3 {
  font-size: 1.15em;
  margin-bottom: 0.5em;
}
.post-card h3 a {
  color: var(--color-heading);
  border-bottom: 0;
}
.post-card h3 a:hover { color: var(--color-accent); }
.post-card .post-excerpt {
  margin-bottom: 1.2em;
}
.post-card .post-excerpt p:last-child { margin-bottom: 0; }

/* --- FAQ Section (editorial-style, bordered top items) --- */
.faq-list {
  max-width: 52em;
}
.faq-item {
  border-top: 2px solid var(--color-border);
  padding: 1.8em 0;
}
.faq-item:first-child {
  border-top: 0;
  padding-top: 0;
}
.faq-item h3 {
  font-size: 1.08em;
  margin-bottom: 0.5em;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
}
.faq-item h3::before {
  content: '◆';
  color: var(--color-accent);
  font-size: 0.6em;
  margin-top: 0.45em;
  flex-shrink: 0;
}
.faq-answer p:last-child { margin-bottom: 0; }

/* --- Blog Index (list layout variation) --- */
.blog-list .post-card {
  flex: 0 0 calc(50% - 3em);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.35em;
  flex-wrap: wrap;
  padding-top: var(--space-md);
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5em;
  height: 2.5em;
  padding: 0 0.6em;
  font-family: var(--font-heading);
  font-size: 0.85em;
  font-weight: 700;
  border-radius: 3px;
  border-bottom: 0;
  color: var(--color-heading);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.pagination a:hover {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}
.pagination .active {
  background: var(--color-accent);
  color: var(--color-white);
}
.pagination .prev-next {
  font-family: var(--font-heading);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Single Post --- */
.post-single {
  max-width: 52em;
}
.post-single .post-meta {
  font-size: 0.85em;
  color: #9a9fa3;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5em;
}
.post-single .post-cover {
  margin-bottom: var(--space-md);
}
.post-single .post-cover img {
  width: 100%;
  border-radius: 2px;
}
.post-single .post-excerpt-block {
  font-size: 1.1em;
  line-height: 1.7;
  color: var(--color-heading);
  border-left: 3px solid var(--color-accent);
  padding-left: 1.5em;
  margin-bottom: var(--space-md);
}
.post-single .post-excerpt-block p:last-child { margin-bottom: 0; }

/* Content HTML styling */
.content-html h2 { margin-top: 1.5em; }
.content-html h3 { margin-top: 1.3em; }
.content-html ul, .content-html ol {
  margin: 0 0 1.6em 1.5em;
}
.content-html ul { list-style: disc; }
.content-html ol { list-style: decimal; }
.content-html li { margin-bottom: 0.4em; }
.content-html img {
  border-radius: 2px;
  margin: 1em 0;
}
.content-html a {
  color: var(--color-accent);
  border-bottom: 1px dotted var(--color-accent);
}
.content-html table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.6em 0;
}
.content-html th, .content-html td {
  border: 1px solid var(--color-border);
  padding: 0.6em 0.8em;
  text-align: left;
}
.content-html th {
  background: var(--color-sidebar);
  font-weight: 600;
  color: var(--color-heading);
}

/* --- Page Template --- */
.page-content {
  max-width: 52em;
}
.page-content h1 {
  margin-bottom: 0.3em;
}
.page-content .accent-line {
  width: 3em;
  height: 3px;
  background: var(--color-accent);
  margin-bottom: var(--space-md);
}

/* --- Footer (inside sidebar, Editorial style) --- */
/* Already handled in sidebar-footer */

/* --- Skip Nav --- */
.skip-nav {
  position: absolute;
  top: -100%;
  left: 1em;
  background: var(--color-accent);
  color: var(--color-white);
  padding: 0.5em 1em;
  border-radius: 0 0 4px 4px;
  z-index: 2000;
  border-bottom: 0;
  font-size: 0.85em;
}
.skip-nav:focus {
  top: 0;
  color: var(--color-white);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media screen and (max-width: 1440px) {
  :root { --sidebar-width: 20rem; }
  .site-main > .inner { padding: 0 3.5em 1em 3.5em; }
  h1 { font-size: 2.4em; }
}

@media screen and (max-width: 1280px) {
  :root { --sidebar-width: 19rem; }
  .site-main > .inner { padding: 0 3em 1em 3em; }
  .site-main > .inner > section,
  .site-main > .inner > .content-section {
    padding: var(--space-lg) 0 var(--space-md) 0;
  }
  h1 { font-size: 2.2em; }
}

@media screen and (max-width: 1024px) {
  /* Sidebar becomes overlay on tablet */
  .sidebar-toggle { display: flex; }

  .site-wrapper { flex-direction: column; }

  .site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--transition-medium);
    box-shadow: none;
    width: 20rem;
  }
  .site-sidebar .sidebar-inner {
    width: 20rem;
  }
  .site-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .sidebar-overlay.is-visible {
    display: block;
  }

  .site-main > .inner { padding: 0 3em 1em 3em; }
  .top-header { padding-left: 3em; }

  .hero-section { gap: 2.5em; }
}

@media screen and (max-width: 768px) {
  body { font-size: 14px; }
  .site-main > .inner { padding: 0 2em 1em 2em; }
  .top-header { padding-left: 3.5em; }
  h1 { font-size: 2em; }

  .hero-section {
    flex-direction: column;
  }
  .hero-content { flex: none; width: 100%; }

  .topics-grid {
    margin: 0 0 var(--space-md) 0;
    width: 100%;
  }
  .topic-item {
    width: 100%;
    margin: 0 0 2.2em 0;
  }

  .posts-grid, .blog-list {
    margin: 0 0 var(--space-md) 0;
    width: 100%;
  }
  .post-card, .blog-list .post-card {
    flex: 0 0 100%;
    margin: 0 0 2.5em 0;
  }
  .post-card:nth-child(2n)::before { display: none; }
}

@media screen and (max-width: 480px) {
  .site-main > .inner { padding: 0 1.3em 1em 1.3em; }
  .top-header { padding-left: 3.5em; padding-right: 0; }
  h1 { font-size: 1.7em; line-height: 1.3; }
  h2 { font-size: 1.35em; }

  .topic-item {
    flex-direction: column;
  }
  .topic-icon {
    margin: 0 0 1em 0;
    width: 4em;
    height: 4em;
  }
  .topic-icon::after {
    width: 3em;
    height: 3em;
    margin-top: -1.5em;
    margin-left: -1.5em;
  }
  .topic-icon .icon-text { font-size: 1.2em; }

  .btn { font-size: 0.72em; padding: 0 1.5em; }
  .btn-large { font-size: 0.82em; }
}

/* --- Site Footer (below wrapper, visible on all) --- */
.site-footer {
  background: var(--color-sidebar);
  border-top: 2px solid var(--color-border);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  font-size: 0.88em;
}
.site-footer .footer-inner {
  max-width: 50em;
  margin: 0 auto;
}
.site-footer .footer-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-heading);
  font-size: 1.2em;
  margin-bottom: 0.8em;
}
.site-footer .footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3em 1.5em;
  margin-bottom: 1em;
}
.site-footer .footer-nav a {
  color: var(--color-body);
  border-bottom: 0;
  transition: color var(--transition-fast);
}
.site-footer .footer-nav a:hover { color: var(--color-accent); }
.site-footer .footer-contact {
  margin-bottom: 1em;
}
.site-footer .footer-contact a {
  border-bottom: 1px dotted;
}
.site-footer .footer-copy {
  color: #9a9fa3;
  margin-bottom: 0;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .site-sidebar, .sidebar-toggle, .sidebar-overlay { display: none !important; }
  .site-main > .inner { padding: 0; }
  a { border-bottom: 0; }
  .btn { border: 1px solid #000; }
}
