:root{
  --bg:#f4f4f4;
  --ink:#0b0b0b;
  --muted:#2a2a2a;
  --card:#ffffff;
  --alt:#e9e9e9;

  --border:3px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);

  --radius: 16px;
  --max: 1040px;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font);
  line-height:1.6;
}

img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
button{ font:inherit; color:inherit; }

.container{ max-width:var(--max); margin:0 auto; padding:0 18px; }
.section{ padding:34px 0; }
.section--alt{ background:var(--alt); border-top:var(--border); border-bottom:var(--border); }
.section--hero{ padding-top:24px; }

.skip-link{
  position:absolute; left:-999px; top:10px;
  background:var(--card); border:var(--border);
  padding:8px 12px; border-radius:12px; z-index:999;
}
.skip-link:focus{ left:10px; }

.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;
}

/* Typography */
.h1{
  font-size:clamp(40px, 6vw, 64px);
  line-height:0.95;
  margin:0 0 12px;
  font-weight:900;
  letter-spacing:-1px;
}
.h1--tight{ margin-bottom:6px; }
.h2{ font-size:clamp(26px, 3.3vw, 36px); margin:0 0 14px; font-weight:900; }
.h3{ font-size:clamp(18px, 2.2vw, 22px); margin:0 0 8px; font-weight:900; }
.lead{ font-size:clamp(16px, 2.2vw, 18px); margin:0 0 16px; color:var(--muted); }
.muted{ color:var(--muted); }
.small{ font-size:14px; }

.kicker{
  display:inline-block;
  font-weight:900;
  border:var(--border);
  background:var(--card);
  padding:6px 10px;
  border-radius:999px;
  box-shadow:var(--shadow-sm);
  margin:0 0 12px;
}
.accent{
  background:var(--card);
  border:var(--border);
  padding:2px 10px;
  border-radius:14px;
  box-shadow:3px 3px 0 var(--ink);
}

/* Header */
.topbar{
  position:sticky;
  top:0;
  background:var(--bg);
  border-bottom:var(--border);
  z-index:50;
}

.topbar__inner{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 0;
  position:relative;
}

/* 🔥 موبایل: دکمه‌ها فاصله درست داشته باشند */
.topbar__inner{
  flex-wrap:nowrap;
  margin-bottom: 2vh;
}

/* Brand (Home button) */
.brand{
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;height:44px;
  border:var(--border);
  border-radius:12px;
  background:var(--card);
  box-shadow:3px 3px 0 var(--ink);
  flex:0 0 auto;
}
.brand__icon{ display:block; }

/* Theme button */
.theme-toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:var(--border);
  background:var(--card);
  padding:10px 12px;
  border-radius:14px;
  box-shadow:var(--shadow-sm);
  font-weight:900;
  cursor:pointer;
  flex:0 0 auto;
}
.theme-toggle:active{
  transform:translate(1px,1px);
  box-shadow:3px 3px 0 var(--ink);
}

/* Desktop nav */
.nav{
  margin-left:auto;
  display:flex;
  gap:10px;
  align-items:center;
}

.nav__link{
  padding:8px 10px;
  border-radius:12px;
  font-weight:900;
}
.nav__link:hover{
  background:var(--card);
  outline:3px solid var(--ink);
}

/* Hamburger */
.nav-toggle{
  margin-left:auto;
  display:none;
  width:44px;height:44px;
  border:var(--border);
  border-radius:12px;
  background:var(--card);
  box-shadow:3px 3px 0 var(--ink);
  cursor:pointer;
  flex:0 0 auto;
}
.nav-toggle__bar{
  display:block;
  width:18px;
  height:2px;
  background:var(--ink);
  margin:4px auto;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:var(--border);
  background:var(--card);
  padding:10px 14px;
  border-radius:14px;
  box-shadow:var(--shadow);
  font-weight:900;
  cursor:pointer;
  line-height:1;
  white-space:nowrap;
  min-height:44px; /* موبایل: قابل کلیک‌تر */
}
.btn:active{
  transform:translate(2px,2px);
  box-shadow:4px 4px 0 var(--ink);
}
.btn--ghost{ background:transparent; }
.btn--sm{
  padding:10px 14px;
  border-radius:14px;
  box-shadow:var(--shadow-sm);
}

.link{
  font-weight:900;
  border-bottom:2px solid var(--ink);
}
.link:hover{ opacity:.85; }

.toast{
  margin:14px 0 0;
  background:var(--card);
  border:var(--border);
  border-radius:14px;
  padding:10px 12px;
  box-shadow:var(--shadow-sm);
  font-weight:900;
}

