/* Samiksha Roy, portfolio styles.
   Concept: the editor's margin. A reading column, a margin for notes,
   and a few proofreading marks used sparingly. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/fonts/source-sans-3-latin-normal.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: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/fonts/source-sans-3-latin-ext-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("/assets/fonts/source-sans-3-latin-italic.woff2") format("woff2");
}

:root {
  --ink: #1f3864;        /* deep navy ink: text and headings */
  --ink-soft: #4b5a78;   /* secondary text, 6.5:1 on paper */
  --paper: #fbf8f2;      /* warm off-white */
  --paper-deep: #f2ece0; /* bands, table heads */
  --rule: #d8cfbe;       /* hairlines */
  --marigold: #e3a33a;   /* marks, rules, highlights (never small text) */
  --wash: #fbe3ad;       /* highlighter */
  --ochre: #8a4b08;      /* accent text, 6.4:1 on paper */

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;

  --side: 9rem;
  --main: 38rem;
  --margin: 13rem;
  --gap: 2.25rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  hanging-punctuation: first allow-end last;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 40rem) { body { font-size: 1.125rem; } }

::selection { background: var(--wash); color: var(--ink); }

img, svg { max-width: 100%; height: auto; }

/* ---------- Type ---------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 560;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0 0 0.6em;
  text-wrap: balance;
  font-variant-numeric: lining-nums;
}
h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.3rem); font-weight: 520; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1vw, 1.85rem); }
h3 { font-size: 1.25rem; margin-top: 1.8em; }
h4 { font-size: 1.05rem; margin-top: 1.5em; }

p, ul, ol, dl, blockquote, figure, table { margin: 0 0 1.1em; }
p { text-wrap: pretty; }
ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.35em; }
li::marker { color: var(--ochre); }
strong, b { font-weight: 650; }
small { font-size: 0.875em; }
abbr[title] { text-decoration: none; }
code, kbd {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.86em;
  background: var(--paper-deep);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--marigold);
  text-decoration-thickness: 0.11em;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
a:hover { color: var(--ochre); text-decoration-color: var(--ochre); }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.4rem);
  line-height: 1.45;
  font-weight: 380;
  color: var(--ink);
  max-width: 34em;
}
.quiet { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }

.vh {
  clip-path: inset(50%);
  height: 1px; width: 1px;
  overflow: hidden; position: absolute; white-space: nowrap;
}
.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.9rem; z-index: 10; border-radius: 3px;
}
.skip:focus { top: 1rem; color: var(--paper); }

/* ---------- Running head and footer ---------- */

.runhead, .colophon {
  max-width: calc(var(--side) + var(--main) + var(--margin) + 2 * var(--gap));
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.95rem;
}
.runhead { border-bottom: 1px solid var(--rule); }
.runhead .name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 540;
  text-decoration: none;
}
.runhead .name:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--marigold); }
.runhead nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.colophon {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding-top: 1.4rem;
  padding-bottom: 2.5rem;
  color: var(--ink-soft);
}
.colophon p { margin: 0; }

/* ---------- Layout: side head, reading column, margin ---------- */

main { display: block; }
.row {
  max-width: calc(var(--main) + 2.5rem);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.row + .row { margin-top: 3.25rem; }
.row > .side { font-size: 1.45rem; }
.main { min-width: 0; }
.main > :last-child { margin-bottom: 0; }

/* Margin notes: inline on small screens, in the margin on wide ones. */
.note {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 400;
  color: var(--ink-soft);
  border-left: 2px solid var(--marigold);
  padding: 0.1rem 0 0.1rem 0.85rem;
  margin: 0 0 1.1rem;
  font-variant-numeric: lining-nums;
}
.note p { margin: 0 0 0.5em; }
.note p:last-child { margin: 0; }
.note .mark, .ref {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 650;
  color: var(--ochre);
}
.ref { font-size: 0.72em; vertical-align: 0.45em; line-height: 0; text-decoration: none; padding: 0 0.1em; }
.ref + .ref { padding-left: 0; }
.ref + .ref::before { content: ",\00a0"; }

.wide, .full { overflow-x: auto; }

@media (min-width: 68rem) {
  .row {
    max-width: calc(var(--side) + var(--main) + var(--margin) + 2 * var(--gap) + 2.5rem);
    display: grid;
    grid-template-columns: var(--side) minmax(0, var(--main)) var(--margin);
    column-gap: var(--gap);
    align-items: start;
  }
  .row > .side {
    grid-column: 1;
    position: sticky;
    top: 1.5rem;
    font-size: 1.3rem;
    text-align: right;
    margin-top: 0.15rem;
  }
  .row > .main { grid-column: 2; }
  .row > .main:only-child { grid-column: 2; }
  .row > .aside { grid-column: 3; }
  .note {
    float: right;
    clear: right;
    width: var(--margin);
    margin-right: calc(-1 * (var(--margin) + var(--gap)));
    margin-top: 0.3rem;
    margin-bottom: 1rem;
    border-left: 0;
    padding: 0;
    position: relative;
  }
  .note::before {
    content: "";
    position: absolute;
    left: -1.1rem; top: 0.55rem;
    width: 0.55rem; height: 1px;
    background: var(--marigold);
  }
  .main .wide { margin-right: calc(-1 * (var(--margin) + var(--gap))); clear: right; }
  .main .full {
    margin-left: calc(-1 * (var(--side) + var(--gap)));
    margin-right: calc(-1 * (var(--margin) + var(--gap)));
    clear: both;
  }
}

/* ---------- Page openers ---------- */

.opener { padding-top: 3.5rem; padding-bottom: 0.5rem; }
.opener h1 { max-width: 18em; }
.kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}

