/*
Theme Name: Iyarkai Vivasayi
Theme URI: https://iyarkaivivasayi.in
Author: Iyarkai Vivasayi
Author URI: https://iyarkaivivasayi.in
Description: Custom WooCommerce theme for Iyarkai Vivasayi, a premium natural/organic farm-products brand from Salem, Tamil Nadu. Bilingual Tamil/English, mobile-first, built for WooCommerce.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: iyarkai-vivasayi
Tags: e-commerce, custom-colors, custom-logo, custom-menu, featured-images, translation-ready

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned.
*/

/* =========================================================
   1. DESIGN SYSTEM — CSS CUSTOM PROPERTIES
   Every later template and stylesheet should pull from these
   variables rather than hardcoding colors, fonts, spacing, or
   radii. Update brand values here and they cascade everywhere.
   ========================================================= */
:root {

	/* ---- Brand colors, sampled directly from the logo artwork ---- */
	--color-primary: #0D3516;        /* deep pine green — text, header, footer, primary buttons */
	--color-primary-dark: #08240F;   /* darker shade for hover/active states on primary elements */
	--color-primary-light: #164B21;  /* lighter tint of primary, for large-area backgrounds where #0D3516 would feel too heavy */

	--color-accent-gold: #C6A55A;    /* muted gold — Oils category, sparing accent use only. Do not use for body text: fails WCAG AA contrast on light backgrounds. */
	--color-accent-terracotta: #AF6C48; /* warm terracotta — Pulses category accent. Decorative/border use only — fails AA as text on light backgrounds (3.85:1). */
	--color-terracotta-dark: #9D6140; /* darkened terracotta for any actual TEXT or small-text-on-fill use (link hover, sale badge) — passes AA at 4.6:1+ in both directions. Found and fixed during the Phase 5 accessibility audit. */
	--color-accent-green: #0D3516;   /* Rice category accent reuses primary green */

	--color-bg: #FAF6EE;             /* warm ivory — main page background */
	--color-bg-alt: #F1EADB;         /* slightly deeper ivory, for alternating sections/cards */
	--color-white: #FFFFFF;

	--color-text: #2B2B2B;           /* near-black — body copy */
	--color-text-muted: #6B6B63;     /* secondary/muted text, still passes AA on ivory */
	--color-text-on-dark: #FAF6EE;   /* text color when placed on --color-primary backgrounds */

	--color-border: #E3DCCB;         /* hairline borders on ivory */
	--color-border-strong: #C9BEA3;

	--color-success: #2E7D32;
	--color-error: #B3261E;
	--color-sale: #AF6C48;           /* WooCommerce sale badges use the terracotta accent, not red */

	/* ---- Typography ---- */
	/* Fraunces: English headings + English half of the wordmark only. */
	/* Catamaran: Tamil headings + body, and English body/UI text — chosen because it's one of
	   the few Google Fonts families built natively for both Tamil and Latin script, keeping the
	   bilingual font payload light. */
	--font-heading-en: 'Fraunces', Georgia, serif;
	--font-base: 'Catamaran', 'Noto Sans Tamil', sans-serif;

	--fs-xs: 0.75rem;    /* 12px */
	--fs-sm: 0.875rem;   /* 14px */
	--fs-base: 1rem;     /* 16px */
	--fs-md: 1.125rem;   /* 18px */
	--fs-lg: 1.375rem;   /* 22px */
	--fs-xl: 1.75rem;    /* 28px */
	--fs-2xl: 2.25rem;   /* 36px */
	--fs-3xl: 3rem;      /* 48px */

	--lh-tight: 1.2;
	--lh-base: 1.6;
	--lh-loose: 1.8;

	/* ---- Spacing scale ---- */
	--space-2xs: 0.25rem;  /* 4px */
	--space-xs: 0.5rem;    /* 8px */
	--space-sm: 1rem;      /* 16px */
	--space-md: 1.5rem;    /* 24px */
	--space-lg: 2.5rem;    /* 40px */
	--space-xl: 4rem;      /* 64px */
	--space-2xl: 6rem;     /* 96px */

	/* ---- Radii ---- */
	--radius-sm: 4px;
	--radius-md: 8px;
	--radius-lg: 16px;
	--radius-pill: 999px;

	/* ---- Layout ---- */
	--container-max: 1200px;
	--container-pad: var(--space-sm);

	/* ---- Shadows (used sparingly — flat design is the default) ---- */
	--shadow-sm: 0 1px 2px rgba(13, 53, 22, 0.08);
	--shadow-md: 0 4px 12px rgba(13, 53, 22, 0.10);

	/* ---- Motion ---- */
	--transition-fast: 150ms ease;
	--transition-base: 250ms ease;
}

