[hidden] { display: none !important; }
body { margin: 0; }
/* Layout: dark atelier. Centered medallion header with split nav, hero text left and an engraved jade rosette right, double-ruled section breaks, framed panels. Jade replaces the usual gold. */
:root {
  --ink: #07090a;
  --panel: #0d1110;
  --line: #1e2824;
  --mist: #8f9b96;
  --text: #e8ede9;
  --jade: #4fc19a;
  --jade-deep: #1f6a53;
  --font-display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --font-body: "Montserrat", "Vazirmatn", "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.85;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  background: var(--ink);
  z-index: 30;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 4px; }
.wrap { max-width: 70rem; margin-inline: auto; }
.rule { height: 5px; border-block: 1px solid var(--line); }

/* header */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: rgba(7, 9, 10, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding-inline: max(16px, env(safe-area-inset-left, 0px));
}
.top .wrap { display: flex; align-items: center; justify-content: center; gap: 2.2rem; padding-block: 1rem; }
.nav { display: flex; flex: 1; gap: 0; }
.nav.left { justify-content: flex-end; }
.nav.right { justify-content: flex-start; }
.nav a { position: relative; padding-inline: 1.5rem; font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.2rem; letter-spacing: 0.01em; line-height: 1.7; color: #cfd8d3; transition: color .3s; }
.nav a::after { content: ""; position: absolute; left: 50%; bottom: -0.45rem; width: 5px; height: 5px; background: var(--jade); transform: translateX(-50%) rotate(45deg) scale(0); transition: transform .3s; }
.nav a:hover::after, .nav a.on::after { transform: translateX(-50%) rotate(45deg) scale(1); }
.nav a.on { color: var(--text); }
.nav a:not(:last-child) { border-right: 1px solid var(--line); }
.nav.left a:last-child { border-right: 0; }
.nav a:hover { color: var(--jade); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; }
.medal { width: 3.4rem; height: 3.4rem; border: 1px solid var(--jade-deep); border-radius: 50%; display: grid; place-items: center; position: relative; }
.medal::before { content: ""; position: absolute; inset: 4px; border: 1px solid var(--line); border-radius: 50%; }
.medal i { width: 0.55rem; height: 0.55rem; background: var(--jade); transform: rotate(45deg); }
.brand small { font-size: 0.5rem; letter-spacing: 0.36em; text-transform: uppercase; color: var(--mist); font-weight: 500; }

/* hero */
.hero { position: relative; isolation: isolate; padding-block: clamp(5rem, 14vw, 10rem) clamp(4.5rem, 11vw, 8rem); }
.eyebrow { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.34em; text-transform: uppercase; color: var(--jade); margin-bottom: 1.4rem; }
.hero h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(2.7rem, 7vw, 5rem); line-height: 1.08; margin: 0 0 1.6rem; max-width: 9em; text-wrap: balance; }
.hero h1 em { color: var(--jade); font-weight: 500; }
.hero p { max-width: 24rem; color: #b7c1bc; margin: 0 0 2.2rem; }
.dash { width: 2.4rem; height: 2px; background: var(--jade); margin-bottom: 2rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.9rem;
  padding: 0.95rem 1.8rem;
  border: 1px solid var(--jade-deep);
  background: transparent;
  color: var(--text);
  font-family: inherit; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase;
  cursor: pointer;
  transition: background .3s, color .3s, border-color .3s;
}
.btn:hover { background: var(--jade); color: var(--ink); border-color: var(--jade); }

/* built-with strip */
.strip { text-align: center; padding-block: clamp(3rem, 7vw, 4.5rem); }
.strip .t { font-family: var(--font-display); font-style: italic; font-size: 1.3rem; color: var(--mist); margin-bottom: 1.2rem; }
.strip ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem 2.8rem; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: #cfd8d3; }

/* section titles */
.label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.34em; text-transform: uppercase; color: var(--jade); margin-bottom: 0.9rem; }
.title { font-family: var(--font-display); font-weight: 500; font-size: clamp(2.2rem, 5.5vw, 3.4rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.center { text-align: center; }
.sec { padding-block: clamp(4rem, 10vw, 7.5rem); }

/* about panel */
.about { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 3rem; align-items: center; background: var(--panel); border: 1px solid var(--line); padding: clamp(2rem, 6vw, 4.5rem); overflow: hidden; }
.about::before { content: "A"; position: absolute; inset-inline-start: 1.5rem; inset-block-start: -2.5rem; font-family: var(--font-display); font-style: italic; font-size: 18rem; line-height: 1; color: rgba(79, 193, 154, 0.05); pointer-events: none; }
.about > * { position: relative; min-width: 0; }
.about p { margin: 1.4rem 0 0; color: #b7c1bc; max-width: 32rem; }
.orn { width: 100%; max-width: 20rem; justify-self: center; }

/* ornament in the About panel: the square turns slowly, a small satellite circles the ring */
.orn .spin, .orn .orbit { transform-box: view-box; transform-origin: 120px 60px; }
.orn .spin { animation: orn-turn 18s linear infinite; }
.orn .orbit { animation: orn-turn 11s linear infinite reverse; filter: drop-shadow(0 0 3px #4fc19a); }
@keyframes orn-turn { to { transform: rotate(360deg); } }

/* work */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr)); gap: 1.5rem; margin-top: 3rem; }
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 2.2rem 1.8rem 1.8rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; transition: border-color .35s; }
.panel::after { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(79, 193, 154, 0.08); pointer-events: none; }
.panel:hover { border-color: var(--jade-deep); }
.panel .st { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--jade); }
.panel .st.dim { color: var(--mist); }
.panel h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.75rem; line-height: 1.2; margin: 0; }
.panel p { margin: 0; color: #a3aeaa; font-size: 0.88rem; flex: 1; }
.panel .tech { padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mist); }

