/* ==========================================================================
   Thracite — shared design system
   --------------------------------------------------------------------------
   Every page (landing, contact form, submission, errors) uses this file, so
   the Django-rendered forms look exactly like the original static HTML.
   Values here are the ones from the first templates: coal background, ink
   type, hairline rules, ember accents, mono kickers.
   ========================================================================== */

:root {
    --coal: #0b0b0a;
    --coal-raise: #10100e;
    --ink: #f2f2ef;
    --ink-dim: #9a998f;
    --ink-faint: #55544c;
    --line: #26251f;
    --line-soft: #1b1a16;
    --ember: #c96a3f;
    --sage: #8aab7a;
    --mono: 'IBM Plex Mono', 'Courier New', monospace;
    --body-font: 'IRANSansX', 'Vazirmatn', sans-serif;
    --frame-max: 1040px;
    --frame-pad: 28px;
    --control-pad-y: 13px;
    --control-pad-x: 15px;
}


/* Reset
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--coal);
    color: var(--ink);
    font-family: var(--body-font);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
::selection { background: var(--ember); color: var(--coal); }
img, svg { display: inline-block; vertical-align: middle; }
ul, ol { list-style: none; }
a { color: inherit; }


/* Texture: film grain + starfield
   ========================================================================== */

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: .045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

canvas#stars { position: fixed; inset: 0; z-index: 0; display: block; }


/* Layout
   ========================================================================== */

.frame {
    position: relative;
    z-index: 2;
    max-width: var(--frame-max);
    margin: 0 auto;
    padding: 0 var(--frame-pad);
    width: 100%;
}
main { flex: 1; }

.skip-link {
    position: absolute;
    inset-inline-start: -9999px;
    top: 0;
    z-index: 40;
    background: var(--ink);
    color: var(--coal);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .1em;
    padding: 10px 16px;
    text-decoration: none;
}
.skip-link:focus { inset-inline-start: 16px; top: 12px; }


/* Nav
   ========================================================================== */

nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 11, 10, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line-soft);
}
nav .frame {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px var(--frame-pad);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand svg { width: 22px; height: 22px; }
.brand span {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .1em;
    color: var(--ink);
    direction: ltr;
}
.brand:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }

.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-link {
    position: relative;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-dim);
    text-decoration: none;
    padding: 4px 0;
    transition: color .15s;
}
.nav-link:hover { color: var(--ink); }
.nav-link:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.nav-link[aria-current="page"] { color: var(--ink); }
.nav-link[aria-current="page"]::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 1px;
    background: var(--ember);
}

.nav-back {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-dim);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color .15s;
}
.nav-back:hover { color: var(--ink); }
.nav-back:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.nav-back svg { width: 13px; height: 13px; flex-shrink: 0; }
html[lang="en"] .nav-back svg { transform: scaleX(-1); }

/* Language toggle */
.lang-toggle {
    display: flex;
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 11px;
    direction: ltr;
    overflow: hidden;
}
.lang-toggle button {
    background: transparent;
    border: none;
    color: var(--ink-faint);
    padding: 7px 12px;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 11px;
    transition: color .15s, background .15s;
}
.lang-toggle button.active { background: var(--ink); color: var(--coal); font-weight: 600; }
.lang-toggle button:not(.active):hover { color: var(--ink); }
.lang-toggle button:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }


/* Typography helpers
   ========================================================================== */

.eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--ember);
    margin-bottom: 16px;
    direction: ltr;
}
.side-tag {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--ink-faint);
    margin: 56px 0 20px;
    direction: ltr;
    text-align: center;
}
.mono { font-family: var(--mono); direction: ltr; letter-spacing: .06em; }
.lead { font-size: 15px; color: var(--ink-dim); line-height: 2; }
html[lang="en"] .lead { line-height: 1.75; }


/* Buttons
   ========================================================================== */

.btn {
    font-family: var(--body-font);
    font-size: 14px;
    font-weight: 600;
    padding: 14px 30px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border-radius: 0;
    transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--ink); color: var(--coal); border: 1px solid var(--ink); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink-dim); }
