/* ==========================================================================
   Hassan Shafiian — Personal Site (PureLeaf theme)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lora:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f6f8f8;
  --border: #e6e9ea;
  --accent: #2fc3be;
  --accent2: #1f9d99;
  --text: #16181a;
  --muted: #6b7580;
  --danger: #d9534f;
  --ink: #10161a;

  --font-display: 'Lora', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 14px;
  --max-w: 760px;
  --max-w-wide: 1160px;
  --accent-glow: rgba(47, 195, 190, 0.15);
  --nav-bg: rgba(255, 255, 255, 0.9);
}

:root[data-theme="dark"] {
  --bg: #0d1417;
  --surface: #121a1e;
  --surface2: #172227;
  --border: #232f34;
  --accent: #37d6d0;
  --accent2: #5fe3de;
  --text: #dde4e6;
  --muted: #8fa0a5;
  --ink: #f3f6f7;
  --accent-glow: rgba(55, 214, 208, 0.18);
  --nav-bg: rgba(13, 20, 23, 0.85);
}

:root[data-theme="dark"] .footer-brand-tag { color: #94a1a5; }

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Layout helpers ---------- */
.wrap {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 32px;
}
.wrap-narrow {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
}
.fade-in {
  animation: fadeIn 0.6s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.loading {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 40px 0;
  text-align: center;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo img { height: 34px; width: auto; }
.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}
.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-links a:hover { color: var(--accent2); }
.nav-links a.active {
  color: var(--accent2);
  border-bottom-color: var(--accent);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent2); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
}

@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px 32px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { border-top: 1px solid var(--border); }
  .nav-links a { display: block; padding: 14px 0; }
  .nav-toggle { display: block; }
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent2); }
.btn-light {
  background: #ffffff;
  color: #10161a;
}
.btn-light:hover { transform: translateY(-1px); }

/* ---------- Hero (split hero with portrait) ---------- */
.hero {
  padding: 72px 0 56px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}
.hero-eyebrow {
  display: block;
  color: var(--accent2);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
}
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  margin-bottom: 14px;
}
.hero-role {
  color: var(--muted);
  font-weight: 500;
  font-size: 1.05rem;
  margin-bottom: 18px;
}
.hero-bio {
  color: var(--muted);
  max-width: 46ch;
  margin-bottom: 30px;
}
.hero-ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-portrait {
  position: relative;
  justify-self: center;
}
.hero-portrait-ring {
  width: min(360px, 80vw);
  height: min(360px, 80vw);
  border-radius: 50%;
  border: 2px solid var(--accent);
  padding: 10px;
}
.hero-portrait-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
}
.hero-portrait-dots {
  position: absolute;
  bottom: -10px;
  right: -6px;
  width: 70px;
  height: 70px;
  background-image: radial-gradient(var(--accent) 1.6px, transparent 1.6px);
  background-size: 10px 10px;
  opacity: 0.55;
}

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .hero-portrait { justify-self: start; margin-top: 8px; }
}

/* ---------- Power line divider ---------- */
.power-line {
  position: relative;
  height: 1px;
  background: var(--border);
  margin: 0;
}
.power-line::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px 2px var(--accent-glow);
}

/* ---------- Section shell ---------- */
.section {
  padding: 64px 0;
}
.section-header {
  margin-bottom: 36px;
}
.section-eyebrow {
  display: block;
  color: var(--accent2);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 600;
  max-width: 32ch;
}
.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.section-link {
  font-weight: 600;
  color: var(--accent2);
  font-size: 0.95rem;
  white-space: nowrap;
}
.section-link:hover { color: var(--accent); }