/* Honesty label on every sample. */
.label {
  display: inline-block;
  font-size: 0.92rem;
  line-height: 1.45;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  padding: 0.45rem 0.75rem 0.45rem 0.75rem;
  border-radius: 3px;
  margin: 0.4rem 0 1.4rem;
  color: var(--ink);
  max-width: 40em;
}
.label::before {
  content: "¶";
  font-family: var(--serif);
  color: var(--ochre);
  margin-right: 0.45rem;
  font-weight: 600;
}

/* ---------- Lists of samples and principles ---------- */

.contents { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.contents > li { border-bottom: 1px solid var(--rule); padding: 1.2rem 0 1.25rem; margin: 0; }
.contents h3 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.contents h3 a { text-decoration-thickness: 0.08em; }
.contents p { margin: 0 0 0.35rem; }
.contents .meta { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }

.principles { margin: 0; }
.principles dt {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.12rem;
  margin-top: 1.1rem;
}
.principles dt:first-child { margin-top: 0; }
.principles dd { margin: 0.2rem 0 0; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 1.1rem; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -0.1rem;
  font-family: var(--serif); font-size: 1.5rem; font-weight: 500;
  color: var(--ochre);
  font-variant-numeric: lining-nums;
}
.steps h3 { margin: 0 0 0.2rem; font-size: 1.15rem; }
.steps p { margin: 0; }

.plain { list-style: none; padding: 0; }
.plain li { margin-bottom: 0.6rem; }

.facts { margin: 0; }
.facts > div { padding: 0.75rem 0; border-top: 1px solid var(--rule); }
.facts > div:last-child { border-bottom: 1px solid var(--rule); }
.facts dt { font-weight: 650; }
.facts dd { margin: 0.1rem 0 0; }
@media (min-width: 40rem) {
  .facts > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; }
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 2px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  line-height: 1.45;
  font-variant-numeric: lining-nums tabular-nums;
  margin: 0;
}
caption {
  text-align: left;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  padding-bottom: 0.5rem;
  font-size: 1rem;
}
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--rule); }
th:last-child, td:last-child { padding-right: 0; }
thead th {
  font-weight: 650;
  border-bottom: 1.5px solid var(--ink);
  white-space: nowrap;
}
tbody th { font-weight: 650; }
td.num, th.num { text-align: right; }

/* ---------- Callouts, figures, downloads ---------- */

.callout {
  background: var(--paper-deep);
  border-radius: 3px;
  padding: 1rem 1.2rem;
  margin: 0 0 1.4rem;
}
.callout > :last-child { margin-bottom: 0; }
.callout h3:first-child, .callout h4:first-child { margin-top: 0; }

figure { margin: 0 0 1.6rem; }
figcaption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-top: 0.6rem;
}

