/*
Theme Name: Blade Pens
Theme URI:
Author: Blade Pens
Author URI:
Description: Custom theme for Blade Pens — handmade brass drawing pens.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: blade-pens
*/

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
  /* Earthy colour palette */
  --color-brass:        #b5883e;
  --color-brass-light:  #d4a84e;
  --color-brass-dark:   #8a6a2f;
  --color-charcoal:     #2c2c2c;
  --color-charcoal-light: #4a4a4a;
  --color-warm-white:   #faf7f2;
  --color-cream:        #f0ebe0;
  --color-warm-grey:    #d6d0c4;
  --color-warm-grey-dark: #a39e93;
  --color-rust:         #a0522d;
  --color-forest:       #4a5c3e;
  --color-error:        #b33a3a;

  /* Typography */
  --font-body:    'Georgia', 'Times New Roman', serif;
  --font-heading: 'Georgia', 'Times New Roman', serif;
  --font-mono:    'Courier New', Courier, monospace;

  /* Fluid type scale */
  --text-sm:   clamp(0.833rem, 0.8rem + 0.15vw, 0.9rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --text-xl:   clamp(1.5rem, 1.3rem + 1vw, 2.25rem);
  --text-2xl:  clamp(2rem, 1.6rem + 2vw, 3.5rem);

  /* Spacing */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;
  --space-2xl: 6rem;

  /* Layout */
  --max-width:     1200px;
  --content-width: 720px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-charcoal);
  background-color: var(--color-warm-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-brass-dark);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-brass);
}

a:focus-visible {
  outline: 2px solid var(--color-brass);
  outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-charcoal);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   Utility
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-sm);
}

.content-width {
  max-width: var(--content-width);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-block;
  padding: 0.75em 1.75em;
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  border-radius: 3px;
  transition: background-color var(--transition-fast),
              color var(--transition-fast),
              transform var(--transition-fast);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background-color: var(--color-brass);
  color: var(--color-warm-white);
}

.btn--primary:hover,
.btn--primary:focus {
  background-color: var(--color-brass-dark);
  color: var(--color-warm-white);
}

.btn--outline {
  border: 2px solid var(--color-brass);
  color: var(--color-brass-dark);
  background: transparent;
}

.btn--outline:hover,
.btn--outline:focus {
  background-color: var(--color-brass);
  color: var(--color-warm-white);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-warm-white);
  border-bottom: 1px solid var(--color-warm-grey);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-charcoal);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-logo:hover,
.site-logo:focus {
  color: var(--color-brass);
}

/* Mobile menu toggle */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--color-charcoal);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

.menu-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.menu-toggle[aria-expanded="false"] .icon-close,
.menu-toggle:not([aria-expanded]) .icon-close {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

/* Primary nav */
.primary-nav {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background-color: var(--color-warm-white);
  border-bottom: 1px solid var(--color-warm-grey);
  padding: var(--space-sm) 0;
}

.primary-nav.is-open {
  display: block;
}

.primary-nav ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.primary-nav a {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-charcoal);
  letter-spacing: 0.03em;
}

.primary-nav a:hover,
.primary-nav a:focus {
  color: var(--color-brass);
}

.primary-nav .current-menu-item a,
.primary-nav .current_page_item a {
  color: var(--color-brass);
}

/* Desktop nav */
@media (min-width: 768px) {
  .menu-toggle {
    display: none;
  }

  .primary-nav {
    display: block;
    position: static;
    border-bottom: none;
    padding: 0;
  }

  .primary-nav ul {
    flex-direction: row;
    gap: var(--space-md);
  }

  .primary-nav a {
    padding: var(--space-xs) 0;
  }
}

/* ==========================================================================
   Hero + About Combined Section
   ========================================================================== */

.hero-about {
  padding: var(--space-xl) 0;
}

/* Mobile: single column, stacked */
.hero-about__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Video column */
.hero-about__video {
  width: 100%;
}

.hero-about__video video,
.hero-about__video img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* Content column */
.hero-about__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Hero text block */
.hero-about__hero {
  text-align: center;
}