.row{ display:flex; align-items:center; gap:14px; }
.row--between{ justify-content:space-between; }
.row--wrap{ flex-wrap:wrap; }

.divider{ height:1px; background:var(--ink); margin:14px 0; opacity:.25; }

/* Actions: equal spacing everywhere */
.actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;        /* equal space between buttons */
  padding:12px 0;  /* equal top/bottom spacing around the row */
  margin:0;
}
.actions .btn{ height:44px; }

/* Panels / Cards */
.panel{
  border:var(--border);
  border-radius:var(--radius);
  background:var(--card);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.panel__bar{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-bottom:var(--border);
  background:var(--alt);
}
.dot{
  width:10px;height:10px;
  border:2px solid var(--ink);
  border-radius:999px;
  background:var(--card);
}
.panel__bar-title{
  font-weight:900;
  color:var(--muted);
  margin-left:8px;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ============ IMAGES ============ */
.panel__media{
  display:flex;
  justify-content:center;
  align-items:center;
  background:#f0f0f0;
  padding:10px;
}

.panel__media img{
  width:100%;
  height:260px;
  object-fit:contain;
  background:#ddd;
  display:block;
}

.card__media{
  display:flex;
  justify-content:center;
  align-items:center;
  background:#f0f0f0;
  padding:10px;
}

.card__media img{
  width:100%;
  height:240px;
  object-fit:contain;
  background:#ddd;
  display:block;
}

.card--row .card__media img{ 
  height:200px; 
  object-fit:contain;
  display:block;
}

.panel__body{ padding:16px; }
.panel__body--center{ text-align:center; }

.card__media{ display:block; }

/* Grid */
.grid{ display:grid; gap:18px; }
.grid--cards{ grid-template-columns: repeat(12, 1fr); }
.grid--cards > *{ grid-column: span 6; }
.grid--stack{ grid-template-columns: repeat(12, 1fr); }
.grid--stack > *{ grid-column: span 6; }
.grid--two{ grid-template-columns: repeat(12, 1fr); }
.grid--two > *{ grid-column: span 6; }

/* Chips */
.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:12px 0;
}
.chip{
  border:2px solid var(--ink);
  border-radius:999px;
  padding:4px 10px;
  font-weight:900;
  font-size:12px;
  background:var(--card);
}
.chip--link{ box-shadow: var(--shadow-sm); }
.chip--active{ outline:3px solid var(--ink); }

.filterbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:14px 0 18px;
}

