/* ============================================================
   emreyakut.com/blog — "Defter"
   Warm-paper editorial, light, readable, a little playful.
   Same family as professional mode: Fraunces display,
   Inter text, JetBrains Mono notes, one rust accent.
   Self-contained — no dependency on the main site's CSS.
   ============================================================ */

:root {
  --paper:  #f4f0e8;
  --paper2: #ece6d9;
  --paper3: #e3dbc9;
  --card:   #fbf9f4;
  --ink:    #18130d;
  --ink2:   #4c463c;
  --mut:    #8d8475;
  --line:   #ddd4c3;
  --line2:  #cabfa8;
  --acc:    #bb4a28;
  --acc-ink:#9c3c20;
  --acc-soft:#f2e2d6;
  --blue:   #20405a;
  --blue-soft:#e2e9ee;
  --green:  #2f6b46;
  --dark:   #10131a;
  --dark2:  #171b25;
  --serif:  'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:   'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:   'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --rad:    14px;
  --shadow: 0 1px 2px rgba(24,19,13,.05), 0 8px 26px -12px rgba(24,19,13,.18);
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--acc-soft); }

.wrap { max-width: 1140px; margin: 0 auto; padding-inline: clamp(18px, 5vw, 56px); }
.col  { max-width: 700px; }

.mono { font-family: var(--mono); }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--acc); font-weight: 500;
}

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(244,240,232,.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand .mark {
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .08em;
  color: #fff; background: var(--ink); border-radius: 5px; padding: 4px 6px; line-height: 1;
}
.brand b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.brand span { font-size: 12.5px; color: var(--mut); }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar nav a {
  font-size: 13.5px; color: var(--ink2); padding: 7px 11px; border-radius: 8px;
  transition: background .15s, color .15s;
}
.topbar nav a:hover { background: var(--paper2); color: var(--acc); }
.topbar nav a.cta { background: var(--ink); color: var(--paper); }
.topbar nav a.cta:hover { background: var(--acc); color: #fff; }
@media (max-width: 620px) {
  .brand span { display: none; }
  .topbar nav a { padding: 7px 8px; font-size: 13px; }
  .topbar nav a.hide-s { display: none; }
}

/* ---------------- index hero ---------------- */
.hero { padding-block: clamp(46px, 8vw, 86px) clamp(26px, 4vw, 40px); }
.hero h1 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.022em;
  font-size: clamp(38px, 7.2vw, 74px); line-height: 1.02; margin: 14px 0 0;
}
.hero h1 em { font-style: italic; color: var(--acc); }
.hero .lead { max-width: 620px; font-size: clamp(17px, 2.2vw, 20px); color: var(--ink2); margin: 20px 0 0; }
.hero .stats { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 28px; }
.hero .stats div { font-family: var(--mono); font-size: 12px; color: var(--mut); }
.hero .stats b { display: block; font-family: var(--serif); font-size: 26px; color: var(--ink); font-weight: 600; line-height: 1.2; }

/* ---------------- filters ---------------- */
.filters {
  position: sticky; top: 60px; z-index: 50;
  background: rgba(244,240,232,.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-block: 1px solid var(--line);
  padding-block: 11px; margin-top: 24px;
}
.filters .wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .05em;
  border: 1px solid var(--line2); background: transparent; color: var(--ink2);
  padding: 6px 11px; border-radius: 999px; cursor: pointer; line-height: 1.4;
  transition: all .15s;
}
.chip:hover { border-color: var(--acc); color: var(--acc); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip .n { opacity: .55; margin-left: 5px; }
.filters .count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--mut); }

/* ---------------- timeline list ---------------- */
.timeline { padding-block: 10px 90px; }
.month {
  display: flex; align-items: baseline; gap: 16px;
  padding-top: 42px; padding-bottom: 6px;
}
.month h2 {
  font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .02em;
  color: var(--mut); margin: 0; text-transform: none; white-space: nowrap;
}
.month .rule { flex: 1; height: 1px; background: var(--line); }