.hero-about__title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-sm);
}

.hero-about__subtitle {
  font-size: var(--text-lg);
  font-weight: 400;
  margin-bottom: var(--space-lg);
  color: var(--color-charcoal-light);
}

.hero-about__hero .btn--primary {
  font-size: var(--text-lg);
  padding: 0.85em 2.25em;
}

/* About block within combined section */
.hero-about__about-title {
  margin-bottom: var(--space-xs);
}

.hero-about__about-subtitle {
  font-size: var(--text-base);
  color: var(--color-charcoal-light);
  margin-bottom: var(--space-md);
}

.hero-about__about .about__text p {
  margin-bottom: var(--space-sm);
}

.hero-about__about .about__image {
  margin-top: var(--space-md);
}

.hero-about__about .about__image img {
  border-radius: 4px;
}

/* Desktop: two-column layout, video height matches content */
@media (min-width: 768px) {
  .hero-about {
    padding: var(--space-2xl) 0;
  }

  .hero-about__grid {
    flex-direction: row;
    align-items: stretch;
    gap: var(--space-xl);
  }

  /* Video column: ~25-30% width, video fills the column height at 9:16 ratio */
  .hero-about__video {
    flex: 0 0 28%;
    max-width: 30%;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
  }

  .hero-about__video video,
  .hero-about__video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 9 / 16;
  }

  /* Content column: fill remaining space */
  .hero-about__content {
    flex: 1 1 0%;
    min-width: 0;
  }

  .hero-about__hero {
    text-align: left;
  }
}

/* ==========================================================================
   Section (generic)
   ========================================================================== */

.section {
  padding: var(--space-xl) 0;
}

.section--alt {
  background-color: var(--color-cream);
}

.section__header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.section__title {
  margin-bottom: var(--space-xs);
}

.section__subtitle {
  font-size: var(--text-base);
  color: var(--color-charcoal-light);
  max-width: 540px;
  margin-inline: auto;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-2xl) 0;
  }
}

/* ==========================================================================
   Gallery Section
   ========================================================================== */

.gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.gallery__item {
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

.gallery__item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.gallery__item:hover img,
.gallery__item:focus img {
  transform: scale(1.05);
}

.gallery__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: var(--color-warm-white);
  font-size: var(--text-sm);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.gallery__item:hover .gallery__caption,
.gallery__item:focus .gallery__caption {
  opacity: 1;
}

@media (min-width: 480px) {
  .gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .gallery__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.lightbox.is-active {
  display: flex;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox__caption {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-warm-white);
  font-size: var(--text-sm);
  text-align: center;
  max-width: 80%;
}

.lightbox__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-warm-white);
  font-size: 2rem;
  line-height: 1;
}

.lightbox__close:hover {
  color: var(--color-brass-light);
}

/* ==========================================================================
   Shop Section — Product Grid (Shopify Storefront API)
   ========================================================================== */

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.product-grid__loading,
.product-grid__error,
.product-grid__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-xl) var(--space-sm);
  color: var(--color-charcoal-light);
}

.product-grid__error {
  color: var(--color-error);
}

/* Product card */
.product-card {
  background: var(--color-cream);
  border-radius: 6px;
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.product-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.product-card__image {
  aspect-ratio: 1;
  overflow: hidden;
  background-color: var(--color-warm-grey);
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.product-card:hover .product-card__image img {
  transform: scale(1.03);
}

.product-card__body {
  padding: var(--space-md);
}

.product-card__title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-xs);
}

.product-card__price {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-brass-dark);
  margin-bottom: var(--space-sm);
}

.product-card__variants {
  margin-bottom: var(--space-sm);
}

.product-card__variants label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-charcoal-light);
}

.product-card__variants select {
  width: 100%;
  padding: 0.5em 0.75em;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  border: 1px solid var(--color-warm-grey);
  border-radius: 3px;
  background-color: var(--color-warm-white);
  color: var(--color-charcoal);
  cursor: pointer;
}

.product-card__variants select:focus {
  outline: 2px solid var(--color-brass);
  outline-offset: 1px;
}