/* =========================================================
   2. RESET & BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	font-family: var(--font-base);
	font-size: var(--fs-base);
	line-height: var(--lh-base);
	color: var(--color-text);
	background-color: var(--color-bg);
	-webkit-font-smoothing: antialiased;
}

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

a {
	color: var(--color-primary);
	text-decoration: none;
	transition: color var(--transition-fast);
}
a:hover, a:focus { color: var(--color-terracotta-dark); }

ul, ol { padding-left: 1.25em; }

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-heading-en);
	font-weight: 600;
	line-height: var(--lh-tight);
	color: var(--color-primary);
	margin: 0 0 var(--space-sm);
}

/* Tamil headings use the bold Catamaran weight instead of Fraunces, per the
   bilingual typography spec — apply this class to any heading element whose
   content is Tamil script. */
.text-tamil,
[lang="ta"] {
	font-family: var(--font-base);
	font-weight: 800;
}

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

p { margin: 0 0 var(--space-sm); }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* =========================================================
   3. LAYOUT HELPERS
   ========================================================= */
.container {
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-pad);
}

.screen-reader-text {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.screen-reader-text:focus {
	position: fixed;
	top: var(--space-xs);
	left: var(--space-xs);
	width: auto; height: auto;
	padding: var(--space-xs) var(--space-sm);
	background: var(--color-primary);
	color: var(--color-text-on-dark);
	z-index: 100000;
	border-radius: var(--radius-sm);
	clip: auto;
}

/* =========================================================
   4. BUTTONS
   ========================================================= */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2xs);
	padding: 0.75em 1.5em;
	border-radius: var(--radius-md);
	border: 1px solid transparent;
	font-weight: 700;
	font-size: var(--fs-sm);
	cursor: pointer;
	transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.btn-primary {
	background-color: var(--color-primary);
	color: var(--color-text-on-dark);
}
.btn-primary:hover, .btn-primary:focus {
	background-color: var(--color-primary-dark);
	color: var(--color-text-on-dark);
}
.btn-outline {
	background-color: transparent;
	border-color: var(--color-primary);
	color: var(--color-primary);
}
.btn-outline:hover, .btn-outline:focus {
	background-color: var(--color-primary);
	color: var(--color-text-on-dark);
}

/* Component stylesheets (header, footer, woocommerce, etc.)
   are loaded separately from /assets/css/ via functions.php
   to keep this file focused on the design system + base
   styles, and to avoid one giant unmaintainable file as the
   theme grows through later build phases. */

/* =========================================================
   5. SHARED SECTION HELPER
   Originally homepage-only (Phase 2), moved here in Phase 4
   once About, Farmer Stories, and Contact pages all needed
   the same bilingual section-title pattern — avoids duplicating
   this rule across home.css and pages.css.
   ========================================================= */
.section-title {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
	text-align: center;
	margin-bottom: var(--space-lg);
}
.section-title__en {
	font-family: var(--font-heading-en);
	font-weight: 600;
	font-size: var(--fs-lg);
	color: var(--color-text-muted);
}
.section-title .text-tamil {
	font-size: var(--fs-2xl);
}

/* =========================================================
   6. SHARED PRODUCT CARD
   Moved here during the Phase 5 audit — this was previously only
   in home.css, which loads on the front page only. The Shop archive
   and single-product "Related products" section both render this
   same card via content-product.php but only load woocommerce.css
   (never home.css), so those cards were rendering with none of their
   base layout — no grid, no borders, no image sizing. Living here in
   the always-loaded stylesheet, every context that renders a product
   card gets consistent styling regardless of which page loaded it.
   ========================================================= */
.product-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--space-sm);
}

.product-card {
	display: block;
	background-color: var(--color-white);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	overflow: hidden;
	color: inherit;
	border-left: 3px solid var(--cat-accent, var(--color-border-strong));
	transition: box-shadow var(--transition-base);
}
.product-card:hover,
.product-card:focus {
	box-shadow: var(--shadow-sm);
	color: inherit;
}

.product-card__image {
	aspect-ratio: 1 / 1;
	background-color: var(--color-bg-alt);
}
.product-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.product-card__body {
	padding: var(--space-sm);
}
.product-card__price {
	font-weight: 700;
	color: var(--color-primary);
	font-size: var(--fs-sm);
}
.product-card__price ins {
	text-decoration: none;
	color: var(--color-sale);
}
.product-card__price del {
	color: var(--color-text-muted);
	opacity: 0.7;
	margin-right: var(--space-2xs);
}

/* Category accent classes — power the color-coding on category cards
   AND product cards. Also moved here in the Phase 5 audit for the same
   reason as the product card rules above: these were home.css-only,
   so the Shop archive's category color-coding (explicitly required in
   the Phase 3 brief) was silently not working on that page at all. */
.cat-oils    { --cat-accent: var(--color-accent-gold); }
.cat-pulses  { --cat-accent: var(--color-accent-terracotta); }
.cat-rice    { --cat-accent: var(--color-primary); }
.cat-default { --cat-accent: var(--color-border-strong); }