.btn:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.btn[disabled],
.btn[aria-disabled="true"] { opacity: .45; cursor: progress; }
.btn--wide { min-width: 200px; text-align: center; }


/* Hero (landing)
   ========================================================================== */

.hero { padding: clamp(64px, 11vh, 124px) 0 64px; }
.hero h1 {
    font-weight: 800;
    font-size: clamp(32px, 6vw, 60px);
    line-height: 1.45;
    max-width: 18ch;
}
html[lang="en"] .hero h1 { line-height: 1.14; max-width: 22ch; }
.hero .lead { margin-top: 26px; max-width: 62ch; font-size: 15.5px; }
.hero-actions { margin-top: 38px; display: flex; gap: 14px; flex-wrap: wrap; }

.spec-row {
    margin-top: 62px;
    display: flex;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.spec {
    flex: 1 1 170px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 0;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .08em;
    color: var(--ink-faint);
    direction: ltr;
}
.spec + .spec { border-inline-start: 1px solid var(--line); padding-inline-start: 18px; }
.spec b { color: var(--ink-dim); font-weight: 500; }


/* Sections
   ========================================================================== */

.section { padding: 72px 0; border-top: 1px solid var(--line); }
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 26px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}
.section h2 { font-weight: 700; font-size: clamp(21px, 3vw, 27px); line-height: 1.6; }
html[lang="en"] .section h2 { line-height: 1.3; }
.section-note { font-size: 13.5px; color: var(--ink-faint); max-width: 40ch; line-height: 2; }

/* Numbered hairline list — services, approach steps */
.item-list { border-top: 1px solid var(--line); }
.item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
    transition: background .2s;
}
.item:hover { background: rgba(242, 242, 239, .014); }
.item-index {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--ember);
    padding-top: 6px;
    direction: ltr;
}
.item-title { font-size: 16px; font-weight: 700; line-height: 1.7; }
.item-kicker {
    display: block;
    margin-top: 8px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .12em;
    color: var(--ink-faint);
    direction: ltr;
}
html[lang="en"] .item-kicker { display: none; }
.item-body { margin-top: 11px; font-size: 14px; line-height: 2.05; color: var(--ink-dim); max-width: 68ch; }
html[lang="en"] .item-body { line-height: 1.75; }

/* Capability tags */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.tag {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    color: var(--ink-dim);
    border: 1px solid var(--line);
    padding: 8px 12px;
    direction: ltr;
    transition: color .15s, border-color .15s;
}
.tag:hover { color: var(--ember); border-color: var(--ember); }

/* Closing call to action */
.cta { padding: 84px 0; border-top: 1px solid var(--line); text-align: center; }
.cta h2 { font-weight: 800; font-size: clamp(24px, 4.2vw, 36px); line-height: 1.55; }
html[lang="en"] .cta h2 { line-height: 1.25; }
.cta .lead { margin: 20px auto 0; max-width: 52ch; }
.cta-actions { margin-top: 34px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }


/* Direct channels (email / telegram)
   ========================================================================== */

.channel-list { display: flex; flex-direction: column; max-width: 400px; margin: 0 auto; }
.channel-list--flush { max-width: none; margin: 0; }
.channel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    text-decoration: none;
    color: var(--ink);
    transition: color .15s;
}
.channel:last-child { border-bottom: 1px solid var(--line); }
.channel:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.channel-left { display: flex; align-items: center; gap: 13px; }
.channel svg { width: 16px; height: 16px; color: var(--ink-dim); flex-shrink: 0; }
.channel-name { font-size: 13.5px; font-weight: 600; }
.channel-value {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
    direction: ltr;
    transition: color .15s;
}
.channel:hover .channel-value { color: var(--ember); }
.channel-arrow { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); direction: ltr; }
html[lang="en"] .channel-arrow { transform: scaleX(-1); }


/* Page head (contact / status pages)
   ========================================================================== */

