/* Saravana Thiyagarajan portfolio. Theme colours are the CSS variables below. */
html{scroll-behavior:smooth}
body{margin:0;background:#FBFBFA}
*{box-sizing:border-box}
a{color:inherit;text-decoration:none}a:hover{opacity:.72}
@keyframes blink{0%,49%{opacity:1}50%,100%{opacity:0}}
.blink{animation:blink 1.1s steps(1) infinite}
@media (prefers-reduced-motion: reduce){.blink{animation:none}}
@keyframes fall{from{transform:translateY(-50%)}to{transform:translateY(0)}}
.fall{animation:fall 60s linear infinite}
@media (prefers-reduced-motion: reduce){.fall{animation:none}}
@keyframes flowL{from{transform:translateX(0)}to{transform:translateX(-50%)}}
@keyframes flowR{from{transform:translateX(-50%)}to{transform:translateX(0)}}
.flowL{animation:flowL 40s linear infinite}
.flowR{animation:flowR 40s linear infinite}
@media (prefers-reduced-motion: reduce){.flowL,.flowR{animation:none}}
.t-light{--bg:#FBFBFA;--panel:#FFFFFF;--line:#E5E5E1;--line2:#CDCDC8;--text:#0B0B0C;--muted:#55555C;--faint:#73737B;--acc:#B4470B;--accBig:#DD5A0C;--chip:#F4F4F2;--btn:#0B0B0C;--btnText:#FFFFFF;--ok:#15803D;--bar:#0B0B0C;--barText:#FFFFFF;--cKey:#DD5A0C;--cStr:#9A6700;--cNum:#15803D;--cCom:#85858C}
.t-dark{--bg:#0A0A0B;--panel:#111113;--line:rgba(255,255,255,.11);--line2:rgba(255,255,255,.24);--text:#EDEDEF;--muted:#A8A8B3;--faint:#8E8E98;--acc:var(--accent);--accBig:var(--accent);--chip:rgba(255,255,255,.05);--btn:#EDEDEF;--btnText:#0A0A0B;--ok:#4ADE80;--bar:#18181B;--barText:#EDEDEF;--cKey:var(--accent);--cStr:#F5C06B;--cNum:#4ADE80;--cCom:#7C7C86}
.code-tab{background:transparent;color:var(--muted)}
.code-tab[aria-pressed="true"]{background:var(--btn);color:var(--btnText)}
[data-sys-row]{transition:background .4s ease}
[data-sys-row].is-on{background:var(--chip) !important}

/* ---------- Phones ----------
   Layout styles are inline on each element, so these overrides target the
   repeated inline patterns and need !important to win. */
@media (max-width: 640px){
  /* Header: name + buttons on one row, nav as a single swipeable row below.
     Was wrapping to three rows (~220px) and staying sticky. */
  header > div{display:grid !important;grid-template-columns:minmax(0,1fr) auto;padding:0 16px !important;column-gap:12px !important}
  header > div > a:first-child{grid-row:1;grid-column:1;min-height:56px !important;font-size:15px !important;min-width:0}
  header > div > a:first-child > span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  header > div > div{grid-row:1;grid-column:2;gap:6px !important}
  header > div > div > *{min-height:38px !important;padding:0 12px !important;font-size:13.5px !important}
  header nav{grid-row:2;grid-column:1 / -1;flex-wrap:nowrap !important;overflow-x:auto;scrollbar-width:none;margin:0 -16px;padding:0 4px;border-top:1px solid var(--line)}
  header nav::-webkit-scrollbar{display:none}
  header nav a{min-height:44px !important;flex:0 0 auto;padding:0 12px !important}
  [id]{scroll-margin-top:112px !important}

  /* Hero binary rain: keep it, but faint enough not to fight the text */
  [data-rain]{opacity:.22 !important}

  /* Empty spacer bands between sections */
  [style$="height: 56px"]{height:24px !important}

  /* Fixed-width side columns: go full width and swap the side divider for a top/bottom one */
  [style*="flex: 0 1 "]{flex:1 1 100% !important;min-width:0 !important}
  [style*="flex: 0 1 230px"]{border-left:0 !important;border-top:1px solid var(--line);text-align:left !important;padding-top:20px !important}
  [style*="flex: 0 1 260px"],[style*="flex: 0 1 360px"]{border-right:0 !important;border-bottom:1px solid var(--line)}
  [style*="flex: 0 1 260px"]{padding-bottom:20px !important}
  [style*="flex: 0 1 360px"]{min-height:300px !important}

  /* Stacked blocks don't need a right border; it doubles up with the page frame */
  [style*="flex: 1"][style*="border-right: 1px solid var(--line)"]{border-right:0 !important}

  /* Contact band: three blocks stack, so trim the padding between them */
  #contact [style*="flex: 1"]{padding:20px 28px 0 !important}
  #contact [style*="flex: 1"]:first-child{padding-top:40px !important}
  #contact [style*="flex: 0 1"]{padding:20px 28px 40px !important}
  footer [style*="padding: 48px 28px"]{padding:36px 28px !important}
  footer [style*="padding: 48px 28px"] + [style*="padding: 48px 28px"]{padding-top:0 !important}

  /* Case-study diagram: rows of boxes stack vertically, arrows point down */
  [style*="flex-wrap: wrap; gap: 8px"]:has(> span[aria-hidden="true"]){flex-direction:column;align-items:stretch}
  [style*="flex-wrap: wrap; gap: 8px"]:has(> span[aria-hidden="true"]) > span[aria-hidden="true"]{transform:rotate(90deg);line-height:1}
  [style*="flex-wrap: wrap; gap: 8px"]:has(> span[aria-hidden="true"]) > div{flex:0 0 auto !important}
}
