/*
Theme Name: ARSTUDIOS ePaper
Theme URI: https://aanews.co.in
Author: AR Studios
Author URI: https://aanews.co.in
Description: Full WordPress theme built around the ARSTUDIOS EPAPER engine. The homepage itself is the ePaper — the viewer is rendered directly by the theme, with no shortcode required. Original engine logic (admin, database, viewer, sharing, PDF-to-image) is included unmodified in inc-epaper/ and wired in via functions.php.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL2
Text Domain: arstudios-epaper-theme
*/

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root{
  --ink:        #1a1a2e; /* deep navy - masthead / footer */
  --ink-2:      #24243c;
  --accent:     #8B4513; /* saddle brown - carried over from the ePaper engine's own floating button */
  --accent-2:   #b5651d;
  --headline:   #7a1212; /* deep red for headline rules, common in regional newspapers */
  --paper:      #faf7f2; /* warm off-white "newsprint" background */
  --paper-2:    #f1ece2;
  --ruleline:   #d8cfc0;
  --text:       #2b2b2b;
  --text-muted: #6b6b6b;
  --white:      #ffffff;

  --font-display: 'Noto Serif Telugu', 'Noto Serif', Georgia, serif;
  --font-body:    'Hind Guntur', 'Noto Sans Telugu', -apple-system, BlinkMacSystemFont, sans-serif;

  --container: 1180px;
}

*{ box-sizing: border-box; }

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

body{
  margin:0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}

a{ color: inherit; text-decoration: none; }
img{ max-width:100%; height:auto; display:block; }
ul{ margin:0; padding:0; list-style:none; }

.container{
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline: 3px solid var(--accent-2);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   MASTHEAD (signature element)
   ========================================================================== */
.ars-topbar{
  background: var(--ink);
  color: #cfcfe0;
  font-size: 13px;
}
.ars-topbar .container{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding-top:8px;
  padding-bottom:8px;
  gap: 12px;
  flex-wrap: wrap;
}
.ars-topbar .ars-date{ letter-spacing:.02em; }
.ars-topbar-links{ display:flex; gap:18px; }
.ars-topbar-links a:hover{ color: var(--white); }

.ars-masthead{
  background: var(--paper);
  border-bottom: 4px solid var(--ink);
  padding: 26px 0 18px;
}
.ars-masthead .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.ars-masthead-brand{
  display:flex;
  align-items:center;
  gap:16px;
}
.ars-masthead-brand img{ max-height:64px; width:auto; }
.ars-site-title{
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  color: var(--ink);
  margin:0;
  letter-spacing: 0.01em;
}
.ars-site-tagline{
  font-size: 13px;
  color: var(--text-muted);
  margin: 2px 0 0;
  font-style: italic;
}

/* Double newspaper rule under masthead */
.ars-rule-double{
  border:0;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 4px;
  margin: 0;
}

/* ==========================================================================
   PRIMARY NAV
   ========================================================================== */
.ars-nav{
  background: var(--ink);
}
.ars-nav .container{ display:flex; align-items:center; justify-content:space-between; }
.ars-nav-menu{ display:flex; flex-wrap:wrap; }
.ars-nav-menu li a{
  display:block;
  padding: 14px 18px;
  color: #e8e6f5;
  font-weight:600;
  font-size: 14.5px;
  letter-spacing:.02em;
  border-right: 1px solid rgba(255,255,255,.08);
}
.ars-nav-menu li a:hover,
.ars-nav-menu li.current-menu-item a{
  background: var(--accent);
  color: var(--white);
}
.ars-nav-toggle{
  display:none;
  background:none;
  border:0;
  color:#fff;
  font-size: 24px;
  padding: 10px 16px;
  cursor:pointer;
}

.btn{
  display:inline-block;
  padding: 9px 20px;
  border-radius: 40px;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--ink) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:hover{ transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.22); color:var(--white); }
.btn-outline{
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
}

/* ==========================================================================
   LAYOUT / CONTENT
   ========================================================================== */
.ars-layout{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  padding: 40px 0;
}
@media (max-width: 860px){
  .ars-layout{ grid-template-columns: 1fr; }
}

.ars-section-label{
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--headline);
  border-bottom: 2px solid var(--headline);
  display:inline-block;
  padding-bottom: 4px;
  margin: 0 0 20px;
}

