/*
Theme Name: Hugin IR
Theme URI: https://huginstudio.ir
Author: Hugin
Author URI: https://huginstudio.ir
Description: Light, editorial Persian (RTL) theme for the Hugin digital agency — Iranian market. Warm light-gray palette, Vazirmatn typography, services section. Sibling of the dark Hugin theme.
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: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hugin
*/

/* Vazirmatn — self-hosted variable font (reliable inside Iran, no Google CDN) */
@font-face {
  font-family: "Vazirmatn";
  src: url("assets/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   0. Design tokens
   ========================================================= */
:root {
  --bg: #f3f1ec;                /* warm light gray */
  --bg-soft: #ffffff;           /* cards / panels */
  --text: #33322d;              /* body text */
  --text-strong: #16150f;       /* headings, warm near-black */
  --text-dim: rgba(22, 21, 15, 0.58);
  --text-faint: rgba(22, 21, 15, 0.40);
  --line: rgba(22, 21, 15, 0.14);
  --line-strong: rgba(22, 21, 15, 0.30);
  --accent: #b4472a;            /* warm terracotta accent */

  --container: 1400px;
  --gutter: clamp(20px, 5vw, 64px);

  --font-body: "Vazirmatn", "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-head: "Vazirmatn", "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --step--1: clamp(0.78rem, 0.72rem + 0.3vw, 0.9rem);
  --step-0:  clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --step-1:  clamp(1.2rem, 1rem + 1vw, 1.6rem);
  --step-2:  clamp(1.6rem, 1.2rem + 2vw, 2.8rem);
  --step-3:  clamp(2.2rem, 1.4rem + 4vw, 4.4rem);
  --step-4:  clamp(3rem, 1.5rem + 7vw, 8rem);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.7s;

  --header-h: 112px;
}

/* =========================================================
   1. Reset & base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  min-height: 100vh;
}

body.menu-open { overflow: hidden; }

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

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

::selection { background: var(--accent); color: var(--bg); }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* =========================================================
   2. Header
   ========================================================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(243, 241, 236, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.site-header.is-scrolled {
  background: rgba(243, 241, 236, 0.95);
  border-bottom-color: var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  line-height: 1;
}
.brand span { font-weight: 400; opacity: 0.7; }
.brand-logo {
  height: 64px;
  width: auto;
  display: block;
  filter: brightness(0);        /* light logo → dark, for the light header */
}
@media (max-width: 820px) {
  .brand-logo { height: 42px; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
}

.lang-switch {
  display: flex;
  gap: 14px;
  font-size: var(--step-1);
  letter-spacing: 0.02em;
  color: var(--text-strong);
  text-transform: uppercase;
}
.lang-switch li { display: inline-flex; }
.lang-switch a { opacity: 0.5; transition: opacity 0.3s var(--ease); }
.lang-switch a:hover,
.lang-switch a[aria-current="true"],
.lang-switch .current-lang a { opacity: 1; }

.menu-toggle {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-strong);
  font-family: var(--font-head);
  font-size: var(--step-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
}
.menu-toggle__words {
  position: relative;
  display: block;
  height: 1em;
  overflow: hidden;
}
.menu-toggle__now,
.menu-toggle__alt {
  display: block;
  transition: transform 0.45s var(--ease);
}
.menu-toggle__alt {
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(110%);
}
.menu-toggle:hover .menu-toggle__now { transform: translateY(-110%); }
.menu-toggle:hover .menu-toggle__alt { transform: translateY(0); }

/* =========================================================
   3. Slide-out menu
   ========================================================= */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(22, 21, 15, 0.4);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
body.menu-open .nav-overlay { opacity: 1; visibility: visible; }

.nav-panel {
  position: fixed;
  top: 0; right: 0;
  z-index: 95;
  height: 100vh;
  width: min(560px, 100vw);
  background: var(--bg-soft);
  border-left: 1px solid var(--line);
  padding: calc(var(--header-h) + 20px) var(--gutter) var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateX(100%);
  transition: transform 0.7s var(--ease);
  overflow-y: auto;
}
body.menu-open .nav-panel { transform: translateX(0); }

.nav-main li { overflow: hidden; }
.nav-main a {
  display: block;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text-strong);
  transform: translateY(110%);
  transition: transform 0.7s var(--ease), color 0.3s;
}
body.menu-open .nav-main a { transform: translateY(0); }
.nav-main li:nth-child(1) a { transition-delay: 0.08s; }
.nav-main li:nth-child(2) a { transition-delay: 0.14s; }
.nav-main li:nth-child(3) a { transition-delay: 0.20s; }
.nav-main li:nth-child(4) a { transition-delay: 0.26s; }
.nav-main li:nth-child(5) a { transition-delay: 0.32s; }
.nav-main a:hover { color: var(--accent); }
.nav-main a .idx {
  font-size: 0.9rem;
  vertical-align: super;
  opacity: 0.4;
  margin-right: 10px;
  letter-spacing: 0;
}

.nav-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 16px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  font-size: var(--step--1);
}
.nav-foot h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 12px;
}
.nav-foot a { color: var(--text-dim); transition: color 0.3s; }
.nav-foot a:hover { color: var(--text-strong); }
.nav-foot li + li { margin-top: 6px; }

