/* ==========================================================================
   moesmufti.dev — double-entry bookkeeping as a terminal-minimal page
   ========================================================================== */

/* ---- Fonts (self-hosted, latin subset) ---- */

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/newsreader-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/newsreader-400-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
  color-scheme: dark;
  --bg: #0B0F0D;
  --surface: #121814;
  --text: #E6ECE7;
  --muted: #8FA096;
  --faint: #5C6A61;
  --line: #1E2A22;
  --credit: #7FD99A;
  --debit: #E08573;

  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
}

/* Light scheme — the accountant's pale-green columnar pad: green-tinted
   paper, ink-dark text, deeper posting inks. The two blocks below (system
   preference / manual override) must stay identical. */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F0F3EC;
    --surface: #E6ECE0;
    --text: #1A231D;
    --muted: #4E5D54;
    --faint: #75827A;
    --line: #D5DDD0;
    --credit: #1C6F40;
    --debit: #A8432C;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F0F3EC;
  --surface: #E6ECE0;
  --text: #1A231D;
  --muted: #4E5D54;
  --faint: #75827A;
  --line: #D5DDD0;
  --credit: #1C6F40;
  --debit: #A8432C;
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: hidden;
}

h1, h2, h3, p, dl, dd {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

/* ---- Layout ---- */

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem;
}

section {
  margin-top: 4.5rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.site-header .brand {
  color: var(--text);
  font-weight: 500;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--credit);
}

.theme-toggle {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--credit);
}

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

.hero {
  margin-top: 3rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.journal {
  position: relative;
}

.entry {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.entry-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 14px;
  opacity: 1;
}

.entry-marker {
  flex: none;
  width: 1.6rem;
  font-weight: 600;
}

.entry-marker.dr {
  color: var(--debit);
}

.entry-marker.cr {
  color: var(--credit);
}

.entry-body {
  display: flex;
  align-items: baseline;
  flex: 1;
  min-width: 0;
  gap: 0.5rem;
}

.entry-body.indent {
  margin-left: 1.75rem;
}

.entry-account {
  color: var(--text);
  white-space: nowrap;
}

.entry-leader {
  flex: 1;
  min-width: 8px;
  border-bottom: 1px dotted var(--faint);
  margin-bottom: 0.35em;
}

.entry-amount {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stamp {
  position: absolute;
  top: -0.9rem;
  right: 0;
  border: 1.5px solid var(--credit);
  color: var(--credit);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 2px;
  opacity: 0.85;
  transform: rotate(-4deg) scale(1);
  background: var(--bg);
}

.memo {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.65;
  color: var(--muted);
  margin-top: 1.5rem;
}

.intro {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--text);
  margin-top: 2rem;
}

/* ---- Hero load-in animation ---- */

@keyframes entry-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: rotate(-4deg) scale(1.15);
  }
  70% {
    opacity: 0.85;
    transform: rotate(-4deg) scale(0.97);
  }
  100% {
    opacity: 0.85;
    transform: rotate(-4deg) scale(1);
  }
}

/* Final states live in the base styles; keyframes animate FROM invisible
   with `backwards` fill so a skipped animation can never leave content hidden. */
html.js-anim .entry-line {
  animation: entry-in 0.4s ease-out backwards;
}

html.js-anim .entry-line:nth-child(2) {
  animation-delay: 0.15s;
}

html.js-anim .entry-line.entry-cr {
  animation-delay: 0.3s;
}

html.js-anim .stamp {
  animation: stamp-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s backwards;
}

@media (prefers-reduced-motion: reduce) {
  html.js-anim .entry-line,
  html.js-anim .stamp {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ---- NOW ---- */

.now-row + .now-row {
  margin-top: 1.5rem;
}

.now-role {
  font-size: 14px;
  color: var(--text);
}

.now-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 0.3rem;
}

.now a {
  color: var(--credit);
}

.now a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- WORK ---- */

.project {
  border: none;
}

.project + .project {
  margin-top: 0.25rem;
}

.project-summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 2px;
}

.project-summary::-webkit-details-marker {
  display: none;
}

.project-summary::marker {
  content: '';
}

.project-summary:hover,
.project-summary:focus-visible {
  background: var(--surface);
}

.project-summary:hover .project-name,
.project-summary:focus-visible .project-name {
  text-decoration: underline;
  text-decoration-color: var(--credit);
  text-underline-offset: 3px;
}

.project-name {
  flex: none;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
}

.project-desc {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.project-live {
  flex: none;
  color: var(--credit);
  font-size: 13px;
}

.chevron {
  flex: none;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  transition: transform 0.2s ease;
}

details[open] .chevron {
  transform: rotate(45deg);
}

.project-detail-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

details:not([open]) > .project-detail-wrap {
  display: grid;
}

details[open] > .project-detail-wrap {
  grid-template-rows: 1fr;
}

.project-detail-inner {
  overflow: hidden;
}

.project-detail {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  padding: 0 0.5rem 1rem;
}

.project-links {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.project-links a {
  color: var(--credit);
}

.project-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-links .no-link {
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .project-detail-wrap {
    transition: none;
  }
  .chevron {
    transition: none;
  }
}

/* ---- CAREER ---- */

.career-list {
  display: flex;
  flex-direction: column;
}

.career-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.4rem 0;
  font-size: 14px;
}

.career-years {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.career-detail {
  color: var(--muted);
}

.career-company {
  color: var(--text);
  font-weight: 500;
  margin-right: 0.5rem;
}

.career-note {
  margin-top: 1.25rem;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .career-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding: 0.6rem 0;
  }
}

/* ---- CONTACT ---- */

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  font-size: 14px;
}

.contact-links a {
  color: var(--credit);
}

.contact-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.site-footer {
  margin-top: 6rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.site-footer .mustafa {
  color: var(--debit);
}

.site-footer .moes {
  color: var(--credit);
}

/* ---- Responsive: narrow screens ---- */

@media (max-width: 400px) {
  .wrap {
    padding: 1.25rem;
  }

  .entry-leader {
    display: none;
  }
}