/* Forms */
.form{ display:flex; flex-direction:column; gap:10px; }
.label{ font-weight:900; }
.input, .textarea{
  border:var(--border);
  border-radius:14px;
  padding:10px 12px;
  font-size:16px;
  outline:none;
  background:var(--card);
  color:var(--ink);
}
.input:focus, .textarea:focus{ box-shadow:0 0 0 3px rgba(0,0,0,.2); }
.search{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

/* Prose */
.prose p{ margin:0 0 12px; color:var(--muted); }
.prose code{
  border:2px solid var(--ink);
  border-radius:10px;
  padding:1px 6px;
  background:var(--card);
  font-weight:900;
}

/* Clamp */
.clamp-2, .clamp-3{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.clamp-2{ -webkit-line-clamp:2; }
.clamp-3{ -webkit-line-clamp:3; }

/* Hero */
.hero{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:18px;
  align-items:start;
}

/* ✅ مهم: روی گوشی هم 3 تا کارت کنار هم باشد */
.hero__meta{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top:14px;
}

.meta-card{
  border:var(--border);
  border-radius:14px;
  background:var(--card);
  box-shadow:var(--shadow-sm);
  padding:10px 12px;
  min-width:0;
}
.meta-card__label{
  font-size:12px;
  font-weight:900;
  color:var(--muted);
}
.meta-card__value{
  font-weight:900;
  overflow-wrap:anywhere;
}

/* Footer */
.footer{
  border-top:var(--border);
  margin-top:30px;
  padding:18px 0;
}
.footer__inner{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

/* ================================
   TRUE INVERT THEME: swaps all colors
================================== */
html.theme-invert{
  filter: invert(1) hue-rotate(180deg);
}

/* keep media normal */
html.theme-invert img,
html.theme-invert video,
html.theme-invert iframe,
html.theme-invert canvas{
  filter: invert(1) hue-rotate(180deg);
}

/* Let the Home icon invert with the page */
html.theme-invert .brand__icon{
  filter: none !important;
}

/* ----------------------------------------
   BLOG CARD: Keep button fixed at the bottom
----------------------------------------- */
.card .panel__body{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.card .actions{
  margin-top:auto;
  padding:12px 0 0;
}

/* ===============================
   SMOOTH TYPEWRITER BOX
================================ */
.hero-title{
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -1px;
  margin: 0 0 18px;
}

.typewriter-box{
  display:inline-flex;
  align-items:center;
  padding:8px 18px;
  border-radius:18px;
  border:3px solid var(--ink);
  box-shadow:4px 4px 0 var(--ink);

  min-height:1.5em;
  overflow:hidden;

  vertical-align:top;
  line-height:1;

  will-change: contents;
  transform: translateZ(0);
}
#typewriterText{
  display:inline-block;
  white-space:nowrap;
  font-variant-ligatures:none;
  line-height:1;
  min-height:1em;
}
.caret{
  flex:0 0 auto;
  width:3px;
  height:1.15em;
  background:var(--ink);
  margin-left:8px;
  align-self:center;
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink{ 50%{ opacity:0; } }

/* External link arrow icon (if you use SVG) */
.external-icon{
  width:16px;
  height:16px;
  margin-left:6px;
  flex-shrink:0;
  transition: transform .2s ease;
}
.btn:hover .external-icon{
  transform: translate(2px, -2px);
}

/* Retro arrow (if you use ⇗) */
.retro-arrow{
  margin-left:6px;
  font-weight:900;
  display:inline-block;
  transition: transform .2s ease;
}
.btn:hover .retro-arrow{
  transform: translate(2px, -2px);
}

/* Hover helpers */
.git:hover { background: rgb(126, 126, 126); }
.deen:hover { background: #0e76a8; }
.tel:hover { background: #00BFFF; }

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 900px){
  .hero{ grid-template-columns: 1fr; }
  /* ✅ مهم: اینجا دیگه 1 ستونه نکن، همون 3 ستونه بمونه */
  .hero__meta{ grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .grid--cards > *{ grid-column: span 12; }
  .grid--stack > *{ grid-column: span 12; }
  .grid--two > *{ grid-column: span 12; }
}

@media (max-width: 640px){
  .container{ padding:0 14px; }
  .section{ padding:26px 0; }

  /* ✅ هدر موبایل: فاصله‌ها درست + دکمه‌ها کنار هم */
  .topbar__inner{
    gap:10px;
    align-items:center;
  }

  /* Navbar toggle visible */
  .nav-toggle{
    display:inline-flex;
    flex-direction:column;
    justify-content:center;
  }

  /* ✅ منوی همبرگری قشنگ‌تر */
  .nav{
    position:absolute;
    left:0; right:0;
    top:66px;

    margin-left:0;
    display:block;
    background:var(--card);

    border:var(--border);
    border-left:0;
    border-right:0;

    border-bottom-left-radius:18px;
    border-bottom-right-radius:18px;

    box-shadow: var(--shadow);

    /* animation */
    max-height:0;
    overflow:hidden;
    opacity:0;
    transform: translateY(-6px);
    transition: max-height .25s ease, opacity .18s ease, transform .18s ease;
  }

  .nav.is-open{
    max-height:360px;
    opacity:1;
    transform: translateY(0);
  }

  .nav__link{
    display:block;
    padding:14px 18px;
    border-top:var(--border);
    border-radius:0;
  }
  .nav__link:first-child{ border-top:0; }

  /* ✅ دکمه‌های اکشن روی گوشی: فاصله درست و دو ستونه بشن */
  .actions{
    gap:12px;
    padding:12px 0;
  }
  .actions .btn{
    flex:1 1 calc(50% - 6px);
    min-width:0;
  }

  /* ✅ Focus/Stack/Available: حتما 3 ستونه روی گوشی */
  .hero__meta{
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:10px;
  }
  .meta-card{
    padding:10px 10px;
  }
  .meta-card__label{
    font-size:11px;
  }
  .meta-card__value{
    font-size:13px;
    line-height:1.25;
  }

  /* Images smaller */
  .panel__media img, .card__media img{ height:200px; }

  /* Typewriter shrink */
  .typewriter-box{
    max-width:100%;
    padding:8px 14px;
  }
}

@media (max-width: 380px){
  .container{ padding:0 12px; }

  /* اگر گوشی خیلی کوچیک شد، دکمه‌ها تک ستونه بشن که له نشن */
  .actions .btn{
    flex:1 1 100%;
  }

  /* و اگر خیلی تنگ شد، متا کارت‌ها هم 1 ستونه بشن (اختیاری) */
  .hero__meta{
    grid-template-columns: 1fr;
  }
}