/* srinikesh singarapu, personal site. beige, one column. */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #efe9dc;
  --ink: #1c1a16;
  --muted: #6b6455;
  --rule: #d8cfba;
  --rust: #8a4e33;

  --display: "Newsreader", Georgia, serif;
  --body: "Inter Tight", system-ui, -apple-system, sans-serif;

  --col: 8.5rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 9rem 2rem 6rem;
}

.home-page { max-width: 54rem; }

/* masthead */

.masthead { margin-bottom: 8rem; }

.masthead h1 {
  display: inline;
  font-family: var(--display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

/* section headings with dotted leader */

section { margin-bottom: 7rem; }

.rule {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 2rem;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
}

.rule::after {
  content: "";
  flex: 1;
  border-bottom: 1px dotted var(--rule);
}

/* about */

.lede {
  margin: 0 0 0.9rem;
  text-wrap: pretty;
}

.lede:last-of-type { margin-bottom: 2.5rem; }

/* label / value rows */

.facts {
  display: grid;
  grid-template-columns: var(--col) 1fr;
  gap: 0.6rem 0;
}

/* let each .fact's children land directly in the parent grid */
.fact { display: contents; }

.fact .label {
  color: var(--muted);
  font-size: 14px;
}

.fact .value {
  max-width: 32rem;
  text-wrap: pretty;
}

/* work */

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

.work li {
  display: grid;
  grid-template-columns: var(--col) 1fr auto;
  align-items: baseline;
  gap: 0 1rem;
  padding: 0.55rem 0;
}

.work .dates {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.work .at { color: var(--muted); }

.work .org a {
  color: inherit;
  border-bottom: 1px dotted var(--rule);
}

.work .org a:hover { border-bottom: 1px solid var(--rust); }

.work .note {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 0.15rem;
  max-width: 30rem;
  text-wrap: pretty;
}

.work .where {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

/* footer */

footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 9rem;
  padding-top: 2rem;
  border-top: 1px dotted var(--rule);
  font-size: 14px;
}

footer nav {
  display: flex;
  gap: 1.25rem;
}

footer .copy { color: var(--muted); }

a {
  color: var(--rust);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

a:hover { border-bottom-color: var(--rust); }

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

/* narrow */

@media (max-width: 640px) {
  main { padding: 4rem 1.5rem 3rem; }

  .masthead { margin-bottom: 4rem; }
  section { margin-bottom: 4rem; }
  footer { margin-top: 5rem; }

  .facts {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .fact .label { margin-bottom: 0.1rem; }
  .fact .value { margin-bottom: 1.5rem; }
  .fact:last-child .value { margin-bottom: 0; }

  .work li {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0.9rem 0;
  }

  .work .where { text-align: left; }
}

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

/* a quiet entrance to the writing */
.blog-dash {
  position: fixed;
  bottom: max(.75rem, env(safe-area-inset-bottom));
  right: max(1rem, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
  font: 400 14px/1 var(--display);
  border: 0;
}
.blog-dash:hover { color: var(--rust); border: 0; }

/* blog pages use the same paper, type, and reading column */
.blog-masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 5rem;
}
.blog-masthead a:first-child {
  color: var(--ink);
  font: 500 22px/1.3 var(--display);
}
.blog-masthead a:last-child:not(:first-child) { font-size: 14px; }
.blog-heading { margin: 0 0 3rem; font: 500 38px/1.2 var(--display); }
.posts { margin: 0; padding: 0; list-style: none; }
.posts li { padding: 0 0 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px dotted var(--rule); }
.posts li:last-child { margin-bottom: 0; }
.posts h2 { margin: 0 0 .7rem; font: 500 28px/1.2 var(--display); }
.posts h2 a { color: var(--ink); }
.post-description { margin: 0; max-width: 35rem; color: var(--muted); }
.blog-index footer { margin-top: 4rem; border: 0; padding: 0; }
.post-page { padding-top: 5rem; }
.post-page .blog-masthead { margin-bottom: 4rem; }
.post-header { margin-bottom: 3rem; }
.post-header h1 { margin: 0 0 1.5rem; font: 500 50px/1.07 var(--display); letter-spacing: -.02em; text-wrap: balance; }
@media screen and (min-width: 701px) {
  .post-page .blog-masthead { margin-bottom: 6rem; }
  .post-header {
    position: relative;
    width: min(1000px, calc(100vw - 3rem));
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }
  .post-header h1 { margin-bottom: 2.5rem; font-size: clamp(32px, 4vw, 50px); }
}
.walk-link { font-size: 14px; border-bottom: 1px dotted var(--rust); }
.post-page article { font-size: 17px; line-height: 1.8; }
.post-page article p { margin: 0 0 1.4rem; }
.post-page article h2 { margin: 3.8rem 0 1.4rem; font: 500 31px/1.2 var(--display); scroll-margin-top: 2rem; }
.post-page article h3 { margin: 2rem 0 1rem; font: 500 26px/1.25 var(--display); }
.post-page article strong { font-weight: 600; }
.post-page article a:not(.figure-open) { border-bottom: 1px dotted var(--rust); }
.post-page article code { font-size: .78em; overflow-wrap: anywhere; }
.post-page figure, .lesson-pair {
  position: relative;
  width: min(1000px, calc(100vw - 3rem));
  left: 50%;
  transform: translateX(-50%);
  margin: 2.5rem 0 3rem;
}
.figure-open { position: relative; display: block; border: 0; cursor: zoom-in; background: var(--diagram-paper); overflow: hidden; border-radius: 3px; }
.figure-open:hover { border: 0; }
.figure-open img { display: block; width: 100%; height: auto; }
.expand-hint { position: absolute; bottom: .5rem; right: .65rem; padding: .1rem .5rem; background: #fffffff2; color: #51493f; border: 1px solid #ded8cd; border-radius: 2px; font-size: 11px; opacity: 0; }
.figure-open:hover .expand-hint, .figure-open:focus-visible .expand-hint { opacity: 1; }
.lesson-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 2rem; row-gap: 0; }
.lesson-pair .lesson-column { display: grid; grid-template-rows: subgrid; grid-row: span 3; min-width: 0; margin: 0; }
.post-page .lesson-column h3 { margin: 0 0 1rem; font-size: 28px; text-align: center; text-wrap: balance; }
.post-page .lesson-column > p { margin: 0 0 1.5rem; font-size: 16px; line-height: 1.7; text-align: center; color: var(--muted); }
.lesson-column figure { width: 100%; margin: 0; left: auto; transform: none; }
#the-two-most-important-things-i-learned, #the-two-most-important-things-i-learned + p { text-align: center; }
.table-wrap { overflow-x: auto; margin: 2rem 0; }
.post-page table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
.post-page th, .post-page td { padding: .9rem .8rem; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.post-page th { font-weight: 600; }
.tool-reference { margin: 2rem 0; padding: 1rem 0; border-block: 1px dotted var(--rule); font-size: 15px; }
.tool-reference summary { cursor: pointer; color: var(--rust); }
.post-page .tool-reference > p { margin-top: 1rem; }
.skip-link { position: absolute; top: -100px; left: 1rem; padding: .5rem 1rem; background: var(--paper); }
.skip-link:focus { top: 1rem; z-index: 10; }

/* the article and diagrams exist before this optional viewer opens */
dialog { padding: 0; border: 1px solid var(--rule); border-radius: 4px; max-width: none; width: min(1220px,96vw); height: 94dvh; max-height: 94dvh; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #1c1a16bb; }
.dialog-shell { height: 100%; display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--rule); }
.dialog-head h2 { flex: 1; margin: 0; font: 500 24px/1.2 var(--display); }
.viewer-tools { display: flex; flex-wrap: wrap; gap: .6rem; padding: .7rem 1.4rem; }
.viewer-tools button, .dialog-head button { border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; min-height: 40px; padding: .35rem .7rem; cursor: pointer; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
.viewer-tools button:disabled { opacity: .4; cursor: default; }
#zoom { margin-left: auto; }
.diagram-stage { flex: 1; min-height: 80px; overflow: auto; background: var(--diagram-paper); overscroll-behavior: contain; }
.diagram-stage img { display: block; margin: auto; max-width: none; }
.viewer-note { padding: .85rem 1.4rem; flex-shrink: 0; font-size: 15px; line-height: 1.55; }
.viewer-note p { margin: 0 0 .5rem; }
.viewer-note details { color: var(--muted); font-size: 14px; }
.viewer-note details p { margin: .7rem 0 0; }
.viewer-note summary { cursor: pointer; }
.viewer-note details[open] { max-height: 160px; overflow: auto; }

@media (max-width: 700px) {
  .post-page { padding-top: 3rem; }
  .blog-masthead, .post-page .blog-masthead { margin-bottom: 3rem; }
  .post-header h1 { font-size: 39px; }
  .post-page article { font-size: 16px; }
  .post-page article h2 { font-size: 28px; }
  .lesson-pair { grid-template-columns: 1fr; width: min(500px,calc(100vw - 3rem)); gap: 2.5rem; }
  .lesson-pair .lesson-column { display: block; }
  .post-page .lesson-column h3 { font-size: 26px; }
  .expand-hint { opacity: 1; }
  .dialog-head, .viewer-tools, .viewer-note { padding-left: .8rem; padding-right: .8rem; }
  .dialog-head h2 { font-size: 20px; }
  .post-page th, .post-page td { padding: .7rem .45rem; }
  .post-page .table-wrap table { min-width: 530px; }
  .tool-reference .table-wrap table { min-width: 450px; }
}
@media print {
  .blog-dash, .walk-link, .expand-hint, dialog, .skip-link { display: none !important; }
  main, .post-page { max-width: none; padding: 0; }
  .post-page article { font-size: 11pt; }
  .post-page figure, .lesson-pair { width: 100%; left: auto; transform: none; break-inside: avoid; }
  .post-page .figure-open img { max-height: 190mm; object-fit: contain; }
  .blog-masthead, .post-page .blog-masthead { margin-bottom: 2rem; }
  .post-header h1 { font-size: 30pt; }
  .post-page article h2 { break-after: avoid; }
  .tool-reference { display: none; }
}

/* light and dark are variations of the same paper-and-rust palette */
:root { color-scheme: light; --diagram-paper: #f7f2e8; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1c1a16;
  --ink: #efe9dc;
  --muted: #bdb19d;
  --rule: #4b4235;
  --rust: #d5a17f;
  --diagram-paper: #28241e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1c1a16;
    --ink: #efe9dc;
    --muted: #bdb19d;
    --rule: #4b4235;
    --rust: #d5a17f;
    --diagram-paper: #28241e;
  }
}
.theme-toggle { border: 0; padding: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.theme-toggle:hover { color: var(--rust); }
.blog-masthead nav { display: flex; align-items: baseline; gap: 1.5rem; font-size: 14px; }
.blog-masthead nav a:first-child { font: inherit; color: var(--rust); }
footer { flex-wrap: wrap; }
.figure-open img, .diagram-stage img { color-scheme: inherit; }
@media print {
  :root, :root[data-theme="dark"] { color-scheme: light; --paper: #fff; --ink: #1c1a16; --muted: #6b6455; --rule: #d8cfba; --rust: #8a4e33; --diagram-paper: #f7f2e8; }
  .theme-toggle { display: none; }
}

.post-page .lesson-column h3 { text-decoration-line:underline;text-decoration-thickness:1px;text-underline-offset:.16em;text-decoration-skip-ink:auto; }