/* =========================================================
   4. Hero / intro
   ========================================================= */
.hero {
  padding-top: calc(var(--header-h) + clamp(40px, 12vh, 140px));
  padding-bottom: clamp(40px, 8vh, 90px);
}
.hero-eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  margin-bottom: clamp(20px, 4vh, 40px);
  display: flex;
  gap: 14px;
  align-items: center;
}
.hero-eyebrow::before {
  content: "";
  width: 40px; height: 1px;
  background: var(--line-strong);
}
.hero-title {
  font-size: var(--step-3);
  max-width: 16ch;
  color: var(--text-strong);
}
.hero-title em {
  font-style: normal;
  color: var(--text-faint);
}
.hero-meta {
  margin-top: clamp(24px, 5vh, 48px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  font-size: var(--step--1);
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* =========================================================
   5. Works — full-width horizontal project rows
   ========================================================= */
.works {
  padding-bottom: clamp(60px, 12vh, 160px);
}
.works-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 42%) 1fr;
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  padding: clamp(28px, 4vw, 48px) 0;
  border-top: 1px solid var(--line);
  transition: padding 0.4s var(--ease);
}
.project-card:last-child { border-bottom: 1px solid var(--line); }

.project-card-media {
  position: relative;
  aspect-ratio: 12 / 7; /* ~1.71:1 — matches the reference card ratio */
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-soft);
}
.project-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.6s var(--ease), transform 1.2s var(--ease);
}
.project-card-media img:nth-child(2) { opacity: 0; }
.project-card:hover .project-card-media img:nth-child(1) { opacity: 0; }
.project-card:hover .project-card-media img:nth-child(2) { opacity: 1; }
.project-card:hover .project-card-media img { transform: scale(1.04); }

.project-card-body { max-width: 40ch; }
.project-card-index {
  font-size: var(--step--1);
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}
.project-card-title {
  font-size: var(--step-2);
  margin-bottom: 16px;
  transition: color 0.3s;
}
.project-card:hover .project-card-title { color: var(--accent); }
.project-card-cat {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.project-card-cat li {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 40px;
  padding: 5px 12px;
}
.project-card-desc {
  color: var(--text-dim);
  font-size: var(--step-0);
  line-height: 1.55;
}
.project-card-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  font-size: var(--step--1);
  letter-spacing: 0.05em;
  color: var(--text-strong);
}
.project-card-more::after {
  content: "→";
  transition: transform 0.4s var(--ease);
}
.project-card:hover .project-card-more::after { transform: translateX(6px); }

