/* ---------------------------------------------------------------
   Shaurya Sharma — personal site
   Small type, one narrow column, nothing that moves without reason.
   --------------------------------------------------------------- */

/* Light is the default; dark follows the OS, and an explicit data-theme
   on <html> (set by the footer toggle) wins over both, in either direction. */

:root {
  --background: #ffffff;
  --foreground: #08090a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #08090a;
    --foreground: #fafafa;
    --muted: #1a1a1a;
    --muted-foreground: #a3a3a3;
    --border: #262626;
  }
}

:root[data-theme="dark"] {
  --background: #08090a;
  --foreground: #fafafa;
  --muted: #1a1a1a;
  --muted-foreground: #a3a3a3;
  --border: #262626;
}

:root[data-theme="light"] {
  --background: #ffffff;
  --foreground: #08090a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
}

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

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

body {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin: 0 auto;
  max-width: 42rem;
  padding: 3rem 1.5rem 4rem;
  min-height: 100dvh;
  background: var(--background);
  color: var(--foreground);
  font-family: "Helvetica Neue", Helvetica, Inter, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

@media (min-width: 640px) {
  body { padding-top: 6rem; }
}

main {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

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

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

/* --- masthead ------------------------------------------------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.masthead h1 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* The caret rides after the typed name and retires once the line lands. */
.caret {
  display: inline-block;
  width: 1px;
  height: 0.95em;
  margin-left: 0.14em;
  background: currentColor;
  vertical-align: -0.11em;
  opacity: 1;
  transition: opacity 0.5s ease;
  animation: caret-blink 1.05s steps(1, end) infinite;
}

.caret.done {
  animation: none;
  opacity: 0;
}

@keyframes caret-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

.muted {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

/* --- bio ------------------------------------------------------ */

.bio {
  margin: 0;
  max-width: 100%;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.bio a { color: var(--foreground); }

.bio-place { margin-top: 0.75rem; }

/* Available to screen readers and crawlers, out of the visual layout.
   Structural headings only — never keyword text, which Google treats as spam. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- work list ------------------------------------------------ */

.work {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  display: flex;
  gap: 1rem;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
}

.card.expandable { cursor: pointer; }

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.125rem;
  padding: 0.3125rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  /* Every mark is dark ink on transparency, so the plate stays light in
     both themes — otherwise the navy and maroon logos vanish in dark mode. */
  background: #ffffff;
  user-select: none;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Block, not inline-flex: an inline-flex heading sizes to max-content and
   refuses to wrap, which pushes the whole page wider than a phone screen. */
.card-title {
  margin: 0;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

@media (min-width: 640px) {
  .card-title { font-size: 0.875rem; }
}

.card-title a { border-bottom-color: transparent; }
.card-title a:hover { border-bottom-color: var(--foreground); }

.chev {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: none;
  margin-left: 0.1em;
  vertical-align: -0.22em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: translateX(0) rotate(0deg);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.card.expandable:hover .chev { opacity: 1; transform: translateX(0.25rem); }
.card.expanded .chev { opacity: 1; transform: translateX(0.25rem) rotate(90deg); }

.card-date {
  flex: none;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.card-role {
  margin: 0;
  font-size: 0.75rem;
  color: var(--foreground);
}

/* Unwrapped (no JS): just a normal blurb under the role. */
.card-note {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Collapsed by default; the 0fr → 1fr grid trick animates to auto height. */
.card-note-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.3s ease, opacity 0.3s ease;
}

.card.expanded .card-note-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
}

.card-note-wrap > .card-note {
  overflow: hidden;
  margin: 0;
}

.card.expanded .card-note-wrap > .card-note { padding-top: 0.5rem; }

@media (min-width: 640px) {
  .card-note-wrap > .card-note { font-size: 0.8125rem; }
}

/* --- footer ---------------------------------------------------
   Mirrors the masthead: links where the name sits, a single control
   where the location sits, on the same hairline as the rest of the page.
   ------------------------------------------------------------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto; /* sits at the bottom when the page is short */
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer a {
  border-bottom-color: transparent;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.footer a:hover {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}

.footer a:focus-visible,
#theme-toggle:focus-visible {
  outline: 1px solid var(--foreground);
  outline-offset: 4px;
  border-radius: 2px;
}

#theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-foreground);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: color 0.3s ease;
}

/* Thumb-sized tap targets without disturbing the layout: the hit area is an
   invisible pseudo-element, so the icon and links stay optically aligned. */
#theme-toggle::after {
  content: "";
  position: absolute;
  inset: -0.85rem;
}

.footer a { position: relative; }

.footer a::after {
  content: "";
  position: absolute;
  inset: -0.7rem -0.35rem;
}

#theme-toggle:hover { color: var(--foreground); }

#theme-toggle svg {
  width: 0.875rem;
  height: 0.875rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sun  { display: block; }
.icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  .icon-sun  { display: none; }
  .icon-moon { display: block; }
}

:root[data-theme="dark"] .icon-sun   { display: none; }
:root[data-theme="dark"] .icon-moon  { display: block; }
:root[data-theme="light"] .icon-sun  { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }

/* --- small screens ---------------------------------------------
   Under 480px a company name and a date range can't share a line, so
   the head dissolves and its children join the card's own column —
   title, role, then date.
   -------------------------------------------------------------- */

@media (max-width: 480px) {
  body { padding: 2.5rem 1.25rem 3rem; }

  .card { gap: 0.75rem; }

  .card-head { display: contents; }
  .card-title { order: 1; }
  .card-role { order: 2; }

  .card-date {
    order: 3;
    margin-top: 0.125rem;
    text-align: left;
  }

  .card-note,
  .card-note-wrap { order: 4; }

  .footer-links { gap: 1.1rem; }
}

/* --- entrance ------------------------------------------------- */

.fade {
  animation: blur-fade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--d, 0s);
}

@keyframes blur-fade {
  from { opacity: 0; filter: blur(6px); transform: translateY(6px); }
  to   { opacity: 1; filter: blur(0);   transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