/* contact */
.contact h2 { margin: 0 auto 2.2rem; max-width: 12em; }
.mailline { margin-top: 1.8rem; font-family: var(--font-display); font-size: 1.5rem; letter-spacing: 0.03em; }
.social { margin-top: 0.4rem; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mist); }

footer { text-align: center; padding-block: 2rem 2.6rem; font-size: 0.66rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--mist); }


.thumb { display: block; width: calc(100% + 3.6rem); max-width: none; margin: -2.2rem -1.8rem 0.6rem; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }

/* full-page grid of squares with circles, neighbours turn in opposite directions */
.space, .gridbg, .meteors { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* drifting code in the background */
.codebg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.site { position: relative; z-index: 1; }

/* contact info and form */
.cgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(2rem, 6vw, 4rem); margin-top: 3rem; align-items: start; }
.info { border-top: 1px solid var(--line); }
.irow { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 1rem; padding-block: 1.1rem; border-bottom: 1px solid var(--line); min-width: 0; }
.irow span { width: 5.5rem; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: var(--mist); }
.irow b, .irow a { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; overflow-wrap: anywhere; }
.irow a { color: var(--text); text-decoration: underline; text-decoration-color: var(--jade-deep); text-underline-offset: 5px; transition: color .3s; }
.irow a:hover { color: var(--jade); }
.mini { background: none; border: 1px solid var(--line); color: var(--mist); font: inherit; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; padding: 0.3rem 0.9rem; cursor: pointer; transition: color .3s, border-color .3s; }
.mini:hover { color: var(--jade); border-color: var(--jade-deep); }
.cform { display: grid; gap: 1.2rem; background: var(--panel); border: 1px solid var(--line); padding: clamp(1.5rem, 4vw, 2.4rem); }
.field { display: grid; gap: 0.45rem; }
.field label { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: var(--mist); }
.field input, .field textarea, .cresult textarea { width: 100%; background: var(--ink); border: 1px solid var(--line); border-radius: 0; color: var(--text); font: inherit; font-size: 16px; padding: 0.8rem 0.9rem; outline: 0; transition: border-color .3s; }
.field textarea { min-height: 8rem; resize: vertical; }
.field input:focus, .field textarea:focus, .cresult textarea:focus { border-color: var(--jade); }
.field .bad { border-color: #b86a6a; }
.cform .btn { justify-self: start; }
.cstatus { margin: 0; min-height: 1.4em; font-size: 0.85rem; color: var(--mist); }
.cstatus.err { color: #d98a8a; }
.cresult { display: grid; gap: 0.9rem; }
.cresult textarea { resize: vertical; color: #b7c1bc; }
.cacts { display: flex; flex-wrap: wrap; gap: 0.8rem; }
@media (max-width: 860px) { .cgrid { grid-template-columns: 1fr; } }

/* hero copy: English first, Persian underneath */
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.5rem); line-height: 1.15; max-width: min(100%, 34rem); }
.hero p.sub { max-width: min(100%, 30rem); margin-bottom: 1rem; }
.hero p.fa { font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif; text-align: right; max-width: min(100%, 34rem); margin: -0.6rem 0 1.8rem; color: #cfd8d3; font-size: 1.05rem; font-weight: 400; line-height: 1.9; }
.hero p.sub.fa { font-size: 0.92rem; font-weight: 300; color: #9fabA6; max-width: min(100%, 30rem); margin: 0 0 2.2rem; }

/* round portrait with the engraved rosette radiating from behind it */
.portrait { position: relative; margin: 3.2rem 0 0; width: min(100%, 16rem); }
.disc { position: relative; aspect-ratio: 1; isolation: isolate; }
.rosette { position: absolute; z-index: 0; left: 50%; top: 50%; width: min(190%, 92vw); max-width: none; aspect-ratio: 1; transform: translate(-50%, -50%); opacity: 0.85; pointer-events: none; -webkit-mask-image: radial-gradient(circle, #000 42%, transparent 70%); mask-image: radial-gradient(circle, #000 42%, transparent 70%); }
.disc img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; max-width: 100%; object-fit: cover; border-radius: 50%; border: 1px solid var(--jade); box-shadow: 0 0 0 9px var(--ink), 0 0 0 10px var(--jade-deep), 0 0 60px rgba(79, 193, 154, 0.18); filter: grayscale(0.25) contrast(1.05); }
.portrait figcaption { position: relative; z-index: 1; margin-top: 2rem; text-align: center; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase; color: var(--mist); }
@media (min-width: 1000px) {
  .portrait { position: absolute; margin: 0; inset-block-start: 50%; inset-inline-end: 9%; transform: translateY(-50%); width: 19rem; }
}

.csub { max-width: 34rem; margin: 1.4rem auto 0; color: #b7c1bc; }

/* soft light that now and then passes over the big letters */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1, .title {
    background-image: linear-gradient(105deg, var(--text) 0%, var(--text) 42%, #d9fff1 50%, var(--text) 58%, var(--text) 100%);
    background-size: 250% 100%;
    background-position: 160% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: sheen 9s ease-in-out infinite;
  }
  .hero h1 em {
    background-image: linear-gradient(105deg, var(--jade) 0%, var(--jade) 42%, #d9fff1 50%, var(--jade) 58%, var(--jade) 100%);
    background-size: 250% 100%;
    background-position: 160% 0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: sheen 9s ease-in-out infinite;
    animation-delay: 0.35s;
  }
  .title { animation-delay: 1.2s; }
}
@keyframes sheen { 0%, 55% { background-position: 160% 0; } 100% { background-position: -60% 0; } }

/* redacted text, revealed on hover, focus or tap */
.redact { background: var(--line); color: transparent; cursor: pointer; transition: color .45s, background .45s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.redact:hover, .redact:focus-visible, .redact.on { color: var(--text); background: transparent; }

/* hidden console */
.term { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(4, 6, 6, 0.96); padding: max(16px, env(safe-area-inset-top, 0px)) 16px 16px; }
.term .box { width: min(42rem, 100%); max-height: 82vh; display: flex; flex-direction: column; background: #060808; border: 1px solid var(--jade-deep); }
.term .bar { display: flex; justify-content: space-between; align-items: center; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--mist); }
.term .bar button { background: none; border: 0; color: var(--mist); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.term .bar button:hover { color: var(--jade); }
.term .out { flex: 1; min-height: 14rem; overflow-y: auto; padding: 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.75; color: #cfd8d3; }
.term .out p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .out .k { color: var(--jade); }
.term form { display: flex; gap: 0.7rem; align-items: center; border-top: 1px solid var(--line); padding: 0.8rem 1rem; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--jade); }
.term input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; }
.hush { margin-top: 0.7rem; color: #3f4a46; }

@media (max-width: 760px) {
  .top { position: static; }
  .top .wrap { flex-wrap: wrap; gap: 0.8rem 0; padding-block: 1.1rem 0.9rem; }
  .brand { width: 100%; order: -1; }
  .nav { flex: 0 1 auto; }
  .nav a { padding-inline: 0.7rem; font-size: 1rem; }
  .about { grid-template-columns: 1fr; gap: 2rem; }
  .orn { max-width: 14rem; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  .hero h1, .hero h1 em, .title, .orn .spin, .orn .orbit { animation: none !important; }
}

/* ---------- project cards that link to a project page ---------- */
a.panel { color: inherit; text-decoration: none; }
.panel .more { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: var(--jade); opacity: 0; transform: translateX(-6px); transition: opacity .3s, transform .3s; }
a.panel:hover .more, a.panel:focus-visible .more { opacity: 1; transform: none; }
a.panel:focus-visible { outline: 2px solid var(--jade); outline-offset: 4px; }
@media (hover: none) { .panel .more { opacity: 1; transform: none; } }

/* ---------- project page ---------- */
.pj { padding-block: clamp(3rem, 8vw, 6rem) clamp(3rem, 8vw, 5rem); }
.pj .back { display: inline-block; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--mist); margin-bottom: 2.4rem; transition: color .3s; }
.pj .back:hover { color: var(--jade); }
.pj .st { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--jade); margin-bottom: 1rem; }
.pj h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(2.4rem, 6.5vw, 4.4rem); line-height: 1.12; margin: 0 0 1.4rem; max-width: 16em; text-wrap: balance; }
.pj .lead { max-width: 40rem; color: #b7c1bc; margin: 0 0 1.6rem; font-size: 1.05rem; }
.pj .meta { display: flex; flex-wrap: wrap; gap: 0.6rem 1.8rem; align-items: center; padding-block: 1.1rem; border-block: 1px solid var(--line); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mist); }
.pj .meta a { color: var(--jade); border-bottom: 1px solid var(--jade-deep); padding-bottom: 2px; }
.pj .blocks { display: grid; gap: clamp(2rem, 5vw, 3.4rem); margin-top: clamp(2.4rem, 6vw, 4rem); }
.pj figure { margin: 0; }
.pj figure img { display: block; width: 100%; height: auto; max-width: 100%; border: 1px solid var(--line); background: var(--panel); cursor: zoom-in; }
.pj figcaption { margin-top: 0.8rem; font-size: 0.82rem; color: var(--mist); text-align: start; }
.pj .tx { max-width: 40rem; color: #c3cbc7; }
.pj .tx p { margin: 0 0 1.2rem; white-space: pre-line; text-align: start; }
.pj .tx p:last-child { margin-bottom: 0; }
.pj h2.bh { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.7rem, 4.4vw, 2.6rem); line-height: 1.2; margin: 0; max-width: 24em; text-wrap: balance; text-align: start; }
.pj .state { color: var(--mist); padding-block: 4rem; text-align: center; }
.lb { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 6, 0.94); cursor: zoom-out; }
.lb img { max-width: 100%; max-height: 100%; object-fit: contain; border: 1px solid var(--jade-deep); }