.page-head { padding: 58px 0 6px; }
.page-head h1 { font-weight: 800; font-size: clamp(25px, 4.4vw, 38px); line-height: 1.5; }
html[lang="en"] .page-head h1 { line-height: 1.2; }
.page-head .lead { margin-top: 18px; max-width: 58ch; }


/* Forms — Django-rendered, styled like the rest of the site
   ========================================================================== */

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr);
    gap: 64px;
    align-items: start;
    padding: 40px 0 84px;
}
.form-panel { display: flex; flex-direction: column; }

.field { padding: 22px 0 24px; border-top: 1px solid var(--line); }
/* contact.html marks the first/last field itself: CSS :first-of-type cannot be
   used here because .form-actions is a <div> sibling too. */
.field--first { border-top: none; padding-top: 4px; }
.field--last { border-bottom: 1px solid var(--line); }

.field-head { display: flex; align-items: baseline; gap: 11px; margin-bottom: 12px; flex-wrap: wrap; }
.field-index {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .08em;
    color: var(--ember);
    direction: ltr;
}
.field-label { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.8; }
.field-flag {
    margin-inline-start: auto;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .09em;
    color: var(--ink-faint);
    direction: ltr;
}
.field-flag--required { color: var(--ember); }
html[lang="en"] .field-flag { text-transform: uppercase; }

.field-input,
textarea.field-input {
    width: 100%;
    background: rgba(242, 242, 239, .02);
    border: 1px solid var(--line);
    border-radius: 0;
    color: var(--ink);
    font-family: var(--body-font);
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.85;
    padding: var(--control-pad-y) var(--control-pad-x);
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.field-input::placeholder { color: var(--ink-faint); font-weight: 400; opacity: 1; }
.field-input:hover { border-color: #35342b; }
.field-input:focus,
.field-input:focus-visible {
    outline: none;
    border-color: var(--ember);
    background: rgba(242, 242, 239, .035);
    box-shadow: 0 0 0 1px rgba(201, 106, 63, .35);
}
.field-input--ltr {
    direction: ltr;
    text-align: left;
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: .01em;
}
.field-textarea { resize: vertical; min-height: 152px; line-height: 2.05; }
html[lang="en"] .field-textarea { line-height: 1.75; }

.field-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.field-help { font-size: 12px; color: var(--ink-faint); line-height: 1.95; }
.field-counter {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: .08em;
    color: var(--ink-faint);
    direction: ltr;
    white-space: nowrap;
}
.field-counter .counter-value { color: var(--ink-dim); }

.field-error {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin-top: 11px;
    font-size: 12.5px;
    line-height: 1.9;
    color: var(--ember);
}
.field-error::before {
    content: "!";
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 10px;
    line-height: 15px;
    border: 1px solid currentColor;
    padding: 0 4px;
    direction: ltr;
}

.field--invalid .field-input,
.field--invalid .select2-container--thracite .select2-selection--single {
    border-color: var(--ember);
    background: rgba(201, 106, 63, .05);
}
.field--invalid .field-label { color: var(--ember); }

.form-errors {
    border: 1px solid var(--ember);
    background: rgba(201, 106, 63, .06);
    padding: 16px 18px;
    margin-bottom: 26px;
}
.form-errors .form-errors-title {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .1em;
    color: var(--ember);
    margin-bottom: 10px;
    direction: ltr;
}
.form-errors ul { display: flex; flex-direction: column; gap: 6px; }
.form-errors li { font-size: 13px; color: var(--ink); line-height: 1.9; }

.form-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 30px; }
.form-note {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .05em;
    color: var(--ink-faint);
    direction: ltr;
    line-height: 1.9;
}
.form-hint { font-size: 12.5px; color: var(--ink-faint); line-height: 2; max-width: 34ch; }
html[lang="en"] .form-hint { line-height: 1.7; }

/* Django renders the errors; this wrapper only keeps the ids for aria-describedby. */
.field-errors { display: flex; flex-direction: column; gap: 4px; }
.field--invalid .field-errors { margin-top: 0; }

/* Contact page side column */
.form-aside { display: flex; flex-direction: column; padding-top: 6px; }
.aside-block { padding: 24px 0; border-top: 1px solid var(--line); }
.aside-block:first-child { border-top: none; padding-top: 4px; }
.aside-title {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--ink-faint);
    margin-bottom: 18px;
    direction: ltr;
}
.info-list { display: flex; flex-direction: column; }
.info-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}
.info-row:first-child { border-top: 1px solid var(--line-soft); }
.info-key { color: var(--ink-dim); }
.info-val { font-family: var(--mono); font-size: 11px; color: var(--ink); direction: ltr; }
.info-val--auto {
    font-family: var(--body-font);
    font-size: 13px;
    direction: auto;
    unicode-bidi: plaintext;
    text-align: end;
}
.aside-note { font-size: 12.5px; color: var(--ink-faint); line-height: 2; }


