/* kerimbal.com — hand-written CSS, no build step, no dependencies. */

:root {
  color-scheme: light;

  --bg: #fbfbfa;
  --bg-soft: #ffffff;
  --bg-sunk: #f3f2ef;
  --line: #e3e1dc;
  --line-strong: #cfccc4;
  --fg: #1b1a17;
  --fg-muted: #6b6862;
  --fg-dim: #97938b;
  --accent: #b3521f;
  --accent-soft: rgba(179, 82, 31, .10);
  --grid: rgba(27, 26, 23, .045);
  --shadow: 0 1px 2px rgba(27, 26, 23, .05), 0 12px 32px -18px rgba(27, 26, 23, .28);

  --code-k: #9b3fa8;
  --code-t: #1f6f8b;
  --code-s: #2f7d3a;
  --code-c: #97938b;

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

  --radius: 14px;
  --wrap: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d10;
    --bg-soft: #12151a;
    --bg-sunk: #0f1216;
    --line: #222831;
    --line-strong: #303845;
    --fg: #e9ecf1;
    --fg-muted: #9aa3b1;
    --fg-dim: #6c7684;
    --accent: #f0803c;
    --accent-soft: rgba(240, 128, 60, .12);
    --grid: rgba(233, 236, 241, .05);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 44px -22px rgba(0, 0, 0, .8);
    --code-k: #d18bff;
    --code-t: #6fd3e8;
    --code-s: #9ede8b;
    --code-c: #6c7684;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-soft: #12151a;
  --bg-sunk: #0f1216;
  --line: #222831;
  --line-strong: #303845;
  --fg: #e9ecf1;
  --fg-muted: #9aa3b1;
  --fg-dim: #6c7684;
  --accent: #f0803c;
  --accent-soft: rgba(240, 128, 60, .12);
  --grid: rgba(233, 236, 241, .05);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 44px -22px rgba(0, 0, 0, .8);
  --code-k: #d18bff;
  --code-t: #6fd3e8;
  --code-s: #9ede8b;
  --code-c: #6c7684;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip; /* the hero glow bleeds slightly; clip keeps sticky working */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

code { font-family: var(--mono); font-size: .92em; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: .6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 50;
}
.skip:focus { left: 0; }

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 78%);
  pointer-events: none;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: .9rem clamp(1.1rem, 4vw, 2rem);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
}
.site-header.stuck { border-bottom-color: var(--line); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 700;
}
.brand-text { font-size: .95rem; }
.dim { color: var(--fg-dim); }

.nav {
  display: flex;
  gap: 1.35rem;
  margin-left: auto;
  font-size: .9rem;
}
.nav a {
  color: var(--fg-muted);
  text-decoration: none;
  padding: .2rem 0;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav a:hover { color: var(--fg); border-bottom-color: var(--accent); }

.controls { display: flex; gap: .45rem; margin-left: 1rem; }
.ctl {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, transform .15s ease;
}
.ctl:hover { color: var(--fg); border-color: var(--line-strong); transform: translateY(-1px); }
.ctl svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

@media (max-width: 640px) {
  .nav { display: none; }
  .controls { margin-left: auto; }
}

/* ---------- layout ---------- */

main { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(1.1rem, 4vw, 2rem); }

.section { padding: clamp(3.5rem, 8vw, 6rem) 0; border-top: 1px solid var(--line); }

.h2 {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  margin: 0 0 .6rem;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  letter-spacing: -.02em;
}
.idx {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .05em;
}
.section-lead {
  margin: 0 0 2rem;
  color: var(--fg-muted);
  max-width: 60ch;
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 1.4rem;
  padding: .3rem .75rem .3rem .6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--fg-muted);
  letter-spacing: .01em;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2f9e5e;
  box-shadow: 0 0 0 3px rgba(47, 158, 94, .18);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  font-weight: 640;
}
.role {
  margin: .5rem 0 1.25rem;
  font-family: var(--mono);
  font-size: clamp(.92rem, 2vw, 1.02rem);
  color: var(--accent);
  letter-spacing: -.01em;
}
.lead {
  margin: 0 0 2rem;
  max-width: 48ch;
  color: var(--fg-muted);
  font-size: 1.03rem;
}

.cta { display: flex; flex-wrap: wrap; gap: .65rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--fg);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.btn svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn svg.fill { fill: currentColor; stroke: none; }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ---------- code window ---------- */

.hero-visual { position: relative; }
.glow {
  position: absolute;
  inset: 12% 0 -10% 8%;
  z-index: -1;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 72%);
  filter: blur(12px);
}
.window {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: perspective(1200px) rotateY(-4deg) rotateX(1.5deg);
  transition: transform .35s ease;
}
.window:hover { transform: perspective(1200px) rotateY(0) rotateX(0); }
.window-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-sunk);
}
.wdot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.wdot.r { background: #e06a5c; }
.wdot.y { background: #e3b341; }
.wdot.g { background: #57ab5a; }
.window-title {
  margin-left: .5rem;
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--fg-dim);
}
.code {
  margin: 0;
  padding: 1.1rem 1.2rem 1.3rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.75;
  color: var(--fg-muted);
  tab-size: 4;
}
.c-k { color: var(--code-k); }
.c-t { color: var(--code-t); }
.c-s { color: var(--code-s); }
.c-cm { color: var(--code-c); font-style: italic; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .window { transform: none; }
}

/* ---------- about ---------- */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr);
  gap: clamp(1.6rem, 4vw, 3rem);
  align-items: start;
}
.prose p { margin: 0 0 1.1rem; color: var(--fg-muted); max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }
.prose code {
  padding: .12em .4em;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
}

.facts {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}
.facts li {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .85rem 1.05rem;
  border-bottom: 1px solid var(--line);
}
.facts li:last-child { border-bottom: 0; }
.facts .k {
  font-family: var(--mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--fg-dim);
}
.facts .v { font-size: .92rem; }

@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- stack ---------- */

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .9rem;
}
.stack-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  transition: border-color .15s ease, transform .15s ease;
}
.stack-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.stack-card h3 {
  margin: 0 0 .7rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}
.chips { display: flex; flex-wrap: wrap; gap: .38rem; }
.chip {
  padding: .18rem .55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-sunk);
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--fg-muted);
}

/* ---------- project cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.card h3 { margin: 0; font-size: 1rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--fg-muted); font-size: .89rem; }
.card-meta {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-top: auto;
  padding-top: .5rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--fg-dim);
}
.lang-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: .35rem; vertical-align: middle; }
.tag {
  padding: .1rem .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--fg-dim);
  white-space: nowrap;
}
.card.soon { border-style: dashed; background: transparent; }
.card.soon:hover { transform: none; }

.more { margin: 1.6rem 0 0; }
.link-arrow {
  font-size: .9rem;
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: color .15s ease;
}
.link-arrow:hover { color: var(--accent); }

/* ---------- contact ---------- */

.contact-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .9rem;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: 1.05rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cc-k {
  font-family: var(--mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--fg-dim);
}
.cc-v { font-size: .95rem; overflow-wrap: anywhere; }

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2rem clamp(1.1rem, 4vw, 2rem) 3rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--fg-dim);
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--fg-muted); text-decoration: none; border-bottom: 1px solid var(--line); }
.site-footer a:hover { color: var(--accent); }

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

/* entrance */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }

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

.nf {
  display: grid;
  place-items: center;
  min-height: 78vh;
  text-align: center;
  gap: .4rem;
}
.nf .code404 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(3rem, 12vw, 6rem);
  letter-spacing: -.04em;
}
.nf p { margin: 0 0 1.4rem; color: var(--fg-muted); }
