/*
Theme Name: Grammarship
Theme URI: https://grammarship.com
Author: Grammarship
Description: An editorial theme for Grammarship.com — grammar tips and word origins, styled like a well-loved manuscript covered in red-pen corrections. Warm parchment background, ink-navy type, and hand-marked accents.
Version: 1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: grammarship
*/

/* ---------- Design tokens ---------- */
:root{
  --paper: #F0E9D6;
  --paper-2: #E8DFC6;
  --ink: #17233C;
  --ink-soft: #47526B;
  --red-pen: #B3311C;
  --red-pen-soft: #D66A4E;
  --sage: #4B6358;
  --line: rgba(23,35,60,0.14);
  --white: #FBF8F0;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --max: 1160px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior:smooth; }

body{
  margin:0;
  background: var(--paper);
  background-image:
    radial-gradient(rgba(23,35,60,0.035) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a{ color: var(--ink); text-decoration: none; }
img{ max-width:100%; height:auto; display:block; }

h1,h2,h3,h4{
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.12;
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}

p{ margin: 0 0 1.1em; }

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

/* ---------- Signature: red-pen marks ---------- */
.mark-circle{
  position: relative;
  white-space: nowrap;
}
.mark-circle::after{
  content:"";
  position:absolute;
  left:-10%; right:-10%; top:-16%; bottom:-14%;
  border: 2.5px solid var(--red-pen);
  border-radius: 52% 48% 46% 54% / 60% 55% 45% 40%;
  transform: rotate(-1.5deg);
  pointer-events:none;
}
.mark-underline{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='12' viewBox='0 0 120 12'%3E%3Cpath d='M2 8 Q 20 2, 40 7 T 80 6 T 118 8' stroke='%23B3311C' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: left bottom -2px;
  background-size: 110px 12px;
  padding-bottom: 6px;
}
.pron{
  font-family: var(--font-mono);
  color: var(--red-pen);
  font-size: 0.62em;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 10px;
}

/* ---------- Header ---------- */
.site-header{
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  position: relative;
  z-index: 10;
}
.site-header .wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.site-title{
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  margin:0;
  letter-spacing: -0.01em;
}
.site-title a{ color: var(--ink); }
.site-title .accent{ color: var(--red-pen); }
.site-description{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.main-navigation ul{
  list-style:none;
  display:flex;
  gap: 28px;
  margin:0; padding:0;
  flex-wrap: wrap;
}
.main-navigation a{
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.main-navigation a:hover,
.main-navigation .current-menu-item > a{
  color: var(--ink);
  border-color: var(--red-pen);
}
.menu-toggle{ display:none; }

/* ---------- Hero (front page) ---------- */
.hero{
  padding: 76px 0 64px;
  border-bottom: 1px solid var(--line);
}
.hero .eyebrow{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--red-pen);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 18px;
}
.hero h1{
  font-size: clamp(2.4rem, 5vw, 4rem);
  max-width: 15ch;
}
.hero .lede{
  font-size: 1.2rem;
  color: var(--ink-soft);
  max-width: 52ch;
  margin-top: 20px;
}
.hero-search{
  margin-top: 34px;
  display:flex;
  gap:10px;
  max-width: 480px;
}
.hero-search input[type="search"]{
  flex:1;
  padding: 14px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
}
.hero-search button{
  padding: 14px 20px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 3px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}
.hero-search button:hover{ background: var(--red-pen); }

/* ---------- Word of the day card ---------- */
.wotd{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 30px 32px;
  margin: 56px 0;
  box-shadow: 0 1px 0 var(--line);
}
.wotd .label{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sage);
  margin-bottom: 10px;
}
.wotd h2{ font-size: 1.9rem; margin-bottom: 6px; }
.wotd .excerpt{ color: var(--ink-soft); }
.wotd .readmore{
  font-weight:700;
  color: var(--red-pen);
  font-size: 0.9rem;
}

/* ---------- Section headers ---------- */
.section-head{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 60px 0 26px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.section-head h2{ font-size: 1.5rem; }
.section-head .see-all{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.section-head .see-all:hover{ color: var(--red-pen); }

/* ---------- Post grid / cards ---------- */
.post-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 40px;
}
.post-card{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.post-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(23,35,60,0.08);
}
.post-card .thumb{ aspect-ratio: 16/10; overflow:hidden; background: var(--paper-2); }
.post-card .thumb img{ width:100%; height:100%; object-fit:cover; }
.post-card .body{ padding: 20px 22px 24px; flex:1; display:flex; flex-direction:column; }
.post-card .cat{
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--red-pen);
  margin-bottom: 8px;
}
.post-card h3{ font-size: 1.2rem; margin-bottom: 8px; }
.post-card p{ color: var(--ink-soft); font-size: 0.95rem; flex:1; }
.post-card .meta{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* ---------- Category chips ---------- */
.chip-row{ display:flex; flex-wrap:wrap; gap:10px; margin: 30px 0 10px; }
.chip{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 7px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 20px;
  color: var(--ink);
}
.chip:hover{ background: var(--ink); color: var(--paper); }

/* ---------- Single post ---------- */
.single-post{ padding: 56px 0 80px; }
.single-post .entry-header{ max-width: 72ch; margin: 0 auto 36px; }
.single-post .cat{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--red-pen);
  margin-bottom: 14px;
}
.single-post h1{ font-size: clamp(2rem, 4vw, 2.8rem); }
.single-post .meta{
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 16px;
}
.single-post .entry-thumb{
  max-width: 900px;
  margin: 0 auto 40px;
  border-radius: 6px;
  overflow:hidden;
  border: 1px solid var(--line);
}
.entry-content{
  max-width: 72ch;
  margin: 0 auto;
  font-size: 1.08rem;
}
.entry-content h2{ font-size: 1.6rem; margin-top: 1.6em; }
.entry-content h3{ font-size: 1.3rem; margin-top: 1.4em; }
.entry-content blockquote{
  border-left: 3px solid var(--red-pen);
  margin: 1.6em 0;
  padding: 4px 0 4px 22px;
  color: var(--ink-soft);
  font-style: italic;
}
.entry-content a{ color: var(--sage); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.entry-content a:hover{ text-decoration-color: var(--red-pen); }
.entry-content code{
  font-family: var(--font-mono);
  background: var(--paper-2);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.88em;
}

/* ---------- Sidebar ---------- */
.content-with-sidebar{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items:start;
}
.widget-area .widget{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px;
  margin-bottom: 24px;
}
.widget-area .widget-title{
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage);
  margin-bottom: 14px;
}

/* ---------- Archive / Search ---------- */
.archive-header, .page-header{
  padding: 50px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.archive-header h1, .page-header h1{ font-size: 2.2rem; }
.post-list{ max-width: 760px; }
.post-list-item{
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.post-list-item h2{ font-size: 1.4rem; margin-bottom: 6px; }
.post-list-item .cat{
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--red-pen);
  margin-bottom: 8px;
  display:block;
}
.post-list-item p{ color: var(--ink-soft); }

/* ---------- Pagination ---------- */
.pagination{
  display:flex; gap:10px; margin: 40px 0;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.pagination a, .pagination span{
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-soft);
}
.pagination .current{ border-color: var(--ink); color: var(--ink); font-weight:700; }
.pagination a:hover{ border-color: var(--red-pen); color: var(--red-pen); }

/* ---------- Search form ---------- */
.search-form{ display:flex; gap:8px; }
.search-form input[type="search"]{
  flex:1; padding: 10px 12px; border: 1.5px solid var(--ink); border-radius:3px; background:var(--white);
}
.search-form button{
  padding: 10px 16px; background: var(--ink); color: var(--paper); border:none; border-radius:3px; font-weight:600; cursor:pointer;
}

/* ---------- Footer ---------- */
.site-footer{
  border-top: 1px solid var(--line);
  margin-top: 80px;
  padding: 46px 0 36px;
  background: var(--paper-2);
}
.site-footer .wrap{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap: 16px;
}
.site-footer .footer-tag{
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.site-footer nav ul{
  list-style:none; display:flex; gap:20px; margin:0; padding:0;
}
.site-footer a{ color: var(--ink-soft); font-size: 0.85rem; }
.site-footer a:hover{ color: var(--red-pen); }

/* ---------- Comments ---------- */
.comments-area{ max-width: 72ch; margin: 60px auto 0; }
.comment-list{ list-style:none; padding:0; }
.comment-body{
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.comment-form input, .comment-form textarea{
  width:100%; padding: 12px; border:1.5px solid var(--line); border-radius:4px; font-family: var(--font-body); margin-bottom: 12px; background: var(--white);
}
.comment-form button{
  padding: 12px 22px; background: var(--ink); color: var(--paper); border:none; border-radius:3px; font-weight:700; cursor:pointer;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  .post-grid{ grid-template-columns: repeat(2,1fr); }
  .content-with-sidebar{ grid-template-columns: 1fr; }
}
@media (max-width: 640px){
  .post-grid{ grid-template-columns: 1fr; }
  .main-navigation ul{ gap: 16px; }
  .hero{ padding: 52px 0 44px; }
}

/* ---------- Accessibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible{
  outline: 2.5px solid var(--red-pen);
  outline-offset: 2px;
}
.screen-reader-text{
  position:absolute !important;
  width:1px; height:1px; overflow:hidden;
  clip:rect(1px,1px,1px,1px);
  white-space:nowrap;
}
.skip-link{
  position:absolute; left:-999px; top:auto;
  background: var(--ink); color: var(--paper); padding: 10px 16px; z-index: 999;
}
.skip-link:focus{ left: 12px; top: 12px; }

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; scroll-behavior: auto !important; }
}