/* Confirmation page
   ========================================================================== */

.confirm-wrap { display: flex; align-items: center; }
.confirm { padding: 70px 0; width: 100%; }
.confirm-frame { max-width: 560px; margin: 0 auto; text-align: center; }

.check-badge {
    width: 60px;
    height: 60px;
    border: 1px solid var(--line);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    position: relative;
}
.check-badge::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 1px solid var(--sage);
    opacity: .35;
}
.check-badge svg { width: 24px; height: 24px; stroke: var(--sage); }

.confirm h1 { font-weight: 800; font-size: clamp(24px, 4vw, 34px); line-height: 1.5; }
html[lang="en"] .confirm h1 { line-height: 1.25; }
.confirm .sub {
    font-size: 15px;
    color: var(--ink-dim);
    margin-top: 18px;
    line-height: 1.95;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}
html[lang="en"] .confirm .sub { line-height: 1.7; }

.ref-line {
    margin-top: 28px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-faint);
    letter-spacing: .04em;
    direction: ltr;
}
.ref-line b { color: var(--ink); font-weight: 500; }

.confirm-actions { margin-top: 42px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }


/* Status pages (404 / 500)
   ========================================================================== */

.status { padding: 96px 0; text-align: center; }
.status-code {
    font-family: var(--mono);
    font-size: clamp(46px, 12vw, 96px);
    letter-spacing: .06em;
    color: var(--line);
    direction: ltr;
    line-height: 1;
}
.status h1 { margin-top: 22px; font-weight: 800; font-size: clamp(22px, 3.6vw, 30px); line-height: 1.55; }
html[lang="en"] .status h1 { line-height: 1.25; }
.status .lead { margin: 18px auto 0; max-width: 48ch; }
.status-actions { margin-top: 36px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }


/* Footer
   ========================================================================== */

footer { padding: 48px 0; text-align: center; border-top: 1px solid var(--line); }
footer .meta {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--ink-faint);
    letter-spacing: .06em;
    direction: ltr;
}


/* Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .form-layout { grid-template-columns: 1fr; gap: 44px; }
}

@media (max-width: 820px) {
    nav .frame { padding: 16px 20px; }
    .frame { padding: 0 20px; }
    .confirm-actions { flex-direction: column; align-items: stretch; }
    .btn { text-align: center; }
    .nav-links { gap: 16px; }
    .nav-link--hide-sm { display: none; }
    .spec { flex-basis: 50%; }
    .spec + .spec { border-inline-start: none; padding-inline-start: 0; }
    .spec:nth-child(even) { border-inline-start: 1px solid var(--line); padding-inline-start: 18px; }
}

@media (max-width: 620px) {
    .item { grid-template-columns: 1fr; gap: 6px; }
    .item-index { padding-top: 0; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }
    .form-note { text-align: center; }
    .nav-links .nav-link { font-size: 12.5px; }
    .hero-actions { flex-direction: column; align-items: stretch; }
}


/* Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    canvas#stars { display: none; }
    html { scroll-behavior: auto; }
    * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
