/*
Theme Name: Almanac
Theme URI: https://example.com/almanac
Author: Your Store
Author URI: https://example.com
Description: A basic, catalog-inspired ecommerce theme built for WooCommerce. Ledger teal and mustard on warm paper, with a serif display face, a clean body sans, and a monospace utility face for prices and catalog numbers.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: almanac
Tags: e-commerce, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready

WooCommerce is supported via add_theme_support( 'woocommerce' ) in functions.php.
*/

/* ==========================================================================
   0. Design tokens
   ========================================================================== */
:root {
  /* Palette */
  --paper: #F5F1E7;
  --paper-raised: #FBF9F4;
  --ink: #1A1D22;
  --ink-soft: #4B5057;
  --teal: #1F6F63;
  --teal-dark: #164F46;
  --mustard: #E3A83B;
  --mustard-dark: #B9822A;
  --line: #D8D0BC;
  --danger: #B3452F;

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  /* Rhythm */
  --gap-xs: 0.5rem;
  --gap-sm: 1rem;
  --gap-md: 1.75rem;
  --gap-lg: 3rem;
  --gap-xl: 5rem;
  --radius: 3px;
  --container: 1180px;
}

/* ==========================================================================
   1. Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--mustard-dark); }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); font-weight: 500; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; color: var(--ink-soft); }
.container { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Utility: catalog number tag — the theme's signature device */
.catalog-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--teal-dark);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2em 0.7em;
}
.catalog-tag::before { content: "No."; opacity: 0.6; }

/* Ledger divider — tick-marked horizontal rule used between sections */
.ledger-divider {
  border: none;
  height: 1px;
  margin: var(--gap-lg) 0;
  background-image: repeating-linear-gradient(
    to right, var(--line) 0, var(--line) 6px, transparent 6px, transparent 14px
  );
}

/* ==========================================================================
   2. Buttons & forms
   ========================================================================== */
.btn, button, input[type="submit"], .button,
a.button, .wp-block-button__link,
.woocommerce a.button, .woocommerce button.button,
.woocommerce #respond input#submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  padding: 0.75em 1.5em;
  border-radius: var(--radius);
  border: 1px solid var(--teal-dark);
  background: var(--teal);
  color: #fff !important;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover, button:hover, .button:hover,
.woocommerce a.button:hover, .woocommerce button.button:hover {
  background: var(--teal-dark);
  color: #fff !important;
}
.btn:active, button:active { transform: translateY(1px); }
.btn-accent, .woocommerce a.added_to_cart {
  background: var(--mustard);
  border-color: var(--mustard-dark);
  color: var(--ink) !important;
}
.btn-accent:hover { background: var(--mustard-dark); }

input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="search"], input[type="password"],
textarea, select {
  width: 100%;
  padding: 0.7em 0.9em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--teal); }
label { font-size: 0.85rem; color: var(--ink-soft); }

/* ==========================================================================
   3. Header
   ========================================================================== */
.site-header {
  background: var(--paper-raised);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  padding: 1.1rem 0;
}
.site-branding { display: flex; align-items: center; gap: 0.75rem; }
.site-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.site-description {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}
.custom-logo { max-height: 44px; width: auto; }

.primary-navigation ul { display: flex; gap: var(--gap-md); align-items: center; }
.primary-navigation a {
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}
.primary-navigation a:hover { color: var(--teal-dark); }
.primary-navigation .current-menu-item > a { color: var(--teal-dark); }
.primary-navigation .current-menu-item > a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--mustard);
}

.header-actions { display: flex; align-items: center; gap: 1.25rem; }
.header-search { position: relative; }
.header-search input { width: 180px; padding-right: 2.2rem; }
.header-cart {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
}
.header-cart .count {
  background: var(--mustard);
  color: var(--ink);
  border-radius: 999px;
  min-width: 1.4em;
  height: 1.4em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.5em 0.7em;
}
@media (max-width: 860px) {
  .primary-navigation { display: none; }
  .primary-navigation.is-open {
    display: block;
    position: absolute;
    left: 0; right: 0; top: 100%;
    background: var(--paper-raised);
    border-bottom: 1px solid var(--line);
    padding: 1rem 1.5rem 1.5rem;
  }
  .primary-navigation.is-open ul { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .menu-toggle { display: inline-flex; }
  .header-search { display: none; }
}

/* ==========================================================================
   4. Hero (front page)
   ========================================================================== */
.hero {
  background: var(--teal);
  color: #fff;
  padding: var(--gap-xl) 0;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 40px
  );
  pointer-events: none;
}
.hero__inner { max-width: 640px; }
.hero .catalog-tag { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); color: var(--mustard); }
.hero h1 { color: #fff; margin-top: 0.6rem; }
.hero p { color: rgba(255,255,255,0.82); font-size: 1.05rem; max-width: 44ch; }
.hero .btn-accent { margin-top: 0.5rem; }

/* ==========================================================================
   5. Product grid & cards
   ========================================================================== */
.shop-section { padding: var(--gap-xl) 0; }
.shop-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  flex-wrap: wrap;
  gap: 0.5rem;
}

