/* ---------------------------------------------------------------------------
   DrobyshevDev - organisation site
   One stylesheet, no build step, no external requests.
   Palette: neutral surfaces + a single indigo accent, light and dark.
--------------------------------------------------------------------------- */

/* --- Reset ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body,
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; padding: 0; }

ul[role="list"], ol[role="list"] { list-style: none; }

img, svg { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

/* --- Tokens --------------------------------------------------------------- */

:root {
  --bg:            #ffffff;
  --bg-sunken:     #f6f7f9;
  --surface:       #ffffff;
  --surface-alt:   #f6f7f9;
  --border:        #e4e7ec;
  --border-strong: #d3d8e0;
  --text:          #0d1117;
  --text-muted:    #5a6472;
  --text-faint:    #6b7480;  /* 4.7:1 on --bg: small labels still have to pass AA */
  --accent:        #4f46e5;
  --accent-hover:  #4338ca;
  --accent-soft:   #eef0fe;
  --accent-text:   #3b34c4;
  --code-bg:       #0d1117;
  --code-text:     #e6e9ef;
  --code-comment:  #7d8899;
  --shadow-sm:     0 1px 2px rgba(13, 17, 23, .05);
  --shadow-md:     0 4px 16px -4px rgba(13, 17, 23, .09);
  --header-bg:     rgba(255, 255, 255, .82);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --measure: 1120px;
  --radius:  10px;
  --radius-lg: 16px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0b0e14;
    --bg-sunken:     #0e121a;
    --surface:       #12161f;
    --surface-alt:   #161b26;
    --border:        #222836;
    --border-strong: #2f3747;
    --text:          #e6e9ef;
    --text-muted:    #9aa4b2;
    --text-faint:    #7c8697;
    --accent:        #818cf8;
    --accent-hover:  #a5b0ff;
    --accent-soft:   #191d33;
    --accent-text:   #a5b0ff;
    --code-bg:       #080b11;
    --code-text:     #e6e9ef;
    --code-comment:  #7c8697;
    --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:     0 4px 20px -6px rgba(0, 0, 0, .6);
    --header-bg:     rgba(11, 14, 20, .82);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:            #0b0e14;
  --bg-sunken:     #0e121a;
  --surface:       #12161f;
  --surface-alt:   #161b26;
  --border:        #222836;
  --border-strong: #2f3747;
  --text:          #e6e9ef;
  --text-muted:    #9aa4b2;
  --text-faint:    #7c8697;
  --accent:        #818cf8;
  --accent-hover:  #a5b0ff;
  --accent-soft:   #191d33;
  --accent-text:   #a5b0ff;
  --code-bg:       #080b11;
  --code-text:     #e6e9ef;
  --code-comment:  #7c8697;
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md:     0 4px 20px -6px rgba(0, 0, 0, .6);
  --header-bg:     rgba(11, 14, 20, .82);

  color-scheme: dark;
}

/* --- Base ----------------------------------------------------------------- */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

code, kbd, samp, pre { font-family: var(--font-mono); font-size: .875em; }

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -.022em;
  font-weight: 640;
  color: var(--text);
  text-wrap: balance;
}

h1 { font-size: clamp(2.15rem, 1.35rem + 3.4vw, 3.65rem); letter-spacing: -.033em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); letter-spacing: -.028em; }
h3 { font-size: 1.16rem; letter-spacing: -.015em; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 62ch;
  text-wrap: pretty;
}

.section-intro { max-width: 64ch; margin-bottom: 48px; }
.section-intro h2 { margin-bottom: 14px; }
.section-intro p { color: var(--text-muted); text-wrap: pretty; }

