/* ==========================================================
   Portfolio — Amirreza Arezoumand
   Design tokens taken from the "Portfolio (Community)" Figma file
   ========================================================== */

:root {
  --bg: #282c33;
  --primary: #c778dd;
  --gray: #abb2bf;
  --white: #ffffff;
  --container: 1024px;
  --gutter: 16px;
  --font-latin: "Fira Code", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-fa: "Vazirmatn", "Fira Code", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--gray);
  font-family: var(--font-latin);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

html[lang="fa"] body { font-family: var(--font-fa); line-height: 1.8; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.container { width: min(var(--container), 100% - 2 * var(--gutter)); margin-inline: auto; position: relative; z-index: 1; }
main { flex: 1; position: relative; overflow-x: clip; }
html { overflow-x: clip; }

.accent { color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- icons ---------- */
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- header ---------- */
.site-header { padding-block: 32px; position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--white); font-weight: 700; font-size: 16px; }
.brand img { width: 18px; height: 18px; }

.main-nav { display: flex; align-items: center; gap: 32px; }
.main-nav ul { display: flex; gap: 32px; }
.nav-link { color: var(--gray); transition: color .2s; }
.nav-link::before { content: "#"; color: var(--primary); }
.nav-link:hover, .nav-link.active { color: var(--white); }

/* language switcher */
.lang { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--gray); padding: 2px 4px; }
.lang-btn:hover { color: var(--white); }
.lang-btn .icon { width: 14px; height: 14px; }
.lang-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 72px; border: 1px solid var(--gray); background: var(--bg); display: none; z-index: 30; }
.lang.open .lang-menu { display: block; }
.lang-menu button { display: block; width: 100%; padding: 6px 12px; text-align: start; color: var(--gray); }
.lang-menu button:hover, .lang-menu button[aria-current="true"] { color: var(--white); background: rgba(171, 178, 191, .12); }

/* burger */
.burger { display: none; color: var(--gray); }
.mobile-panel { display: none; }