.downloads { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.downloads li { margin: 0; }

.button, button {
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  display: inline-block;
  padding: 0.62rem 1rem;
  border-radius: 3px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.button:hover, button:hover { background: #172b4e; color: var(--paper); }
.button.secondary, button.secondary { background: transparent; color: var(--ink); }
.button.secondary:hover, button.secondary:hover { background: var(--paper-deep); color: var(--ink); }
button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Proofreading marks ---------- */

del {
  text-decoration-line: line-through;
  text-decoration-color: var(--ochre);
  text-decoration-thickness: 2px;
  color: var(--ink-soft);
}
ins {
  text-decoration: none;
  background: linear-gradient(transparent 58%, var(--wash) 58%);
  color: var(--ink);
  padding: 0 0.05em;
}
del::before, del::after, ins::before, ins::after {
  clip-path: inset(100%);
  height: 1px; width: 1px;
  overflow: hidden; position: absolute; white-space: nowrap;
}
del::before { content: " [deletion start] "; }
del::after { content: " [deletion end] "; }
ins::before { content: " [insertion start] "; }
ins::after { content: " [insertion end] "; }

.pilcrow::before {
  content: "¶";
  font-family: var(--serif);
  color: var(--ochre);
  font-weight: 500;
  margin-right: 0.4rem;
}

/* ---------- Home ---------- */

.hero { padding-top: 4.5rem; padding-bottom: 1rem; }
.hero h1 {
  font-size: clamp(3rem, 1.6rem + 6.2vw, 6rem);
  font-weight: 470;
  letter-spacing: -0.025em;
  line-height: 0.98;
  margin: 0 0 1.6rem;
}
.proofline {
  font-family: var(--serif);
  font-weight: 360;
  font-size: clamp(1.32rem, 1rem + 1.6vw, 2.1rem);
  line-height: 1.4;
  padding-top: 0.85em;
  margin: 0 0 1.4rem;
  max-width: 22em;
}
.caret {
  position: relative;
  display: inline-block;
  width: 0;
}
.caret::after {
  content: "";
  position: absolute;
  left: -0.34em;
  bottom: -0.3em;
  width: 0.42em;
  height: 0.42em;
  background:
    linear-gradient(to top left, transparent calc(50% - 1.5px), var(--marigold) calc(50% - 1.5px), var(--marigold) calc(50% + 1.5px), transparent calc(50% + 1.5px)) left / 50% 100% no-repeat,
    linear-gradient(to top right, transparent calc(50% - 1.5px), var(--marigold) calc(50% - 1.5px), var(--marigold) calc(50% + 1.5px), transparent calc(50% + 1.5px)) right / 50% 100% no-repeat;
  transform-origin: bottom center;
}
.caret .added {
  position: absolute;
  left: -0.14em;
  bottom: 1.05em;
  transform: translateX(-50%) rotate(-2deg);
  white-space: nowrap;
  font-style: italic;
  font-weight: 420;
  font-size: 0.78em;
  line-height: 1;
  color: var(--ochre);
}
@media (prefers-reduced-motion: no-preference) {
  .caret::after { animation: caret-in 0.45s ease-out 0.5s both; }
  .caret .added { animation: word-in 0.6s ease-out 0.85s both; }
}
@keyframes caret-in { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes word-in {
  from { opacity: 0; transform: translate(-50%, 0.35em) rotate(-2deg); }
  to { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }
}

.contact-line { font-size: 1.05rem; }
.contact-line a { margin-right: 1.1rem; }

/* ---------- 404 ---------- */

.lost { padding-top: 6rem; padding-bottom: 4rem; }
.lost h1 del { color: var(--ink); text-decoration-thickness: 4px; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */

@media print {
  @page { margin: 16mm 16mm 18mm; }
  :root { --paper: #fff; }
  body { background: #fff; font-size: 10.5pt; line-height: 1.45; color: #000; }
  .runhead nav, .skip, .no-print, .downloads { display: none !important; }
  .runhead { border-bottom: 1px solid #999; padding: 0 0 6pt; max-width: none; }
  .row, .opener { max-width: none; padding: 0; display: block; }
  .row + .row { margin-top: 14pt; }
  .row > .side { position: static; text-align: left; font-size: 14pt; }
  .opener { padding-top: 10pt; }
  .note {
    float: none; width: auto; margin: 0 0 8pt; border-left: 2px solid #bbb;
    padding-left: 8pt; color: #333;
  }
  .note::before { display: none; }
  .wide, .full { margin: 0; overflow: visible; }
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; page-break-inside: auto; }
  tr, .note, figure, .callout { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  a { text-decoration: none; }
  .main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #444; word-break: break-all; }
  .colophon { margin-top: 18pt; padding: 6pt 0 0; max-width: none; }
}