/* --- Header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -.02em;
  font-size: 1rem;
  margin-right: 8px;
  flex: none;
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; flex: none; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: 7px 11px;
  border-radius: 7px;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-alt); text-decoration: none; }

.nav .ext::after {
  content: "\2197";
  font-size: .78em;
  margin-left: 3px;
  opacity: .55;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  flex: none;
}

.lang-switch {
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .04em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 9px;
  background: var(--surface);
}
.lang-switch:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }

.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.nav-toggle { display: none; }

@media (max-width: 900px) {
  .nav {
    position: fixed;
    inset: 60px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
    box-shadow: var(--shadow-md);
    display: none;
  }
  .nav[data-open="true"] { display: flex; }
  .nav a { padding: 11px 8px; font-size: 1rem; }
  .nav-toggle { display: inline-grid; }
  .nav-tools { margin-left: auto; }
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .94rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-alt); }

.btn svg { width: 16px; height: 16px; flex: none; }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(56px, 8vw, 104px) 0 clamp(48px, 6vw, 80px);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 520px;
  background:
    radial-gradient(50% 60% at 22% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(40% 50% at 82% 10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero h1 { margin: 18px 0 20px; }
.hero .lead { margin-bottom: 32px; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: .85rem;
  color: var(--text-faint);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta svg { width: 14px; height: 14px; opacity: .8; }

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

/* --- Terminal ------------------------------------------------------------- */

.terminal {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.terminal-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #343b48;
  display: block;
}
.terminal-bar .title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--code-comment);
  letter-spacing: .02em;
}

.terminal-body {
  padding: 18px 16px 20px;
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.85;
  color: var(--code-text);
  overflow-x: auto;
}
.terminal-body .c { color: var(--code-comment); }
.terminal-body .p { color: #818cf8; user-select: none; }
.terminal-body .s { color: #7ee2b8; }
.terminal-body div { white-space: pre; }
.terminal-body div + .c { margin-top: 12px; }

/* --- Stat strip ----------------------------------------------------------- */

.stats {
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}

/* The grid draws its own side borders, so it sits flush inside the measure. */
.stats .wrap { padding-inline: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border-inline: 1px solid var(--border);
}

.stat {
  background: var(--bg-sunken);
  padding: 26px 20px;
  text-align: center;
}
.stat dt {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 600;
  margin-top: 5px;
}
.stat dd {
  font-size: 1.6rem;
  font-weight: 660;
  letter-spacing: -.03em;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:last-child { grid-column: 1 / -1; }
}

/* --- Sections ------------------------------------------------------------- */

section { scroll-margin-top: 76px; }

.band { padding: clamp(64px, 8vw, 104px) 0; }
.band-alt { background: var(--bg-sunken); border-block: 1px solid var(--border); }

/* --- Project cards -------------------------------------------------------- */

.projects { display: grid; gap: 20px; }

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  gap: clamp(24px, 4vw, 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 3vw, 34px);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s, box-shadow .18s;
}
.project:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.project-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 6px;
}
.project-head h3 {
  font-family: var(--font-mono);
  font-size: 1.32rem;
  font-weight: 620;
  letter-spacing: -.02em;
}
.project-head h3 a { color: var(--text); }
.project-head h3 a:hover { color: var(--accent-text); text-decoration: none; }

.project-tag {
  font-size: .92rem;
  color: var(--text-muted);
}