.works-all {
  display: flex;
  justify-content: center;
  margin-top: clamp(50px, 10vh, 110px);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 34px;
  border: 1px solid var(--line-strong);
  border-radius: 60px;
  font-family: var(--font-head);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-strong);
  transition: background 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s;
}
.btn:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* =========================================================
   6. Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: clamp(60px, 12vh, 130px) 0 40px;
}
.footer-cta {
  font-size: var(--step-3);
  color: var(--text-strong);
  max-width: 18ch;
  margin-bottom: clamp(40px, 8vh, 90px);
}
.footer-cta a { color: var(--accent); }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 40px 24px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.footer-grid h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 16px;
}
.footer-grid a { color: var(--text-dim); transition: color 0.3s; }
.footer-grid a:hover { color: var(--text-strong); }
.footer-grid li + li { margin-top: 8px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(50px, 10vh, 100px);
  color: var(--text-faint);
  font-size: var(--step--1);
}

/* =========================================================
   7. Scroll-reveal
   ========================================================= */
.appear-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  will-change: opacity, transform;
}
.appear-on-scroll.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .appear-on-scroll { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
  * { transition-duration: 0.001ms !important; }
}

/* =========================================================
   8. Generic pages (about / blog / single)
   ========================================================= */
.page-head {
  padding-top: calc(var(--header-h) + clamp(50px, 14vh, 160px));
  padding-bottom: clamp(30px, 6vh, 70px);
}
.page-head h1 { font-size: var(--step-4); }
.page-lead {
  max-width: 60ch;
  margin-top: 30px;
  font-size: var(--step-1);
  color: var(--text-dim);
  line-height: 1.4;
}
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.2em; }
.prose h2 { font-size: var(--step-1); margin-top: 1.8em; }
.prose p { color: var(--text-dim); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.single-hero { padding-top: calc(var(--header-h) + 40px); }
.single-hero img { width: 100%; border-radius: 6px; }

/* =========================================================
   9. Responsive
   ========================================================= */
@media (max-width: 820px) {
  :root { --header-h: 72px; }
  .project-card {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .project-card-body { max-width: none; }
  .hero-title { max-width: none; }
  .nav-panel { width: 100vw; border-left: 0; }
  .footer-bottom { flex-direction: column; }
}

/* =========================================================
   10. RTL / Arabic (body.rtl is added automatically for the
   Arabic locale). Most layout already uses logical properties;
   these rules fix the physical bits + Arabic typography.
   ========================================================= */
body.rtl {
  --font-body: "IBM Plex Sans Arabic", "General Sans", "Helvetica Neue", sans-serif;
  --font-head: "IBM Plex Sans Arabic", "General Sans", "Helvetica Neue", sans-serif;
}

/* Arabic is a connected script: never letter-space or uppercase it. */
body.rtl h1, body.rtl h2, body.rtl h3, body.rtl h4,
body.rtl .brand, body.rtl .nav-main a, body.rtl .hero-title,
body.rtl .hero-eyebrow, body.rtl .hero-meta, body.rtl .menu-toggle,
body.rtl .works-head, body.rtl .btn, body.rtl .project-card-index,
body.rtl .project-card-cat li, body.rtl .project-card-more,
body.rtl .nav-foot h4, body.rtl .footer-grid h4, body.rtl .footer-cta,
body.rtl .footer-bottom, body.rtl .lang-switch {
  letter-spacing: normal;
}
body.rtl .hero-eyebrow, body.rtl .menu-toggle, body.rtl .works-head,
body.rtl .btn, body.rtl .project-card-cat li, body.rtl .nav-foot h4,
body.rtl .footer-grid h4 {
  text-transform: none;
}

/* Slide-out panel enters from the left in RTL. */
body.rtl .nav-panel {
  right: auto;
  left: 0;
  border-left: 0;
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
}
body.rtl.menu-open .nav-panel { transform: translateX(0); }

/* Menu index number sits on the correct side. */
body.rtl .nav-main a .idx { margin-right: 0; margin-left: 10px; }

/* "View project" arrow flips direction. */
body.rtl .project-card-more::after { content: "\2190"; } /* ← */
body.rtl .project-card:hover .project-card-more::after { transform: translateX(-6px); }