ul.products, .product-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-md);
}
@media (max-width: 980px) { ul.products, .product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { ul.products, .product-grid { grid-template-columns: 1fr; } }

ul.products li.product, .product-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  position: relative;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
ul.products li.product:hover, .product-card:hover {
  box-shadow: 0 8px 20px rgba(26,29,34,0.08);
  transform: translateY(-2px);
}
ul.products li.product img { border-radius: var(--radius); margin-bottom: 0.75rem; aspect-ratio: 1/1; object-fit: cover; }
ul.products li.product .catalog-tag { position: absolute; top: 1rem; right: 1rem; }
ul.products li.product h2, ul.products li.product h3 { font-size: 1.05rem; margin-bottom: 0.25rem; }
ul.products li.product .price {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--teal-dark);
  font-weight: 600;
}
ul.products li.product .price del { color: var(--ink-soft); opacity: 0.6; font-weight: 400; }
ul.products li.product .price ins { text-decoration: none; }
ul.products li.product .button {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  text-align: center;
}
ul.products li.product .onsale {
  position: absolute;
  top: 1rem; left: 1rem;
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  min-height: auto; min-width: auto;
  line-height: 1.4;
}

/* ==========================================================================
   6. Single product
   ========================================================================== */
.single-product .summary .price { font-family: var(--font-mono); font-size: 1.4rem; color: var(--teal-dark); }
.single-product .woocommerce-product-details__short-description { color: var(--ink-soft); }
.single-product form.cart { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0; }
.single-product .quantity input { width: 4.5rem; text-align: center; }
.woocommerce-tabs ul.tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.woocommerce-tabs ul.tabs li { padding-bottom: 0.75rem; font-weight: 600; cursor: pointer; }
.woocommerce-tabs ul.tabs li.active { color: var(--teal-dark); border-bottom: 2px solid var(--mustard); }

/* ==========================================================================
   7. Cart & checkout
   ========================================================================== */
.woocommerce table.shop_table { border-collapse: collapse; width: 100%; }
.woocommerce table.shop_table th, .woocommerce table.shop_table td {
  border: 1px solid var(--line);
  padding: 0.85rem;
  text-align: left;
}
.woocommerce table.shop_table th { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; background: var(--paper-raised); }
.woocommerce-checkout-review-order-table .order-total .amount,
.cart_totals .order-total .amount { font-family: var(--font-mono); font-size: 1.15rem; color: var(--teal-dark); }

/* ==========================================================================
   8. Footer
   ========================================================================== */
.site-footer { background: var(--ink); color: rgba(255,255,255,0.75); padding: var(--gap-xl) 0 var(--gap-md); margin-top: var(--gap-xl); }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--mustard); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--gap-lg); }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { color: #fff; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); font-weight: 600; }
.footer-grid ul li { margin-bottom: 0.5rem; }
.footer-brand p { color: rgba(255,255,255,0.6); max-width: 36ch; }
.site-footer .ledger-divider { background-image: repeating-linear-gradient(to right, rgba(255,255,255,0.2) 0, rgba(255,255,255,0.2) 6px, transparent 6px, transparent 14px); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 0.82rem; color: rgba(255,255,255,0.5); }

/* ==========================================================================
   9. Widgets / sidebar / misc pages
   ========================================================================== */
.content-area { padding: var(--gap-xl) 0; }
.widget { margin-bottom: var(--gap-lg); }
.widget h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono); }
.widget ul li { padding: 0.4em 0; border-bottom: 1px dashed var(--line); }
.entry-content { max-width: 70ch; }
.page-title { margin-bottom: var(--gap-md); }
.woocommerce-breadcrumb { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); margin-bottom: var(--gap-md); }
