/* Vignesh Ayyappan — portfolio
   Editorial layout. Paper and ink, one rust accent, serif display, mono labels. */

:root {
  --paper: #f4f1ea;
  --paper-2: #ebe7dd;
  --ink: #1b1a17;
  --ink-2: #4a463e;
  --mute: #7d776a;
  --rule: #d6d0c1;
  --rust: #a2452b;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --col: 980px;
  --gutter: 20px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161512;
    --paper-2: #1d1c18;
    --ink: #ece8dd;
    --ink-2: #bdb7a8;
    --mute: #8b8577;
    --rule: #33312b;
    --rust: #e08a6c;
  }
}

:root[data-theme="dark"] {
  --paper: #161512;
  --paper-2: #1d1c18;
  --ink: #ece8dd;
  --ink-2: #bdb7a8;
  --mute: #8b8577;
  --rule: #33312b;
  --rust: #e08a6c;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-feature-settings: "liga", "kern", "onum";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

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

:focus-visible {
  outline: 1px solid var(--rust);
  outline-offset: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Labels ---------- */

.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 20px;
}

.label .n { color: var(--rust); margin-right: 12px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease);
}

.site-header.is-scrolled { border-bottom-color: var(--rule); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 500;
}

.logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.nav-links a {
  color: var(--mute);
  transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--ink); }

.nav-links a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--rust); text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* Blog link stays a plain text link */
.nav-links a.nav-blog { color: var(--ink-2); }

@media (max-width: 560px) {
  .nav { height: 64px; }
  .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-links { gap: 16px; }
}

@media (max-width: 340px) {
  .nav { flex-wrap: wrap; height: auto; padding: 14px 0; row-gap: 10px; }
  .nav-links { gap: 12px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo { filter: invert(1); }
}
:root[data-theme="dark"] .logo { filter: invert(1); }

/* ---------- Layout ---------- */

main { padding-bottom: 120px; }

section { padding: 96px 0 0; }

.intro { padding: 120px 0 88px; }

.display {
  font-size: clamp(2.6rem, 7.2vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 400;
  margin: 0;
  max-width: 14ch;
}

.display em { font-style: italic; color: var(--rust); }

h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 400;
  margin: 0 0 24px;
}

h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 400;
  margin: 0 0 12px;
}

p { margin: 0 0 18px; color: var(--ink-2); max-width: 62ch; }

.lead {
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink);
  max-width: 40ch;
}

/* Intro text: each line slides up from a mask */
.mask { display: block; overflow: hidden; padding-bottom: 0.08em; }
.mask > span {
  display: block;
  transform: translateY(105%);
  animation: rise 1.1s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 120ms + 80ms);
}

@keyframes rise { to { transform: none; } }

.fade {
  opacity: 0;
  animation: fade 1.2s var(--ease) forwards;
  animation-delay: var(--d, 700ms);
}

@keyframes fade { to { opacity: 1; } }

/* ---------- Index rows (projects) ---------- */

.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }

.index li { border-bottom: 1px solid var(--rule); }

.index a {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 28px 0;
  position: relative;
}

.index .num {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
}

.index .title {
  font-size: clamp(1.5rem, 3.6vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  background-image: linear-gradient(var(--rust), var(--rust));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 92%;
  transition: background-size 0.6s var(--ease), color 0.4s;
}

.index .year {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
  transition: transform 0.5s var(--ease), color 0.4s;
}

.index a:hover .title { background-size: 100% 1px; }
.index a:hover .year { color: var(--rust); transform: translateX(-6px); }

.index .desc {
  grid-column: 2 / 3;
  color: var(--ink-2);
  font-size: 1.0625rem;
  margin: 8px 0 0;
  max-width: 56ch;
}

.index .tags {
  grid-column: 2 / 4;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--mute);
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 14px;
}

.index .tags li { border: 0; padding: 0; }

@media (max-width: 560px) {
  .index a { grid-template-columns: 36px 1fr; }
  .index .year { grid-column: 2; grid-row: 3; }
  .index .desc { grid-column: 2; }
  .index .tags { grid-column: 2; }
}

/* ---------- Text links ---------- */

.more {
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink);
  padding-bottom: 4px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.3s, background-image 0.3s;
}

.more .arrow { transition: transform 0.5s var(--ease); }
.more:hover { color: var(--rust); background-image: linear-gradient(var(--rust), var(--rust)); }
.more:hover .arrow { transform: translateX(6px); }

/* ---------- Experience ---------- */

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

.roles li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
}

.roles li:last-child { border-bottom: 1px solid var(--rule); }

.roles .when {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
  padding-top: 6px;
}

.roles .role { font-size: 1.3rem; margin: 0 0 4px; color: var(--ink); }
.roles p { margin: 0; font-size: 1.0625rem; }

@media (max-width: 560px) {
  .roles li { grid-template-columns: 1fr; gap: 6px; }
  .roles .when { padding-top: 0; }
}

/* ---------- Form ---------- */

.form { display: grid; gap: 28px; margin-top: 40px; max-width: 560px; }

.field { display: grid; gap: 8px; }

.field label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.125rem;
  border-radius: 0;
  transition: border-color 0.3s;
}

.field textarea { min-height: 120px; resize: vertical; }

.field input:focus,
.field textarea:focus { outline: none; border-bottom-color: var(--rust); }

.submit {
  justify-self: start;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0 0 4px;
  cursor: pointer;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.3s;
}

.submit:hover { color: var(--rust); background-image: linear-gradient(var(--rust), var(--rust)); }

