/* ============================================================
   MANI RASH AHMADI — editorial redesign
   Two voices: Martina Plantijn (prose) + TX-02 mono (annotation).
   Warm paper, ink, one signal-orange accent.
   ============================================================ */

/* ---------- Fonts ---------- */

@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-Light-BF663c36d1dbbe7.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-LightItalic-BF663c36d1eacde.otf') format('opentype');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-Regular-BF663c36d1ec6d5.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-Italic-BF663c36d1ed0f9.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-Medium-BF663c36d1e5bed.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-MediumItalic-BF663c36d1ec71f.otf') format('opentype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Martina';
  src: url('../assets/fonts/TestMartinaPlantijn-Bold-BF663c36d1d4676.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'TX-02';
  src: url('../assets/fonts/new-fonts/TX-02-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Perfectly Nineties';
  src: url('../assets/fonts/new-fonts/PerfectlyNineties-Light.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Perfectly Nineties';
  src: url('../assets/fonts/new-fonts/PerfectlyNineties-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --paper: #f6f3ec;
  --paper-raised: #fbf9f4;
  --ink: #1c1914;
  --ink-soft: #4c463c;
  --muted: #837a6a;
  --hairline: #ddd5c5;
  --hairline-strong: #c8bfab;
  --accent: #cc4514;
  --accent-soft: rgba(204, 69, 20, 0.09);
  --code-bg: #ece7db;
  --grid-line: rgba(28, 25, 20, 0.04);

  --serif: 'Martina', 'Iowan Old Style', Georgia, serif;
  --mono: 'TX-02', ui-monospace, 'SF Mono', Menlo, monospace;

  --col: 41rem;
  --pad: 1.5rem;
}

html.dark {
  --paper: #16140f;
  --paper-raised: #1e1b15;
  --ink: #e9e4d8;
  --ink-soft: #beb6a5;
  --muted: #8d8471;
  --hairline: #2f2b21;
  --hairline-strong: #453f30;
  --accent: #ff6a35;
  --accent-soft: rgba(255, 106, 53, 0.12);
  --code-bg: #211e17;
  --grid-line: rgba(233, 228, 216, 0.035);
}

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

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  /* engineering graph paper, barely there */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.075rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 var(--pad);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* ---------- Mono annotation voice ---------- */

.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 550;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.label .idx {
  color: var(--accent);
  margin-right: 0.5em;
}

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

.site-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.25rem 0 0;
}

.site-head .wordmark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.site-head .wordmark .tilde {
  color: var(--accent);
}

.site-logo {
  width: 30px;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}

.wordmark:hover .site-logo {
  transform: rotate(180deg);
}

html.dark .site-logo {
  filter: invert(1);
  opacity: 0.9;
}

.site-nav .resume-link {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.3rem 0.55rem;
}

.site-nav .resume-link:hover {
  background: var(--accent);
  color: var(--paper);
}

.site-nav {
  display: flex;
  align-items: baseline;
  gap: 1.4rem;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 480;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

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

.site-nav a.active {
  color: var(--ink);
}

.site-nav a.active::before {
  content: '*';
  color: var(--accent);
  margin-right: 0.2em;
}

.theme-toggle {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.3s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  transform: rotate(180deg);
}

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

.hero {
  padding: 4.5rem 0 3rem;
}

.hero .label {
  margin-bottom: 1.6rem;
}

.hero h1 {
  font-family: 'Perfectly Nineties', var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 6.5vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 1.4rem;
}

.hero .statement {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.8vw, 1.55rem);
  line-height: 1.4;
  margin: 0 0 1.1rem;
}

.hero .statement em {
  font-style: italic;
  color: var(--accent);
}

.hero .cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--accent);
  vertical-align: -0.12em;
  margin-left: 0.12em;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero .subline {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 32rem;
  margin: 0;
}

/* ascii plate — a figure, like in a paper */

.plate {
  padding: 1.5rem 0 2.75rem;
}

.plate .ascii-pane {
  user-select: none;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

.plate pre.ascii {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  overflow: hidden;
  font-family: var(--mono);
  font-size: clamp(4.5px, 1.35vw, 8.5px);
  line-height: 1.08;
  letter-spacing: 0;
  color: var(--muted);
  opacity: 0.9;
}

.plate figcaption {
  margin-top: 1.4rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 480;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.plate figcaption .idx {
  color: var(--accent);
}

/* currently strip */

.currently {
  margin-top: 2.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  gap: 1.1rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.currently .label {
  flex-shrink: 0;
}

.currently ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
}

.currently li {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 480;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.currently li strong {
  font-weight: 650;
  color: var(--ink);
}

.currently li::before {
  content: '▸ ';
  color: var(--accent);
}

/* ---------- Stats strip ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.stats .stat {
  padding: 1.5rem 1.25rem 1.4rem 0;
}

.stats .stat + .stat {
  padding-left: 1.25rem;
  border-left: 1px solid var(--hairline);
}

.stats .num {
  display: block;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stats .num sup {
  font-size: 0.55em;
  color: var(--accent);
}

.stats .cap {
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 480;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.6;
  color: var(--muted);
}

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

.section {
  padding: 3.25rem 0;
  border-top: 1px solid var(--hairline);
}

.section > .label {
  margin-bottom: 1.9rem;
}

/* now list */

.now-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.now-list li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.6rem;
  color: var(--ink-soft);
}

.now-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent);
}

.now-list strong {
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Index rows (work / projects / posts) ---------- */

.index-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.index-row {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  gap: 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  color: inherit;
}

.index-row:first-child {
  border-top: 1px solid var(--hairline);
}

.index-row .when {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 480;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-top: 0.4rem;
  white-space: nowrap;
}

.index-row .what h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0 0 0.2rem;
  line-height: 1.3;
  transition: color 0.15s ease;
}

.index-row .what p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

a.index-row:hover .what h3 {
  color: var(--accent);
}

a.index-row:hover .when {
  color: var(--accent);
}

.index-row .metric {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.index-row .metric::before {
  content: '↳ ';
}

/* post rows: title runs into an italic subtitle — "Real Value comes with a half life" */

.index-row .what h3 .sub {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
}

a.index-row:hover .what h3 .sub {
  color: var(--accent);
}

.index-row .what .post-tags {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 480;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.index-row .what .post-tags .tag {
  margin-right: 0.9rem;
}

.index-row .flag {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 2px;
  padding: 0.15rem 0.4rem;
  margin-left: 0.55rem;
  vertical-align: 0.15em;
  white-space: nowrap;
}

.see-all {
  display: inline-block;
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
}

.see-all:hover {
  color: var(--accent);
}

/* ---------- Experience (work page) ---------- */

.xp-item {
  display: grid;
  grid-template-columns: 5.25rem 1fr;
  gap: 1.25rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--hairline);
}

.xp-item:first-of-type {
  border-top: 1px solid var(--hairline);
}

.xp-when {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 480;
  line-height: 1.7;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-top: 0.35rem;
}

.xp-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0;
  line-height: 1.3;
}

.xp-body .company {
  font-style: italic;
  color: var(--accent);
  font-size: 1rem;
  margin: 0.1rem 0 0.65rem;
}

.xp-body p.desc {
  margin: 0 0 0.8rem;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.tags span {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 480;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.tags span::before {
  content: '#';
  color: var(--hairline-strong);
  margin-right: 0.1em;
}

.aside-note {
  margin-top: 2rem;
  font-style: italic;
  color: var(--muted);
  font-size: 0.98rem;
}

.job-cycler {
  color: var(--accent);
  cursor: pointer;
  border-bottom: 1px dashed var(--accent);
}

/* ---------- Prose (about, posts) ---------- */

.prose h1,
article > h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 4rem 0 1.75rem;
}

.prose h2,
article > h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.3;
  margin: 2.75rem 0 1rem;
}

.prose h3,
article > h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
}

article p {
  margin: 0 0 1.25rem;
}

article ul,
article ol {
  padding-left: 1.4rem;
  margin: 0 0 1.25rem;
}

article li {
  margin-bottom: 0.4rem;
}

article a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

article a:hover {
  color: var(--accent);
}

article blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-soft);
}

article hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 2.5rem 0;
}

article img {
  max-width: 100%;
  border-radius: 3px;
}

/* code */

code {
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 450;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ---------- Posts ---------- */

.post-preview {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--hairline);
}

.post-preview:first-of-type {
  border-top: 1px solid var(--hairline);
}

.post-preview h2 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  font-weight: 500;
}

.post-preview h2 a {
  color: var(--ink);
  text-decoration: none;
}

.post-preview h2 a:hover {
  color: var(--accent);
}

.post-preview .post-subtitle {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
  margin: 0 0 0.7rem;
}

.post-meta {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.post-meta .tag,
.post-tags .tag {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.65rem;
}

.post-meta .tag::before,
.post-tags .tag::before {
  content: '#';
  color: var(--hairline-strong);
}

.read-more {
  display: none;
}

/* post header inside article */

article .post-date {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4rem 0 0;
}

article .post-date .idx {
  color: var(--accent);
}

article .post-date + h1 {
  margin-top: 1rem;
}

/* ---------- Contact block ---------- */

.contact {
  padding: 3.25rem 0 1rem;
  border-top: 1px solid var(--hairline);
}

.contact .big-link {
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.4rem, 3.6vw, 1.9rem);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: color 0.15s ease;
}

.contact .big-link:hover {
  color: var(--accent);
}

.contact .socials {
  margin-top: 1.6rem;
  display: flex;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.contact .socials a,
.socials a {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 480;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-decoration: none;
}

.contact .socials a:hover,
.socials a:hover {
  color: var(--accent);
}

.socials a::before {
  content: '↗ ';
  color: var(--accent);
}

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

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  body {
    font-size: 1.02rem;
  }

  .site-head {
    flex-direction: column;
    gap: 0.9rem;
    padding-top: 1.75rem;
  }

  .site-nav {
    gap: 1.1rem;
  }

  .hero {
    padding: 3rem 0 2.25rem;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .stats .stat {
    padding: 1.1rem 1rem 1rem 0;
  }

  .stats .stat + .stat {
    padding-left: 0;
    border-left: none;
  }

  .stats .stat:nth-child(even) {
    padding-left: 1rem;
    border-left: 1px solid var(--hairline);
  }

  .stats .stat:nth-child(n + 3) {
    border-top: 1px solid var(--hairline);
  }

  .index-row,
  .xp-item {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .index-row .when,
  .xp-when {
    padding-top: 0;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}