.entry {
  display: grid; grid-template-columns: 96px 1fr; gap: clamp(14px, 3vw, 34px);
  padding-block: 22px; border-bottom: 1px solid var(--line);
  align-items: start;
}
.entry:hover .etitle { color: var(--acc); }
.entry .date {
  font-family: var(--mono); font-size: 12px; color: var(--mut);
  padding-top: 6px; white-space: nowrap;
}
.entry .date b { display: block; font-size: 22px; color: var(--ink); font-weight: 500; letter-spacing: -.02em; }
.etitle {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.015em;
  font-size: clamp(21px, 2.9vw, 29px); line-height: 1.22; margin: 0;
  transition: color .15s;
}
.entry .dek { color: var(--ink2); margin: 9px 0 0; font-size: 16.5px; line-height: 1.6; }
.entry .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.entry .art { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.entry .art svg { display: block; width: 100%; height: auto; }
@media (max-width: 640px) {
  .entry { grid-template-columns: 1fr; gap: 6px; }
  .entry .date { display: flex; align-items: baseline; gap: 8px; padding-top: 0; }
  .entry .date b { font-size: 15px; }
}

.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--mut);
  white-space: nowrap;
}
.tag.a { border-color: #cbbda5; color: #7a6a4e; background: #f1e9d9; }
.tag.b { border-color: #b8c8d4; color: #3d5f77; background: var(--blue-soft); }
.tag.c { border-color: #c4cfc0; color: #4b6b48; background: #e6eee3; }
.tag.d { border-color: #e0bcae; color: var(--acc-ink); background: var(--acc-soft); }
.tag.e { border-color: #cbc2dd; color: #5b4c7a; background: #ece7f4; }
.tag.f { border-color: #d8c6b0; color: #7c5f3c; background: #f2e8db; }
.tag.g { border-color: #d5c8b8; color: #6f6252; background: #efe9de; }
.tag.h { border-color: #d2c3d8; color: #6a4d77; background: #f0e8f3; }
.rt { font-family: var(--mono); font-size: 11px; color: var(--mut); }
.deep {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--acc); border: 1px dashed var(--acc); border-radius: 999px; padding: 2px 8px;
}

/* ---------------- article ---------------- */
.artwrap { padding-block: 44px 0; }
.back { font-family: var(--mono); font-size: 12px; color: var(--mut); }
.back:hover { color: var(--acc); }

.ahead { max-width: 760px; margin-top: 26px; }
.ahead h1 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.024em;
  font-size: clamp(32px, 5.6vw, 56px); line-height: 1.06; margin: 14px 0 0;
}
.ahead .dek { font-size: clamp(18px, 2.4vw, 21px); color: var(--ink2); margin: 18px 0 0; line-height: 1.6; }
.ahead .byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--mut);
}
.ahead .byline .who { color: var(--ink2); }

.herofig { margin: 34px 0 0; border: 1px solid var(--line); border-radius: var(--rad); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.herofig svg { display: block; width: 100%; height: auto; }

article.body { max-width: 700px; margin-top: 40px; padding-bottom: 20px; }
/* One rule owns block spacing — anything more specific below only overrides it
   deliberately. (An earlier `p { margin: 0 }` silently won on specificity and
   collapsed every gap in the article.) */
article.body > * { margin: 0 0 1.3em; }
article.body > *:last-child { margin-bottom: 0; }
article.body > p:first-of-type::first-letter {
  float: left; font-family: var(--serif); font-weight: 600; font-size: 3.1em;
  line-height: .86; padding: .04em .09em 0 0; color: var(--acc);
}
article.body h2 {
  font-family: var(--serif); font-weight: 600; letter-spacing: -.018em;
  font-size: clamp(24px, 3.4vw, 32px); line-height: 1.22;
  margin: 2em 0 .6em; scroll-margin-top: 80px; clear: both;
}
article.body h3 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(19px, 2.4vw, 22px);
  margin: 1.7em 0 .5em; scroll-margin-top: 80px; clear: both;
}
article.body a:not(.plain) {
  color: var(--acc-ink); text-decoration: underline;
  text-decoration-color: rgba(187,74,40,.34); text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
article.body a:not(.plain):hover { text-decoration-color: var(--acc); }
article.body strong { font-weight: 600; }
article.body em { font-style: italic; }
article.body ul, article.body ol { padding-left: 1.3em; }
article.body li + li { margin-top: .5em; }
article.body li::marker { color: var(--acc); }
article.body hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

article.body code {
  font-family: var(--mono); font-size: .855em; background: var(--paper2);
  border: 1px solid var(--line); border-radius: 5px; padding: .1em .36em;
  word-break: break-word;
}
article.body pre {
  background: var(--dark); color: #e8e4da; border-radius: var(--rad);
  padding: 18px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.66;
  border: 1px solid #232838; box-shadow: var(--shadow);
}
article.body pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
article.body pre .c { color: #7f8aa3; }          /* comment */
article.body pre .k { color: #e0673c; }          /* keyword / emphasis */
article.body pre .s { color: #9fd18a; }          /* string / good */
article.body pre .n { color: #e8c07d; }          /* number */
article.body pre .b { color: #ff8a6e; font-weight: 600; } /* bad */

article.body figure, figure { margin: 2.2em 0; }
figure.wide { max-width: 940px; }
figure .frame { border: 1px solid var(--line); border-radius: var(--rad); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  font-family: var(--mono); font-size: 11.5px; color: var(--mut);
  margin-top: 10px; line-height: 1.6;
}
figcaption b { color: var(--ink2); font-weight: 500; }

article.body blockquote, blockquote {
  margin: 2em 0; padding-left: 22px; border-left: 3px solid var(--acc);
  font-family: var(--serif); font-size: clamp(20px, 2.8vw, 25px); line-height: 1.42;
  color: var(--ink); font-style: italic;
}
blockquote p { margin: 0; }
blockquote cite { display: block; font-family: var(--mono); font-style: normal; font-size: 11.5px; color: var(--mut); margin-top: 12px; letter-spacing: .04em; }

.note, .finding, .math {
  border-radius: var(--rad); padding: 18px 20px; font-size: 16.5px; line-height: 1.64;
  border: 1px solid var(--line2); background: var(--card);
}
.note > *:first-child, .finding > *:first-child, .math > *:first-child { margin-top: 0; }
.note > *:last-child, .finding > *:last-child, .math > *:last-child { margin-bottom: 0; }
.note .lbl, .finding .lbl, .math .lbl {
  display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase; margin-bottom: 8px;
}
.note { background: var(--blue-soft); border-color: #b8c8d4; }
.note .lbl { color: #3d5f77; }
.finding { background: var(--acc-soft); border-color: #e0bcae; }
.finding .lbl { color: var(--acc-ink); }
.math { background: #fff; border-color: var(--line2); }
.math .lbl { color: var(--mut); }
.math .eq {
  font-family: var(--mono); font-size: 15px; text-align: center; padding: 14px 6px;
  background: var(--paper2); border-radius: 8px; margin-block: 12px; overflow-x: auto;
  white-space: nowrap; letter-spacing: .01em;
}
.math .where { font-size: 14.5px; color: var(--ink2); }

table.data {
  width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5;
}
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--rad); background: var(--card); }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); font-weight: 500; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-family: var(--mono); font-size: 13.5px; white-space: nowrap; }

.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--mut); }

/* dark "blueprint" plate for a punchy mid-article moment */
.plate {
  background: var(--dark); color: #e8e4da; border-radius: var(--rad);
  padding: clamp(22px, 4vw, 34px); border: 1px solid #232838;
  box-shadow: var(--shadow);
}
.plate h3 { font-family: var(--serif); color: #fff; margin: 0 0 10px; font-size: 22px; font-weight: 600; }
.plate p { color: #b9b4a8; margin: 0; font-size: 16.5px; }
.plate .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #e0673c; display: block; margin-bottom: 10px; }

/* ---------------- article footer / nav ---------------- */
.aftertags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 46px; }
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--line);
  padding-bottom: 70px;
}
.pager a {
  border: 1px solid var(--line); border-radius: var(--rad); padding: 16px 18px;
  background: var(--card); transition: border-color .15s, transform .15s;
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.pager a:hover { border-color: var(--acc); transform: translateY(-1px); }
.pager .dir { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--acc); }
.pager .t { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.3; }
.pager .next { text-align: right; align-items: flex-end; }
.pager .ghost { border-style: dashed; opacity: .5; pointer-events: none; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { text-align: left; align-items: flex-start; } }

/* ---------------- footer ---------------- */
.foot { border-top: 1px solid var(--line); background: var(--paper2); padding-block: 40px 56px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: flex-start; }
.foot p { margin: 0; font-size: 14.5px; color: var(--ink2); max-width: 460px; }
.foot .links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--mono); font-size: 12.5px; }
.foot .links a { color: var(--mut); }
.foot .links a:hover { color: var(--acc); }

/* ---------------- reading progress ---------------- */
.prog { position: fixed; top: 0; left: 0; height: 2px; background: var(--acc); width: 0; z-index: 99; transition: width .08s linear; }

/* ---------------- toc ---------------- */
.toc {
  border: 1px solid var(--line); border-radius: var(--rad); background: var(--card);
  padding: 16px 20px; margin-top: 34px;
}
.toc .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--mut); display: block; margin-bottom: 10px; }
.toc ol { margin: 0; padding-left: 1.15em; font-size: 15.5px; }
.toc li + li { margin-top: 5px; }
.toc a { color: var(--ink2); }
.toc a:hover { color: var(--acc); }

/* ============================================================
   Added for the bilingual rebuild: language switch, project card,
   the works directory, and the extra tag colours.
   ============================================================ */

/* language switch in the top bar */
.topbar nav a.lang {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em;
  border: 1px solid var(--line2); border-radius: 7px; padding: 5px 9px;
}
.topbar nav a.lang:hover { border-color: var(--acc); color: var(--acc); background: transparent; }

/* extra tag colours */
.tag.i { border-color: #b6ccc6; color: #2f6b5e; background: #e3efeb; }  /* portal */
.tag.j { border-color: #c8c0d8; color: #574a78; background: #ebe7f2; }  /* mobile */
.tag.k { border-color: #d3c3a8; color: #7b6330; background: #f3ebd9; }  /* simulation */
.tag.l { border-color: #d6bfb2; color: #8a5a3c; background: #f4e7dd; }  /* field */
.tag.proj {
  border-color: var(--ink); color: var(--paper); background: var(--ink);
  text-transform: none; letter-spacing: .02em; font-weight: 500;
}

/* project card above an article */
.projcard {
  margin-top: 30px; border: 1px solid var(--line2); border-radius: var(--rad);
  background: var(--card); padding: 16px 20px 18px; max-width: 760px;
}
.projcard .lbl {
  display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--mut); margin-bottom: 9px;
}
.projcard .pc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.projcard .pc-row b { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.projcard p { margin: 9px 0 0; font-size: 16px; line-height: 1.6; color: var(--ink2); }
.pc-link {
  font-family: var(--mono); font-size: 12px; color: var(--acc-ink);
  text-decoration: underline; text-decoration-color: rgba(187,74,40,.3); text-underline-offset: 3px;
}
.pc-link:hover { text-decoration-color: var(--acc); }
.pc-status {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--mut);
  white-space: nowrap;
}
.pc-status.s-live     { border-color: #9fb79d; color: #2f6b46; background: #e6eee3; }
.pc-status.s-internal { border-color: #b8c8d4; color: #3d5f77; background: var(--blue-soft); }
.pc-status.s-wip      { border-color: #e0bcae; color: var(--acc-ink); background: var(--acc-soft); }
.pc-status.s-draft    { border-color: var(--line2); color: var(--mut); background: var(--paper2); }
.pc-status.s-shipped  { border-color: #cbbda5; color: #7a6a4e; background: #f1e9d9; }

/* works directory */
.works {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px; padding-block: 34px 90px;
}
.work {
  border: 1px solid var(--line); border-radius: var(--rad); background: var(--card);
  padding: 20px 22px 22px; display: flex; flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.work:hover { border-color: var(--line2); transform: translateY(-1px); }
.w-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px; }
.w-head h2 {
  font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.015em;
  margin: 0; line-height: 1.2;
}
.w-since { font-family: var(--mono); font-size: 11px; color: var(--mut); margin-left: auto; }
.w-desc { margin: 11px 0 0; font-size: 15.5px; line-height: 1.6; color: var(--ink2); }
.w-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 13px; align-items: baseline; }
.w-live {
  font-family: var(--mono); font-size: 12px; color: var(--acc-ink);
  text-decoration: underline; text-decoration-color: rgba(187,74,40,.3); text-underline-offset: 3px;
}
.w-live:hover { text-decoration-color: var(--acc); }
.w-where { font-family: var(--mono); font-size: 11px; color: var(--mut); }
.w-posts {
  list-style: none; margin: 15px 0 0; padding: 14px 0 0;
  border-top: 1px solid var(--line); font-size: 14.5px;
}
.w-posts li { display: flex; gap: 10px; align-items: baseline; }
.w-posts li + li { margin-top: 7px; }
.w-posts a { color: var(--ink); line-height: 1.4; }
.w-posts a:hover { color: var(--acc); }
.w-posts span { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--mut); white-space: nowrap; }

/* five stats no longer fit in one row on a phone */
@media (max-width: 560px) { .hero .stats { gap: 12px 20px; } .hero .stats b { font-size: 22px; } }