.form-status { font-family: var(--mono); font-size: 0.8125rem; color: var(--mute); min-height: 1.4em; margin: 0; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0 48px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
}

.site-footer a:hover { color: var(--rust); }

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0ms);
}

.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .mask > span { transform: none; }
  .fade { opacity: 1; }
}

/* =========================================================
   Creative layer
   ========================================================= */

/* Hero with rotating ring badge */
.intro-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
}

.badge {
  position: relative;
  width: 210px;
  height: 210px;
  flex-shrink: 0;
}

.badge .ring {
  width: 100%;
  height: 100%;
  animation: spin 30s linear infinite;
  overflow: visible;
}

.badge .ring text {
  fill: var(--mute);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.badge-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-logo { filter: invert(1); }
}
:root[data-theme="dark"] .badge-logo { filter: invert(1); }

@media (max-width: 760px) {
  .intro-grid { grid-template-columns: 1fr; gap: 40px; }
  .badge { width: 150px; height: 150px; }
  .badge .ring text { font-size: 10px; letter-spacing: 2.4px; }
  .badge-logo { width: 46px; height: 46px; }
}

/* Count-up stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 0;
  padding: 36px 0 0;
  border-top: 1px solid var(--rule);
}

.stats dt {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 14px;
  line-height: 1.5;
}

.stats dd {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stats dd span { color: var(--ink); }

@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 32px 20px; }
  .stats > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Currently */
.now {
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  line-height: 1.35;
  color: var(--ink);
  max-width: 30ch;
  margin: 0;
}

.now em { color: var(--rust); font-style: italic; }

/* Drop cap for the about intro */
.dropcap::first-letter {
  float: left;
  font-size: 4.4em;
  line-height: 0.82;
  padding: 0.09em 0.12em 0 0;
  color: var(--rust);
}

/* Experience timeline with scroll-linked line */
.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 36px;
}

.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
}

.timeline::before { background: var(--rule); }

.timeline::after {
  background: var(--rust);
  height: var(--p, 0%);
  bottom: auto;
  transition: height 0.15s linear;
}

.timeline > li {
  position: relative;
  padding: 0 0 56px;
}

.timeline > li:last-child { padding-bottom: 0; }

.timeline > li::before {
  content: "";
  position: absolute;
  left: -36px;
  top: 9px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rust);
  transform: translateX(0);
}

.timeline .when {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--mute);
  margin: 0 0 6px;
}

.timeline .role {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  line-height: 1.2;
  margin: 0 0 4px;
  color: var(--ink);
}

.timeline .org {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--ink-2);
  margin: 0 0 18px;
}

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

.bullets li {
  position: relative;
  padding-left: 18px;
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.55;
  max-width: 62ch;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 7px;
  height: 1px;
  background: var(--rust);
}

/* Toolbox */
.toolbox { margin: 0; }

.tool-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}

.tool-row:last-child { border-bottom: 1px solid var(--rule); }

.tool-row .label { margin: 4px 0 0; }

.tool-row p {
  margin: 0;
  font-size: 1.1875rem;
  color: var(--ink);
  line-height: 1.6;
}

.tool-row p span { color: var(--ink-2); }

.strengths {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 0;
}

.strengths li {
  font-size: 1.1875rem;
  color: var(--ink);
}

.strengths li + li::before {
  content: "·";
  color: var(--rust);
  padding: 0 14px;
}

@media (max-width: 560px) {
  .tool-row { grid-template-columns: 1fr; gap: 10px; }
}

/* Details block (contact) */
.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 32px;
  margin: 64px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

.details dt { margin-bottom: 6px; }
.details dd { margin: 0; font-size: 1.125rem; color: var(--ink); }
.details dd a { border-bottom: 1px solid var(--rule); transition: border-color 0.3s, color 0.3s; }
.details dd a:hover { color: var(--rust); border-color: var(--rust); }

@media (max-width: 560px) {
  .details { grid-template-columns: 1fr; }
}

/* Download link */
.dl-note {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--mute);
  margin: 40px 0 0;
}

/* Stamp on the project index (mono tag) */
.index .tags li:first-child { color: var(--rust); }

@media (prefers-reduced-motion: reduce) {
  .badge .ring { animation: none; }
  .timeline::after { transition: none; }
}

/* Header: logo only (name stays in the page content and for screen readers) */
.brand span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.logo {
  width: 36px;
  height: 36px;
}

/* About portrait (optional: add assets/profile.jpg) */
.portrait {
  float: right;
  width: min(260px, 42vw);
  margin: 8px 0 24px 36px;
}

.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  filter: grayscale(0.25) contrast(1.02);
  transition: filter 0.6s var(--ease);
}

.portrait:hover img { filter: none; }

@media (max-width: 560px) {
  .portrait { float: none; width: 100%; max-width: 300px; margin: 0 0 32px; }
}

/* Focus areas (home) */
.focus {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 0;
  padding: 36px 0 0;
  border-top: 1px solid var(--rule);
}

.focus h3 {
  font-size: 1.45rem;
  line-height: 1.2;
  font-weight: 400;
  margin: 0 0 10px;
  color: var(--ink);
}

.focus p { margin: 0; font-size: 1.0625rem; color: var(--ink-2); }

@media (max-width: 760px) {
  .focus { grid-template-columns: 1fr; gap: 28px; }
}

/* Recognition link */
.recog-link {
  color: var(--ink);
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 0.3s, background-image 0.3s;
  padding-bottom: 2px;
}
.recog-link:hover { color: var(--rust); background-image: linear-gradient(var(--rust), var(--rust)); }