.product-card .btn {
  width: 100%;
}

.product-card .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (min-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Sticky mobile buy CTA */
.mobile-buy-cta {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: var(--space-sm);
  background: var(--color-warm-white);
  border-top: 1px solid var(--color-warm-grey);
  text-align: center;
}

.mobile-buy-cta .btn {
  width: 100%;
  max-width: 400px;
}

@media (min-width: 768px) {
  .mobile-buy-cta {
    display: none;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background-color: var(--color-charcoal);
  color: var(--color-warm-grey);
  padding: var(--space-xl) 0 var(--space-md);
}

.footer__grid {
  display: grid;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.footer__heading {
  font-size: var(--text-base);
  color: var(--color-warm-white);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.site-footer a {
  color: var(--color-warm-grey);
}

.site-footer a:hover,
.site-footer a:focus {
  color: var(--color-brass-light);
}

.footer__links li + li {
  margin-top: var(--space-xs);
}

.footer__social {
  display: flex;
  gap: var(--space-sm);
}

.footer__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.footer__bottom {
  border-top: 1px solid var(--color-charcoal-light);
  padding-top: var(--space-sm);
  text-align: center;
  font-size: var(--text-sm);
}

@media (min-width: 768px) {
  .footer__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Page: Safety
   ========================================================================== */

.page-safety .entry-content {
  padding: var(--space-xl) 0;
}

.page-safety .entry-content h1 {
  margin-bottom: var(--space-md);
}

.page-safety .entry-content h2 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.page-safety .entry-content p {
  margin-bottom: var(--space-sm);
}

.page-safety .entry-content ul,
.page-safety .entry-content ol {
  list-style: disc;
  padding-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

.page-safety .entry-content li + li {
  margin-top: var(--space-xs);
}

/* ==========================================================================
   Tutorials: Archive
   ========================================================================== */

.tutorials-archive {
  padding: var(--space-xl) 0;
}

.tutorials-archive__header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.tutorials__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.tutorial-card {
  background: var(--color-cream);
  border-radius: 6px;
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.tutorial-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.tutorial-card__image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.tutorial-card__body {
  padding: var(--space-md);
}

.tutorial-card__title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-xs);
}

.tutorial-card__title a {
  color: var(--color-charcoal);
}

.tutorial-card__title a:hover {
  color: var(--color-brass);
}

.tutorial-card__excerpt {
  color: var(--color-charcoal-light);
  margin-bottom: var(--space-sm);
}

.tutorial-card__link {
  font-weight: 600;
  color: var(--color-brass-dark);
}

@media (min-width: 768px) {
  .tutorials__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tutorials__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Tutorials: Single
   ========================================================================== */

.tutorial-single {
  padding: var(--space-xl) 0;
}

.tutorial-single__header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.tutorial-single__meta {
  font-size: var(--text-sm);
  color: var(--color-charcoal-light);
  margin-top: var(--space-xs);
}

.tutorial-single__content {
  max-width: var(--content-width);
  margin-inline: auto;
}

.tutorial-single__content p {
  margin-bottom: var(--space-sm);
}

.tutorial-single__content img {
  border-radius: 4px;
  margin: var(--space-md) 0;
}

.tutorial-single__content h2 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.tutorial-single__content h3 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
}

.tutorial-single__content ul,
.tutorial-single__content ol {
  list-style: disc;
  padding-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

.tutorial-single__content li + li {
  margin-top: var(--space-xs);
}

.tutorial-single__nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-warm-grey);
}

/* ==========================================================================
   WordPress Core Alignment (Gutenberg compat)
   ========================================================================== */

.alignwide {
  max-width: var(--max-width);
  margin-inline: auto;
}

.alignfull {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.aligncenter {
  text-align: center;
}

/* ==========================================================================
   No-results / 404
   ========================================================================== */

.no-results {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.no-results__title {
  margin-bottom: var(--space-sm);
}

/* ==========================================================================
   Body padding for sticky mobile CTA
   ========================================================================== */

@media (max-width: 767px) {
  body.home {
    padding-bottom: 80px;
  }
}