/* ---------- What I Do ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.service-item-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
  margin-bottom: 18px;
}
.service-item h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.service-item p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}
@media (max-width: 860px) {
  .services-grid { grid-template-columns: 1fr; gap: 0; }
  .service-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
  }
  .service-item-icon { margin-bottom: 0; flex-shrink: 0; }
  .service-item p { display: none; }
  .service-item::after {
    content: "›";
    margin-left: auto;
    color: var(--muted);
    font-size: 1.3rem;
  }
}

/* ---------- Card grids (projects + posts) ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -16px rgba(16, 22, 26, 0.25);
}
.card-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface2);
}
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px; }
.card-eyebrow {
  color: var(--accent2);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}
.card-title {
  font-size: 1.08rem;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.card-excerpt {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 14px;
}
.card-meta {
  color: var(--muted);
  font-size: 0.82rem;
}
.card-link {
  color: var(--accent2);
  font-weight: 600;
  font-size: 0.9rem;
}
.card-link:hover { color: var(--accent); }

@media (max-width: 860px) {
  .cards-grid { grid-template-columns: 1fr; }
}
@media (min-width: 861px) and (max-width: 1080px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Principles ---------- */
.principles-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
}
.principle-item {
  text-align: center;
}
.principle-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
  margin: 0 auto 14px;
}
.principle-item p {
  font-size: 0.92rem;
  font-weight: 500;
  margin: 0;
}
@media (max-width: 860px) {
  .principles-grid { grid-template-columns: 1fr; gap: 0; }
  .principle-item {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    padding: 14px 0;
    border-top: 1px solid var(--border);
  }
  .principle-icon { margin: 0; flex-shrink: 0; }
  .principle-item::after {
    content: "›";
    margin-left: auto;
    color: var(--muted);
    font-size: 1.3rem;
  }
}

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--accent);
  color: #ffffff;
  padding: 26px 0;
}
.cta-band-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.cta-band-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #cfd6d8;
  padding: 44px 0 26px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 24px;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { height: 30px; filter: brightness(0) invert(1); }
.footer-brand-name { font-weight: 700; color: #fff; font-family: var(--font-display); }
.footer-brand-tag { font-size: 0.85rem; color: #94a1a5; }
.footer-social { display: flex; gap: 12px; }
.footer-social a {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #384146;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cfd6d8;
  transition: border-color 0.2s, color 0.2s;
}
.footer-social a:hover { border-color: var(--accent); color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid #262e32;
  font-size: 0.85rem;
  color: #8a9599;
}
.footer-bottom a { color: #8a9599; }
.footer-bottom a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .footer-inner, .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ---------- Page header (About / Contact / Blog index / Projects index) ---------- */
.page-header {
  padding: 56px 0 20px;
  text-align: center;
}
.page-header .section-eyebrow { justify-content: center; }
.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  margin-bottom: 10px;
}
.page-header p {
  color: var(--muted);
  max-width: 56ch;
  margin: 0 auto;
}
.page-body {
  padding: 40px 0 72px;
}
.page-body .article-content { max-width: var(--max-w); margin: 0 auto; }

/* ---------- Article body content (rendered from .txt) ---------- */
.article-content h2 {
  font-size: 1.4rem;
  margin: 36px 0 14px;
}
.article-content p { margin-bottom: 16px; color: var(--text); }
.article-content ul {
  margin: 0 0 20px;
  padding-left: 22px;
}
.article-content li { margin-bottom: 8px; color: var(--text); }
.article-figure {
  margin: 28px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.article-figure img { width: 100%; }
.article-figure figcaption {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface2);
}

/* ---------- Article / project single template ---------- */
.article-header {
  padding: 48px 0 24px;
  text-align: center;
}
.article-header .card-eyebrow { justify-content: center; display: block; }
.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 10px 0;
}
.article-hero-wrap {
  width: 100%;
  box-sizing: border-box;
  max-width: var(--max-w-wide);
  margin: 0 auto 40px;
  padding: 0 32px;
}
.article-hero-image {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 21 / 9;
}
.article-hero-image img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
}
.article-body { padding-bottom: 72px; }
.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--accent2);
  font-weight: 600;
  font-size: 0.9rem;
}
.back-link:hover { color: var(--accent); }

/* ---------- Contact page ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: var(--max-w-wide);
  margin: 0 auto;
}
.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.contact-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}
.contact-card a {
  color: var(--accent2);
  font-weight: 600;
}
.contact-card a:hover { color: var(--accent); }

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Utility icon sizing ---------- */
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.icon-sm { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
