:root {
  --bg: #121212;
  --panel: #1b1b1b;
  --text: #eeeeea;
  --soft: #aaa9a3;
  --rule: #383837;
  --accent: #d9d8d1;
  --rail: 270px;
  --pop: #77130a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: 1fr auto; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 1.55; }
a { color: inherit; }
.site-header { grid-column: 1; grid-row: 1 / span 2; min-height: 100vh; padding: 38px 30px; display: flex; position: sticky; top: 0; align-self: start; flex-direction: column; border-right: 1px solid var(--rule); }
.site-name { font-size: 32px; font-weight: 700; letter-spacing: -.06em; line-height: .95; text-decoration: none; }
.site-header::after { content: "Software · Mathematics · Physics"; margin-top: 14px; color: var(--soft); font-size: 14px; }
.site-header nav { display: grid; gap: 16px; margin-top: auto; }
.site-header nav a { color: var(--soft); font-size: 18px; text-decoration: none; }
.site-header nav a::before { content: "/ "; color: #5e5e5b; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--text); }
main { grid-column: 2; width: min(100%, 1180px); padding: 0 clamp(28px, 6vw, 88px) 80px; }
footer { grid-column: 2; align-self: end; padding: 28px clamp(28px, 6vw, 88px); border-top: 1px solid var(--rule); color: var(--soft); font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.footer-links { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.footer-links a { color: var(--soft); font-size: 12px; line-height: 1; text-decoration: none; padding: 6px 10px; border: 1px solid var(--rule); }
.footer-links a:hover { color: var(--text); border-color: #5e5e5b; }
.footer-linkedin { margin-left: 10px; color: var(--text); font-weight: 700; border-color: #5e5e5b; }
.footer-linkedin:hover { border-color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 42px; min-height: 620px; padding: clamp(88px, 14vh, 160px) 0 70px; align-items: end; border-bottom: 1px solid var(--rule); }
.intro .kicker { grid-column: 1 / -1; align-self: start; color: var(--soft); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.intro h1 { max-width: 760px; margin: 0; font-size: clamp(2.8rem, 5.2vw, 5.8rem); font-weight: 400; letter-spacing: -.065em; line-height: .95; }
.intro > p:last-child { max-width: 190px; margin: 0 0 7px; color: var(--soft); font-size: 15px; }
.home-section { padding: 54px 0 0; }
.home-section > h2, .section-label { margin: 0 0 19px; color: var(--soft); font-size: 12px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
.link-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.link-list a { min-height: 160px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none; }
.link-list a::after { content: "↗"; align-self: end; color: var(--soft); }
.link-list a:hover { background: var(--panel); }
.link-list a:hover span { text-decoration: underline; text-underline-offset: 5px; }
.link-list span { font-size: clamp(1.25rem, 2.2vw, 1.75rem); letter-spacing: -.04em; line-height: 1.1; }
.link-list small { color: var(--soft); font-size: 13px; }
.quiet-link { display: inline-block; margin: 20px 0 55px; color: var(--soft); font-size: 14px; text-underline-offset: 4px; }
.quiet-link:hover { color: var(--text); }

.page-heading { min-height: 330px; padding: 102px 0 54px; display: flex; flex-direction: column; justify-content: end; border-bottom: 1px solid var(--rule); }
.page-heading::before { content: "Mate Salanki"; margin-bottom: auto; color: var(--soft); font-size: 13px; }
.page-heading h1 { max-width: 760px; margin-bottom: 19px; font-size: clamp(3.2rem, 7vw, 6.5rem); font-weight: 400; letter-spacing: -.07em; line-height: .9; }
.page-heading p { max-width: 500px; margin: 0; color: var(--soft); font-size: 17px; }
.content { max-width: 760px; padding: 62px 0 80px; }
.content h2 { margin: 50px 0 16px; font-size: 22px; letter-spacing: -.03em; }
.content h2:first-child { margin-top: 0; }
.content p, .content ul { margin-bottom: 22px; }
.content ul { padding-left: 20px; }
.content li { margin-bottom: 9px; }
.content a { text-underline-offset: 4px; }

.post-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; border-left: 1px solid var(--rule); }
.post-card { min-height: 230px; padding: 25px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none; }
.post-card:hover { background: var(--panel); }
.post-card time { color: var(--soft); font-size: 13px; }
.post-card h2 { margin: auto 0 0; padding-top: 46px; font-size: clamp(1.5rem, 2.6vw, 2.25rem); font-weight: 400; letter-spacing: -.05em; line-height: 1.03; }
.post-card h2::after { content: " ↗"; color: var(--soft); font-size: .8em; }
.article { max-width: 820px; padding: 70px 0 100px; }
.back { display: inline-block; margin-bottom: 72px; color: var(--soft); font-size: 14px; text-underline-offset: 4px; }
.article-header { max-width: 800px; padding-bottom: 52px; border-bottom: 1px solid var(--rule); }
.article-header time { color: var(--soft); font-size: 13px; }
.article-header h1 { margin: 14px 0 0; font-size: clamp(2.7rem, 6vw, 5.6rem); font-weight: 400; letter-spacing: -.065em; line-height: .92; }
.article-author { margin: 18px 0 0; color: var(--soft); font-size: 13px; font-weight: 700; }
.prose { max-width: 680px; padding-top: 16px; font-size: 17px; }
.prose h1, .prose h2, .prose h3 { margin: 48px 0 16px; font-weight: 700; letter-spacing: -.035em; line-height: 1.16; }
.prose h1 { font-size: 29px; }
.prose h2 { font-size: 23px; }
.prose h3 { font-size: 19px; }
.prose p, .prose ul { margin-bottom: 22px; }
.prose a { text-underline-offset: 3px; }
.prose code { padding: 2px 5px; background: var(--panel); font: .86em ui-monospace, SFMono-Regular, Consolas, monospace; }
.prose pre { overflow: auto; margin: 26px 0; padding: 20px; background: var(--panel); border: 1px solid var(--rule); line-height: 1.45; }
.prose pre code { padding: 0; background: transparent; }
.prose .math-block { margin: 28px 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.prose .mjx-container { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.prose .math-block .mjx-container { margin: 0; }

@media (max-width: 780px) {
  body { display: block; }
  .site-header { min-height: 0; padding: 21px 24px; display: flex; position: static; flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .site-header::after { display: none; }
  .site-name { font-size: 24px; min-width: 0; }
  .site-header nav { display: flex; gap: 15px; margin: 0 0 0 auto; flex-shrink: 0; }
  .site-header nav a { font-size: 14px; }
  main { width: 100%; padding: 0 24px 58px; }
  footer { padding: 24px; }
  .intro { min-height: 0; padding: 82px 0 62px; grid-template-columns: 1fr; gap: 28px; }
  .intro .kicker { grid-column: auto; }
  .intro > p:last-child { max-width: 400px; }
  .page-heading { min-height: 0; padding: 74px 0 50px; }
  .page-heading::before { display: none; }
}

@media (max-width: 500px) {
  .site-header { padding: 18px; }
  .site-name { font-size: 18px; }
  .site-header nav { gap: 10px; }
  .site-header nav a { font-size: 12px; }
  .site-header nav a::before { content: ""; }
  main { padding: 0 18px 45px; }
  footer { padding: 22px 18px; flex-wrap: wrap; }
  .footer-links { gap: 6px; }
  .footer-linkedin { margin-left: 6px; }
  .intro { padding-top: 64px; }
  .link-list, .post-list { grid-template-columns: 1fr; }
  .link-list a { min-height: 130px; }
  .home-section { padding-top: 42px; }
  .quiet-link { margin-bottom: 42px; }
  .article { padding-top: 48px; }
  .back { margin-bottom: 50px; }
}

/* selected link */
a:active {
  color: var(--pop);
}