.ars-post-card{
  border-bottom: 1px solid var(--ruleline);
  padding: 22px 0;
}
.ars-post-card:first-child{ padding-top: 0; }
.ars-post-title{
  font-family: var(--font-display);
  font-size: 24px;
  line-height:1.3;
  margin: 0 0 8px;
}
.ars-post-title a:hover{ color: var(--headline); }
.ars-post-meta{
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}
.ars-post-excerpt{ color: var(--text); }
.ars-post-thumb{ margin-bottom: 14px; border: 1px solid var(--ruleline); }

.ars-sidebar-widget{
  background: var(--paper-2);
  border: 1px solid var(--ruleline);
  padding: 20px;
  margin-bottom: 24px;
}

.ars-pagination{ display:flex; gap:10px; margin-top: 20px; }
.ars-pagination a, .ars-pagination span{
  padding: 8px 14px;
  border:1px solid var(--ruleline);
  font-size: 13px;
}
.ars-pagination .current{ background: var(--ink); color:var(--white); }

/* Single/page content */
.ars-single .ars-post-title{ font-size: clamp(28px,4vw,40px); }
.ars-article-body{ font-size: 17.5px; line-height: 1.8; }
.ars-article-body p{ margin: 0 0 1.2em; }
.ars-article-body h2, .ars-article-body h3{ font-family: var(--font-display); color: var(--ink); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.ars-footer{
  background: var(--ink);
  color: #c7c6da;
  margin-top: 40px;
  padding: 40px 0 20px;
}
.ars-footer-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
@media (max-width: 700px){ .ars-footer-grid{ grid-template-columns: 1fr; } }
.ars-footer h4{
  color: var(--white);
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 14px;
}
.ars-footer ul li{ margin-bottom: 8px; }
.ars-footer a:hover{ color: var(--white); }
.ars-footer-social{ display:flex; gap: 14px; margin-top: 4px; }
.ars-footer-social a{
  width: 34px; height:34px;
  display:flex; align-items:center; justify-content:center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
}
.ars-footer-bottom{
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap: 8px;
  font-size: 12.5px;
  padding-top: 18px;
  color: #9291ab;
}

/* Skip link */
.skip-link{
  position:absolute; left:-9999px; top:0; background:var(--white); color:var(--ink);
  padding: 10px 16px; z-index: 100000;
}
.skip-link:focus{ left: 10px; top: 10px; }

/* Mobile nav */
@media (max-width: 860px){
  .ars-nav-toggle{ display:block; }
  .ars-nav-menu{
    display:none;
    flex-direction:column;
    width:100%;
  }
  .ars-nav-menu.is-open{ display:flex; }
  .ars-nav .container{ flex-wrap:wrap; }
  .ars-nav-menu li a{ border-right:0; border-bottom:1px solid rgba(255,255,255,.08); }
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */
html.ars-dark{
  --paper:      #14141f;
  --paper-2:    #1c1c2b;
  --text:       #e9e7f2;
  --text-muted: #a7a5c0;
  --ruleline:   #33334a;
}
html.ars-dark .ars-masthead{ background: var(--paper); border-bottom-color: #33334a; }
html.ars-dark .ars-epaper-col-left,
html.ars-dark .ars-epaper-col-right,
html.ars-dark .ars-archive-card{
  background: var(--paper-2);
  border-color: var(--ruleline);
}
html.ars-dark .ars-post-thumb,
html.ars-dark .ars-sidebar-widget{ border-color: var(--ruleline); }

/* ==========================================================================
   HOMEPAGE MASTHEAD (rich version — front page only)
   ========================================================================== */
.ars-home-masthead-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.ars-home-masthead-tools{
  display:flex;
  align-items:center;
  gap: 14px;
  flex-wrap: wrap;
}
.ars-home-edition-jump{
  padding: 9px 14px;
  border-radius: 40px;
  border: 1px solid var(--ruleline);
  background: var(--white);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}
.ars-home-search{
  display:flex;
  align-items:center;
  border: 1px solid var(--ruleline);
  border-radius: 40px;
  overflow:hidden;
  background: var(--white);
}
.ars-home-search input[type="search"]{
  border:0;
  padding: 9px 14px;
  font-size: 13.5px;
  width: 150px;
  background: transparent;
  color: var(--text);
}
.ars-home-search input[type="search"]:focus{ outline:0; }
.ars-home-search button{
  border:0;
  background: var(--ink);
  color:#fff;
  padding: 9px 14px;
  cursor:pointer;
}
.ars-dark-toggle{
  border: 1px solid var(--ruleline);
  background: var(--white);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display:flex; align-items:center; justify-content:center;
}
.ars-dark-toggle:hover{ background: var(--paper-2); }
.ars-home-social{ display:flex; gap:8px; }
.ars-home-social a{
  width: 34px; height:34px;
  display:flex; align-items:center; justify-content:center;
  border: 1px solid var(--ruleline);
  border-radius: 50%;
  background: var(--white);
}

/* ==========================================================================
   HOMEPAGE — THE EPAPER ITSELF
   ========================================================================== */
.ars-epaper-home{ padding-bottom: 20px; }

.ars-epaper-grid{
  display:grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 24px;
  padding: 28px 20px;
  align-items:start;
}
.ars-epaper-col-left,
.ars-epaper-col-right{ display:flex; flex-direction:column; gap:20px; }
.ars-epaper-col-center{ min-width:0; } /* prevents the viewer from ever overflowing its grid track */

/* Card look for the side columns — "soft shadow, rounded corners, lots of white space" */
.ars-epaper-collapsible{
  background: var(--white);
  border: 1px solid var(--ruleline);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.05);
  padding: 18px 20px;
}
.ars-epaper-collapsible summary{
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--headline);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.ars-epaper-collapsible summary::-webkit-details-marker{ display:none; }
.ars-epaper-collapsible[open] summary{ margin-bottom: 14px; }

.ars-prev-editions-list,
.ars-latest-editions-list{
  max-height: 420px;
  overflow-y: auto;
}
.ars-prev-editions-list li a{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background .15s ease;
}
.ars-prev-editions-list li a:hover,
.ars-prev-editions-list li.is-active a{
  background: var(--paper-2);
}
.ars-prev-ed-date{ font-weight:700; font-size:13.5px; }
.ars-prev-ed-name{ font-size:12px; color: var(--text-muted); }
.ars-prev-editions-list li.ars-empty{ color: var(--text-muted); font-size: 13.5px; padding: 6px 8px; }

.ars-latest-editions-list li a{
  display:block;
  padding: 8px;
  border-radius: 8px;
  font-size: 13.5px;
}
.ars-latest-editions-list li a:hover{ background: var(--paper-2); }

.ars-edition-info-box p{ margin: 0 0 8px; font-size: 14px; }
.ars-edition-info-box .btn{ margin-top: 6px; width:100%; text-align:center; }

/* Hide the collapse affordance on desktop — content stays open by default
   (the `open` attribute), summary click only matters on mobile */
@media (min-width: 861px){
  .ars-epaper-collapsible summary{ pointer-events:none; }
}

/* ==========================================================================
   ARCHIVE GRID (bottom of homepage)
   ========================================================================== */
.ars-epaper-archive{ padding: 20px 0 50px; }
.ars-archive-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;
}
.ars-archive-card{
  background: var(--white);
  border: 1px solid var(--ruleline);
  border-radius: 12px;
  overflow:hidden;
  box-shadow: 0 3px 12px rgba(0,0,0,.05);
  transition: transform .18s ease, box-shadow .18s ease;
  display:block;
}
.ars-archive-card:hover{ transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.ars-archive-card img{
  width:100%;
  aspect-ratio: 300 / 420;
  object-fit: cover;
  background: var(--paper-2);
}
.ars-archive-date{
  display:block;
  padding: 10px;
  font-size: 12.5px;
  font-weight:700;
  text-align:center;
  color: var(--text);
}

/* ==========================================================================
   HOMEPAGE — RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px){
  .ars-epaper-grid{ grid-template-columns: 220px minmax(0,1fr) 260px; gap: 18px; }
}

@media (max-width: 900px){
  .ars-epaper-grid{
    grid-template-columns: 1fr;
  }
  .ars-epaper-col-left{ order: 2; }
  .ars-epaper-col-center{ order: 1; }
  .ars-epaper-col-right{ order: 3; }

  .ars-epaper-collapsible summary{ pointer-events: auto; }
  .ars-prev-editions-list,
  .ars-latest-editions-list{ max-height: 260px; }

  .ars-home-masthead-row{ justify-content:center; text-align:center; }
  .ars-home-masthead-tools{ justify-content:center; width:100%; }
  .ars-home-search input[type="search"]{ width: 120px; }
}

@media (max-width: 480px){
  .ars-epaper-grid{ padding: 16px 14px; gap: 14px; }
  .ars-archive-grid{ grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
  .ars-home-masthead-tools{ gap: 8px; }
  .ars-home-edition-jump{ font-size: 12.5px; padding: 7px 10px; }
}
