/* ==========================================================================
   refresh.css — "Paper & Ink"
   Loaded after style.css. Warm neutrals for the whole site, plus the new
   header, home hero, "Latest" row and the Ask Farhan button.
   To undo everything: stop enqueuing this file in inc/enqueue.php.
   ========================================================================== */

/* ---------- 1. Tokens (warm neutrals; per-type accent colours unchanged) ---------- */
:root {
  --bg: #F6F1E7;
  --ink: #1B1714;
  --muted: #675F54;
  --border: #E2D9C8;
  --border-soft: #EAE2D3;

  --paper-2: #EBE2D0;
  --chinar: #B5341F;      /* autumn chinar-leaf red */
  --chinar-ink: #8F2716;

  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

/* ---------- 2. Header ---------- */
.site-header {
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
/* Blur lives on a pseudo-element on purpose: backdrop-filter on the header
   itself would trap the fixed mobile menu inside the 66px bar. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(246, 241, 231, 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.header-left { gap: 10px; }
.site-header .custom-logo { mix-blend-mode: multiply; }
.brand-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

/* Account link: avatar initial when logged in, "Sign in" when not */
.nav-account { align-items: center; gap: 8px; }
.nav-account-label { font-size: 0.9rem; font-weight: 500; }
.nav-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
}

/* Cart */
.header-cart:hover { background: var(--paper-2); color: var(--chinar-ink); }
.cart-count { background: var(--chinar); }

/* Desktop navigation: text links with an animated underline */
@media (min-width: 861px) {
  .main-nav ul li a {
    position: relative;
    background: none;
    border-radius: 0;
    padding: 8px 12px;
    color: var(--ink);
  }
  .main-nav ul li a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 3px;
    height: 2px;
    background: var(--chinar);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
  }
  .main-nav ul li a:hover { background: none; color: var(--chinar-ink); }
  .main-nav ul li a:hover::after,
  .main-nav .current-menu-item > a::after,
  .main-nav .current_page_item > a::after { transform: scaleX(1); }
  .main-nav .current-menu-item > a,
  .main-nav .current_page_item > a { background: none; color: var(--ink); }

  /* Account: outlined "Sign in" pill, or just the avatar */
  .main-nav ul li a.nav-account::after { display: none; }
  .nav-account:not(.is-user) {
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    padding: 7px 18px;
    margin-left: 6px;
  }
  .nav-account:not(.is-user) svg { display: none; }
  .nav-account:not(.is-user):hover { background: var(--ink); color: var(--bg); }
  .nav-account.is-user { padding: 5px; margin-left: 6px; }
  .nav-account.is-user .nav-account-label { display: none; }
}

/* Mobile slide-out menu: warm paper instead of white */
@media (max-width: 860px) {
  .main-nav { background: var(--bg) !important; }
  .main-nav ul li a:hover { background: var(--paper-2); color: var(--chinar-ink); }
  .nav-account .nav-avatar { width: 28px; height: 28px; }
  .nav-account-label { font-size: inherit; font-weight: inherit; }
  /* the closed drawer sits just off-screen; its shadow was bleeding onto the page */
  .main-nav:not(.is-open) { box-shadow: none; }
}
body.menu-open .ask-farhan-widget { display: none; }

/* ---------- 3. Home hero ---------- */
.hx { position: relative; isolation: isolate; overflow: hidden; }
/* very faint paper grain */
.hx::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .08 0 0 0 0 .05 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hx-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) 24px clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.hx-eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 0.8em;
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.hx-sep { color: var(--chinar); }