/* social rail (desktop) */
.social-rail { position: absolute; inset-inline-start: 17px; top: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.social-rail::before { content: ""; width: 1px; height: 191px; background: var(--gray); }
.social-rail a { color: var(--gray); transition: color .2s; }
.social-rail a:hover { color: var(--primary); }
.social-rail .icon { width: 20px; height: 20px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1px solid var(--primary); color: var(--white); line-height: 1.4; cursor: pointer; transition: background .2s, border-color .2s; }
.btn:hover { background: rgba(199, 120, 221, .2); }
.btn.secondary { border-color: var(--gray); color: var(--gray); }
.btn.secondary:hover { background: rgba(171, 178, 191, .12); color: var(--white); }
.btn .icon { width: 16px; height: 16px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- titles ---------- */
.section { padding-block: 48px; }
.section-head { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.section-title { display: flex; align-items: center; gap: 0; font-size: 32px; font-weight: 500; color: var(--white); line-height: 1.3; }
.section-title .hash { color: var(--primary); }
.section-head .line { height: 1px; background: var(--primary); flex: 0 1 clamp(40px, 30vw, 330px); min-width: 24px; }
.section-head .view-all { white-space: nowrap; margin-inline-start: auto; color: var(--white); display: inline-flex; align-items: center; gap: 8px; }
.section-head .view-all:hover { color: var(--primary); }

.page-head { padding-top: 48px; }
.page-title { font-size: 32px; font-weight: 500; color: var(--white); line-height: 1.3; }
.page-title .slash { color: var(--primary); }
.page-sub { margin-top: 8px; }

/* ---------- hero ---------- */
.hero { padding-block: 48px 32px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: 32px; line-height: 1.4; font-weight: 600; color: var(--white); }
html[lang="fa"] .hero h1 { line-height: 1.6; }
.hero p { margin-top: 24px; max-width: 460px; }
.hero .btn { margin-top: 28px; }

.hero-visual { position: relative; min-height: 420px; display: flex; justify-content: center; align-items: flex-end; }
.hero-visual .portrait { width: min(380px, 100%); height: 386px; object-fit: contain; position: relative; z-index: 1; }
.frame-outline { position: absolute; z-index: 0; inset-inline-start: 0; top: 80px; width: 130px; height: 130px; border: 1px solid var(--primary); }
.frame-outline::after { content: ""; position: absolute; inset-inline-start: 38px; top: -26px; width: 72px; height: 72px; border: 1px solid var(--primary); }
.hero-visual .dots { position: absolute; inset-inline-end: 8px; bottom: 56px; z-index: 2; }
.status { position: relative; z-index: 2; margin-top: -1px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--gray); padding: 6px 10px; font-size: 14px; background: var(--bg); width: min(402px, 100%); }
.status i { width: 16px; height: 16px; background: var(--primary); flex: none; }
.status b { color: var(--white); font-weight: 600; }
.hero-wrap { display: flex; flex-direction: column; align-items: center; }

.dots { width: 84px; height: 84px; background-image: radial-gradient(circle, var(--gray) 1px, transparent 1.6px); background-size: 14px 14px; opacity: .8; }

/* ---------- quote ---------- */
.quote-wrap { padding-block: 48px; display: flex; justify-content: center; }
.quote { position: relative; max-width: 712px; width: 100%; border: 1px solid var(--gray); padding: 32px; color: var(--white); font-size: 22px; line-height: 1.5; text-align: center; background: var(--bg); }
html[lang="fa"] .quote { font-size: 20px; }
.quote::before, .quote::after { position: absolute; background: var(--bg); padding: 0 8px; color: var(--gray); font-size: 54px; line-height: 1; height: 30px; font-family: Georgia, serif; }
.quote::before { content: "\201C"; inset-inline-start: 10px; top: -14px; }
.quote::after { content: "\201D"; inset-inline-end: 10px; bottom: -16px; }
.quote-block { max-width: 712px; width: 100%; display: flex; flex-direction: column; }
.quote-author { align-self: flex-end; margin-inline-end: 24px; margin-top: -1px; border: 1px solid var(--gray); padding: 14px 16px; color: var(--gray); }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.card { border: 1px solid var(--gray); background: var(--bg); transition: border-color .2s; }
.card:hover { border-color: var(--primary); }
.card-img { width: 100%; height: 160px; object-fit: cover; border-bottom: 1px solid var(--gray); }
.card-tags { padding: 6px 8px; border-bottom: 1px solid var(--gray); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card-body { padding: 16px; }
.card-body h3 { color: var(--white); font-size: 24px; font-weight: 500; line-height: 1.3; }
.card-body p { margin-top: 12px; }
.card-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 12px; }
.card-actions .btn { padding: 4px 14px; }

/* ---------- skills ---------- */
.skills-layout { display: grid; grid-template-columns: 1fr 1.4fr; gap: 32px; align-items: center; }
.skills-decor { position: relative; min-height: 280px; }
.skills-decor .sq { position: absolute; border: 1px solid var(--gray); }
.skills-decor .sq.p { border-color: var(--primary); }
.skills-decor .dots { position: absolute; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; align-items: start; }
.skill-box { border: 1px solid var(--gray); }
.skill-box h3 { color: var(--white); font-size: 15px; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--gray); }
.skill-box p { padding: 8px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.about-text p + p { margin-top: 20px; }
.about-text .btn { margin-top: 28px; }
.about-visual { position: relative; display: flex; justify-content: center; }
.about-visual img { width: min(340px, 100%); height: 420px; object-fit: contain; position: relative; z-index: 1; border-bottom: 1px solid var(--primary); }
.about-visual .dots { position: absolute; inset-inline-start: 6%; top: 8%; }
.about-visual .dots.b { inset-inline-start: auto; inset-inline-end: 0; top: auto; bottom: 18%; }

/* ---------- contacts ---------- */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.contact-box { border: 1px solid var(--gray); padding: 16px; width: fit-content; min-width: 230px; }
.contact-box h3 { color: var(--white); font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.contact-box li + li { margin-top: 8px; }
.contact-box a { display: inline-flex; align-items: center; gap: 8px; color: var(--gray); direction: ltr; unicode-bidi: plaintext; }
.contact-box a:hover { color: var(--primary); }
.contact-box .icon { width: 20px; height: 20px; }

.form { display: grid; gap: 16px; max-width: 560px; }
.field label { display: block; margin-bottom: 6px; color: var(--white); font-size: 14px; }
.field input, .field textarea { width: 100%; background: transparent; color: var(--white); border: 1px solid var(--gray); padding: 8px 12px; font: inherit; }
.field input:hover, .field textarea:hover { border-color: var(--white); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field textarea { min-height: 140px; resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-status { min-height: 1.5em; font-size: 14px; }
.form-status.ok { color: #7ee2a8; }
.form-status.err { color: #ff8a8a; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--gray); margin-top: 64px; padding-block: 32px 24px; position: relative; z-index: 1; }
.footer-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-brand .brand { margin-bottom: 8px; flex-wrap: wrap; row-gap: 2px; }
.footer-brand a.mail { margin-inline-start: 12px; font-weight: 400; color: var(--gray); }
.footer-brand a.mail:hover { color: var(--primary); }
.footer-media h4 { color: var(--white); font-size: 24px; font-weight: 500; margin-bottom: 8px; }
.footer-media ul { display: flex; gap: 14px; }
.footer-media a { color: var(--gray); }
.footer-media a:hover { color: var(--primary); }
.copyright { text-align: center; margin-top: 32px; font-size: 14px; }

/* ---------- decorations ---------- */
.deco { position: absolute; border: 1px solid var(--gray); opacity: .55; pointer-events: none; z-index: 0; }
.deco.d1 { width: 155px; height: 155px; inset-inline-start: -77px; top: 640px; }
.deco.d2 { width: 155px; height: 155px; inset-inline-end: -77px; top: 360px; }
.deco.d3 { width: 90px; height: 90px; inset-inline-end: -40px; top: 120px; }
.deco-dots { position: absolute; z-index: 0; pointer-events: none; }
.deco-dots.a { inset-inline-start: 12px; top: 520px; }
.deco-dots.b { inset-inline-end: 10px; top: 900px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .social-rail { display: none; }
  .deco, .deco-dots { display: none; }
}

@media (max-width: 860px) {
  .main-nav { display: none; }
  .burger { display: inline-flex; z-index: 60; }
  .site-header { padding-block: 16px; }

  .mobile-panel { position: fixed; inset: 0; z-index: 50; background: var(--bg); padding: 16px; display: none; flex-direction: column; }
  .mobile-panel.open { display: flex; }
  .mobile-panel .top { display: flex; justify-content: space-between; align-items: center; }
  .mobile-panel ul { margin-top: 48px; display: grid; gap: 28px; }
  .mobile-panel .nav-link { font-size: 32px; color: var(--white); }
  .mobile-panel .lang { margin-top: 32px; }
  .mobile-panel .lang-menu { position: static; display: flex; gap: 8px; border: 0; margin-top: 8px; }
  .mobile-panel .lang-menu button { border: 1px solid var(--gray); width: auto; }
  .mobile-panel .socials { margin-top: auto; display: flex; justify-content: center; gap: 16px; padding-bottom: 32px; }
  .mobile-panel .socials a { color: var(--gray); }
  .mobile-panel .socials .icon { width: 32px; height: 32px; }

  .hero-grid, .about-grid, .contact-grid, .skills-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .hero-visual { min-height: 0; }
  .skills-decor { display: none; }
  .cards { grid-template-columns: 1fr; }
  .quote-wrap { padding-inline: 8px; }
  .quote { font-size: 18px; padding: 28px 20px; }
  .quote-author { margin-inline-end: 8px; }
  .section-title, .page-title { font-size: 28px; }
  .section-head { gap: 12px; }
  .footer-brand a.mail { margin-inline-start: 0; flex-basis: 100%; }
  .about-visual img { height: 340px; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
