/* onekash: Built in the Open
   Palette: warm near-black with two metallic accents (teal + brass), so no
   single acid pop carries the page. Type: Fraunces (display, scholarly and a
   little quirky), Inter (body), JetBrains Mono (labels/data, the CLI/spec
   voice that runs through the work). */

:root {
  /* Palette tuned to match kashcal.onekash.org's dark mode: teal-tinted
     near-blacks, a bright teal primary (#45c2ad), and a warm gold accent
     (#f4b740). */
  --ink:      #0D1413;
  --ink-2:    #14201E;
  --ink-3:    #1A2A27;
  --line:     rgba(230, 240, 237, 0.09);
  --line-2:   rgba(230, 240, 237, 0.15);

  --fg:       #EEF3F1;
  --fg-2:     #A9B7B2;
  --fg-3:     #7C8B86;

  --teal:     #45C2AD;
  --teal-dim: rgba(69, 194, 173, 0.14);
  --brass:    #F4B740;
  --brass-dim:rgba(244, 183, 64, 0.13);

  --radius:   12px;
  --content:  680px;

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 32px; }

body {
  font-family: var(--sans);
  background: var(--ink);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Faint warm wash at the top, tinted with both accents. */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 70vh;
  background:
    radial-gradient(ellipse 60% 45% at 18% -5%, rgba(69, 194, 173, 0.08), transparent),
    radial-gradient(ellipse 55% 40% at 92% 0%, rgba(244, 183, 64, 0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--teal);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font: 500 0.85rem/1 var(--sans);
  z-index: 100;
}
.skip-link:focus { left: 0; text-decoration: none; }

/* Shell: contents rail + content ------------------------------------------ */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 72px 28px 0;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 72px;
  padding-top: 4px;
}
.toc__label {
  font: 500 0.7rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg-3);
  margin-bottom: 16px;
}
.toc__list { list-style: none; }
.toc__list li { margin-bottom: 4px; }
.toc__list a {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.9rem;
  color: var(--fg-3);
  border-left: 2px solid transparent;
  padding-left: 14px;
  margin-left: -16px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.toc__list a:hover { color: var(--fg-2); text-decoration: none; }
.toc__num {
  font: 500 0.82rem/1.5 var(--mono);
  color: var(--fg-3);
  transition: color 0.2s ease;
}
.toc__list a[aria-current="true"] {
  color: var(--fg);
  border-left-color: var(--teal);
}
.toc__list a[aria-current="true"] .toc__num { color: var(--teal); }

.content { min-width: 0; padding: 4px 0 24px; }

/* Entry groups ------------------------------------------------------------- */
.entry-group { padding: 40px 0; }
.entry-group:first-child { padding-top: 0; }
.entry-group__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 26px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.entry-group__num {
  font: 500 0.95rem/1 var(--mono);
  color: var(--teal);
}
.entry-group__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* Cards -------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
/* Left keyline that lights up on hover: a small, consistent signal. */
.card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--teal);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover {
  border-color: var(--line-2);
  background: var(--ink-3);
  transform: translateY(-2px);
  text-decoration: none;
}
.card:hover::before { transform: scaleY(1); }

.card__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.card__name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.card__kicker {
  flex-shrink: 0;
  font: 500 0.66rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brass);
  background: var(--brass-dim);
  padding: 4px 8px;
  border-radius: 5px;
}
.card__desc {
  color: var(--fg-2);
  font-size: 0.92rem;
  line-height: 1.62;
  flex: 1;
  margin-bottom: 18px;
}

/* Featured research card: gold instead of teal, and roomier. */
.card--featured {
  padding: 28px;
  border-color: rgba(244, 183, 64, 0.2);
  background:
    linear-gradient(180deg, rgba(244, 183, 64, 0.05), transparent 60%),
    var(--ink-2);
}
.card--featured::before { background: var(--brass); transform: scaleY(1); }
.card--featured:hover { border-color: rgba(244, 183, 64, 0.4); }
.card--featured .card__name { font-size: 1.5rem; }
.card--featured .card__desc { font-size: 1rem; max-width: 42em; }

/* Flagship tool card: spans the grid, teal-accented, roomier. */
.card--flagship {
  grid-column: 1 / -1;
  padding: 28px;
  border-color: rgba(69, 194, 173, 0.22);
  background:
    linear-gradient(180deg, rgba(69, 194, 173, 0.05), transparent 60%),
    var(--ink-2);
}
.card--flagship::before { background: var(--teal); transform: scaleY(1); }
.card--flagship:hover { border-color: rgba(69, 194, 173, 0.4); }
.card--flagship .card__name { font-size: 1.5rem; }
.card--flagship .card__desc { font-size: 1rem; max-width: 52em; }
.card--flagship .card__desc code {
  font: 500 0.85em/1 var(--mono);
  background: rgba(69, 194, 173, 0.1);
  color: var(--teal);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Meta + tags -------------------------------------------------------------- */
.card__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(230, 240, 237, 0.03);
  border: 1px solid var(--line);
  font: 500 0.72rem/1.5 var(--mono);
  color: var(--fg-2);
}
/* `display` on .tag would otherwise defeat the [hidden] attribute the star
   tags rely on until a count loads, so restore it explicitly. */
.tag[hidden] { display: none; }

.tag--lang::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.tag--ts::before     { background: #3178c6; }
.tag--kotlin::before { background: #A97BFF; }
.tag--shell::before  { background: #89e051; }
.tag--python::before { background: #3572A5; }
.tag--swift::before  { background: #F05138; }

.tag--stars  { color: var(--brass); border-color: rgba(244, 183, 64, 0.24); }
.tag--doi    { color: #6b9edd; border-color: rgba(107, 158, 221, 0.28); }
.tag--ietf   { color: #d4915a; border-color: rgba(212, 145, 90, 0.28); }
.tag--source { color: var(--fg-2); }

/* Footer ------------------------------------------------------------------- */
.footer {
  margin-top: 40px;
  padding: 40px 0 64px;
  border-top: 1px solid var(--line);
  color: var(--fg-3);
}
.footer__note {
  font: 500 0.82rem/1 var(--mono);
  color: var(--fg-3);
}
.footer__slash { color: var(--teal); margin-right: 6px; }
.footer__note a { color: var(--fg-3); }
.footer__note a:hover { color: var(--fg); text-decoration: none; }

/* Motion: one quiet page-load reveal, staggered down the content column. */
@media (prefers-reduced-motion: no-preference) {
  .entry-group, .footer {
    animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  #s1            { animation-delay: 0.04s; }
  #s2            { animation-delay: 0.12s; }
  #s3            { animation-delay: 0.20s; }
  .footer        { animation-delay: 0.28s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Focus visibility (quality floor) ---------------------------------------- */
a:focus-visible, .card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Responsive --------------------------------------------------------------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; gap: 0; padding-top: 56px; }
  .toc { display: none; }
}

@media (max-width: 560px) {
  .shell { padding: 44px 20px 0; }
  .project-grid { grid-template-columns: 1fr; }
  .card--featured { padding: 22px; }
  .card--featured .card__name { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