.hx-name {
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(3.5rem, 9.2vw, 7.4rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-variation-settings: "opsz" 144;
}
.hx-dot { color: var(--chinar); }

.hx-lead {
  max-width: 28em;
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.hx-lead em { font-style: italic; color: var(--chinar); }

.hx-sub { max-width: 34em; margin: 0 0 32px; color: var(--muted); }

.hx-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.hx-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.hx-btn svg { width: 18px; height: 18px; transition: transform 0.2s ease; }
.hx-btn:hover svg { transform: translateX(3px); }
.hx-btn--solid { background: var(--ink); color: var(--bg); }
.hx-btn--solid:hover { background: var(--chinar); border-color: var(--chinar); color: #fff; }
.hx-btn--line { background: transparent; color: var(--ink); }
.hx-btn--line:hover { background: var(--ink); color: var(--bg); }
.hx-btn:focus-visible,
.hx-card:focus-visible { outline: 2px solid var(--chinar); outline-offset: 3px; }

/* Portrait in an arch. multiply blends the photo's light backdrop into the arch. */
.hx-figure { margin: 0; justify-self: end; width: min(100%, 414px); padding: 0 14px 14px 0; }
.hx-frame { position: relative; isolation: isolate; }
.hx-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1.5px solid var(--ink);
  border-radius: 999px 999px 28px 28px;
  transform: translate(14px, 14px);
}
.hx-arch {
  aspect-ratio: 4 / 5;
  border-radius: 999px 999px 28px 28px;
  background: #F2E9D8;
  overflow: hidden;
}
.hx-arch img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  mix-blend-mode: multiply;
  filter: sepia(0.2);
}
.hx-caption {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 30px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- 4. "Latest" row (replaces the counters) ---------- */
.hx-latest { max-width: var(--max-width); margin: 0 auto; padding: 0 24px clamp(40px, 6vw, 72px); }
.hx-latest-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.hx-latest-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.hx-latest-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
@media (max-width: 700px) { .hx-latest-grid { grid-template-columns: 1fr; } }
.hx-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
}
.hx-card-kind {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hx-kind-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--k, var(--chinar)); }
.hx-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.hx-card:hover .hx-card-title {
  color: var(--chinar-ink);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
.hx-card-meta { font-size: 0.85rem; color: var(--muted); }

/* Gentle load-in */
@keyframes hx-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hx-eyebrow, .hx-name, .hx-lead, .hx-sub, .hx-ctas, .hx-figure, .hx-latest {
  animation: hx-rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hx-name { animation-delay: 0.06s; }
.hx-lead { animation-delay: 0.14s; }
.hx-sub { animation-delay: 0.2s; }
.hx-ctas { animation-delay: 0.26s; }
.hx-figure { animation-delay: 0.18s; }
.hx-latest { animation-delay: 0.34s; }

/* ---------- 5. Hero on tablets and phones ---------- */
@media (max-width: 860px) {
  .hx-inner { grid-template-columns: 1fr; gap: 40px; }
  .hx-figure { justify-self: center; width: min(86%, 340px); }
  .hx-name { margin-bottom: 22px; }
}
@media (max-width: 480px) {
  .hx-inner { padding-left: 20px; padding-right: 20px; }
  .hx-latest { padding-left: 20px; padding-right: 20px; }
  .hx-ctas { flex-direction: column; }
  .hx-btn { justify-content: center; width: 100%; }
  .hx-latest-grid { gap: 22px; }
}

/* ---------- 6. Ask Farhan: a labelled pill instead of a robot icon ----------
   The chat script rewrites the button's contents on open/close, so the label
   and monogram are drawn with ::before / ::after, which that script can't wipe. */
.ask-farhan-widget .ask-farhan-toggle {
  width: auto;
  height: 52px;
  padding: 0 20px 0 8px;
  gap: 10px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 12px 30px -10px rgba(27, 23, 20, 0.45);
}
.ask-farhan-widget .ask-farhan-toggle:not(.is-open) svg { display: none; }
.ask-farhan-widget .ask-farhan-toggle:not(.is-open)::before {
  content: "FP";
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chinar);
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}
.ask-farhan-widget .ask-farhan-toggle:not(.is-open)::after {
  content: "Ask Farhan";
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
}
.ask-farhan-widget .ask-farhan-toggle.is-open { width: 52px; padding: 0; background: var(--chinar); }
.ask-farhan-widget .ask-farhan-toggle.is-open svg { width: 22px; height: 22px; }
/* Phones: just the round FP icon, so the button never covers content (every page) */
@media (max-width: 600px) {
  body .ask-farhan-widget { right: 14px; bottom: 14px; }
  body .ask-farhan-widget .ask-farhan-toggle:not(.is-open) { width: 46px; height: 46px; padding: 0; gap: 0; justify-content: center; box-shadow: 0 8px 20px -8px rgba(27, 23, 20, 0.5); }
  body .ask-farhan-widget .ask-farhan-toggle:not(.is-open)::after { display: none; }
  body .ask-farhan-widget .ask-farhan-toggle:not(.is-open)::before { width: 38px; height: 38px; font-size: 0.82rem; }
}


/* ==========================================================================
   7. One accent, three fonts (site-wide)
   Fonts:   Fraunces (headings, numbers, prices), Inter (text, buttons),
            JetBrains Mono (small labels, code). Nothing else.
   Colours: ink + paper + one chinar-red accent. The old violet, blue and
            amber are folded into a calm earthy set used only for the tiny
            type labels and dots (articles, journal, projects, memories).
   ========================================================================== */
:root {
  --font-display: var(--font-serif);   /* was Space Grotesk */

  --accent: #B5341F;     --accent-ink: #8F2716;

  --violet: #B5341F;     --violet-tint: #F4E4DD;   /* articles, general accent */
  --coral:  #8E4A6B;     --coral-tint:  #F1E6EC;   /* journal  */
  --teal:   #2F6B66;     --teal-tint:   #E3EFED;   /* projects */
  --amber:  #8F5F10;     --amber-tint:  #F6EBD5;   /* memories */
  --indigo: #1B1714;     --indigo-tint: #EDE6D8;   /* neutral: prices, links */

  --success: #2A7345;    --success-tint: #E3F1E8;
  --danger:  #B3362B;    --danger-tint:  #F8E3E0;

  --shadow-card: 0 14px 28px -16px rgba(27, 23, 20, 0.2);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* code and the copy button: mono and Inter only */
code, kbd, samp, pre,
.article-content pre,
.ask-farhan-msg code { font-family: var(--font-mono); }
body .code-copy-btn { font-family: var(--font-body) !important; }

/* the main "buy" action is the one place the accent fills a button */
.btn-buy { background: var(--chinar); border-color: var(--chinar); color: #fff; }
.btn-buy:hover { background: var(--chinar-ink); border-color: var(--chinar-ink); color: #fff; }

/* Ask Farhan window: ink and chinar instead of violet */
.ask-farhan-widget .ask-farhan-header { background: var(--ink); }
.ask-farhan-widget .ask-farhan-msg.user { background: var(--ink); }
.ask-farhan-widget .ask-farhan-input-row input:focus { border-color: var(--chinar); }
.ask-farhan-widget .ask-farhan-send { background: var(--ink); }
.ask-farhan-widget .ask-farhan-send:hover { background: var(--chinar); }

/* form fields inherit the page font (browsers otherwise give them a system font) */
button, input, select, textarea { font-family: inherit; }

/* the header cart is hidden while the cart is empty (script un-hides it on add) */
.header-cart-wrapper.is-empty,
.mobile-cart-link.is-empty { display: none; }