.project p { color: var(--text-muted); margin: 14px 0 18px; text-wrap: pretty; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.chip {
  font-size: .74rem;
  font-weight: 550;
  letter-spacing: .01em;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
}
.chip-accent {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

.project-links { display: flex; flex-wrap: wrap; gap: 8px; }
.project-links a {
  font-size: .85rem;
  font-weight: 560;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.project-links a:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.project-links a.primary { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 34%, transparent); background: var(--accent-soft); }

.project-aside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.snippet {
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 14px 15px;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.8;
  color: var(--code-text);
  overflow-x: auto;
  position: relative;
}
.snippet div { white-space: pre; }
.snippet .p { color: #818cf8; user-select: none; }
.snippet .c { color: var(--code-comment); }

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  color: #9aa4b2;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.snippet:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
/* There is no hover on a touch screen, so the button has to stay visible. */
@media (hover: none) { .copy-btn { opacity: .75; } }
.copy-btn:hover { color: #e6e9ef; }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn[data-copied="true"] { color: #7ee2b8; opacity: 1; }

.facts {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 13px;
  font-size: .82rem;
  border-bottom: 1px solid var(--border);
}
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--text-faint); }
.facts dd { margin: 0; font-weight: 560; font-variant-numeric: tabular-nums; text-align: right; }

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

/* --- Feature columns ------------------------------------------------------ */

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
}
.col .ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  margin-bottom: 16px;
}
.col .ico svg { width: 18px; height: 18px; }
.col h3 { margin-bottom: 9px; }
.col p { color: var(--text-muted); font-size: .94rem; text-wrap: pretty; }

/* --- Principles ----------------------------------------------------------- */

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.principle {
  background: var(--bg);
  padding: 28px 26px;
}
.principle .num {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--accent-text);
  font-weight: 600;
  letter-spacing: .06em;
  display: block;
  margin-bottom: 12px;
}
.principle h3 { margin-bottom: 9px; }
.principle p { color: var(--text-muted); font-size: .94rem; text-wrap: pretty; }
.principle code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .84em;
  color: var(--text);
  word-break: break-all;
}

.band-alt .principle { background: var(--bg-sunken); }

/* --- CTA band ------------------------------------------------------------- */

.cta {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(32px, 5vw, 56px);
  background:
    radial-gradient(70% 130% at 12% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 72%),
    var(--surface);
  text-align: center;
}
.cta h2 { margin-bottom: 14px; }
.cta p { color: var(--text-muted); max-width: 56ch; margin: 0 auto 28px; text-wrap: pretty; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* --- Contact list --------------------------------------------------------- */

.contact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.contact-list div {
  border-top: 2px solid var(--border-strong);
  padding-top: 16px;
}
.contact-list dt {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 6px;
}
.contact-list dd { margin: 0; font-size: .94rem; color: var(--text-muted); text-wrap: pretty; }

/* --- Legal pages ---------------------------------------------------------- */

/* A legal document is read in one pass and referenced by clause number, so it
   gets a narrower measure and clearly separated sections rather than cards. */
.legal {
  padding-top: 36px;
  margin-top: 36px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 76px;
}
.legal:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }

.legal h2 { margin-bottom: 22px; }
.legal h3 {
  margin: 30px 0 10px;
  font-size: 1rem;
  color: var(--text);
}
.legal p {
  color: var(--text-muted);
  font-size: .94rem;
  line-height: 1.7;
  max-width: 68ch;
  margin-bottom: 12px;
  text-wrap: pretty;
}
.legal strong { color: var(--text); font-weight: 600; }
.legal code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .85em;
  color: var(--text);
  word-break: break-word;
}

/* The section index at the top of the document. */
a.chip { transition: border-color .15s, color .15s; }
a.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-text); }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 56px 0 32px;
  font-size: .9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 40px 24px;
  padding-bottom: 40px;
}

.footer-brand p {
  color: var(--text-muted);
  max-width: 34ch;
  margin-top: 14px;
  font-size: .88rem;
  text-wrap: pretty;
}

.footer-col h4 {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 650;
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: grid; gap: 9px; }
.footer-col a { color: var(--text-muted); font-size: .89rem; }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  align-items: center;
  color: var(--text-faint);
  font-size: .84rem;
}
.footer-bottom p { text-wrap: pretty; }

@media (max-width: 800px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

/* --- 404 ------------------------------------------------------------------ */

.notfound {
  min-height: 62vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 18px;
  padding: 80px 24px;
}
.notfound .code {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--accent-text);
  letter-spacing: .1em;
}

/* --- Motion --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header, .nav-tools, .hero::before, .copy-btn { display: none !important; }
  body { background: #fff; color: #000; }
}
