/* =========================================================
   chinmayrajhans.com
   Mid-century / Bauhaus: poster type, geometric tiles,
   Mandarin + Forest, Crest yellow as the accent only.
   ========================================================= */

@font-face {
  font-family: "Anton";
  src: url("/fonts/anton-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Palette (fixed by the owner) */
  --mandarin: #FD550A;
  --forest: #005C47;
  --crest: #E0F354; /* accent only: tags, hover sweep, selection, the shuffle button, one tile */
  --cream: #F4EDE1;
  --ink: #10261F;

  /* Roles: light */
  --bg: var(--cream);
  --text: var(--ink);
  --muted: #4E625B;
  --line: rgba(16, 38, 31, 0.16);
  --name-alt: var(--forest);
  --tile-c: #E8DCC6;
  --focus: var(--forest);

  /* Type */
  --display: "Anton", Impact, "Arial Narrow", sans-serif;
  --sans: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Space and shape */
  --wrap: 76rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --header-h: 4.75rem;

  /* Motion (Emil Kowalski's curves) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C1E19;
    --text: #F1EADC;
    --muted: #A9B8B0;
    --line: rgba(241, 234, 220, 0.14);
    --name-alt: var(--mandarin);
    --tile-c: #F1EADC;
    --focus: var(--crest);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--forest) var(--bg);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.6;
  caret-color: var(--mandarin);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Paper grain, very faint */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

main { flex: 1; }

::selection { background: var(--crest); color: var(--forest); }

a {
  color: inherit;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.24em;
}

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
}

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

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

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  z-index: 60;
  padding: 0.6rem 0.9rem;
  background: var(--crest);
  color: var(--forest);
  font-weight: 600;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Header ---------- */
.site-header .wrap {
  min-height: var(--header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { display: block; width: 30px; height: 30px; }

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-nav form { display: contents; }
.site-nav a,
.site-nav button {
  position: relative;
  padding: 0.35rem 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}
.site-nav a::after,
.site-nav button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease-out);
}
.site-nav a:hover,
.site-nav button:hover,
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a:hover::after,
.site-nav button:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn .icon { transition: transform 0.25s var(--ease-out); }

.btn-primary { background: var(--mandarin); color: var(--ink); }
.btn-ghost { border-color: currentColor; color: var(--text); }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: #FF6A26; }
  .btn-primary:hover .icon { transform: translateX(3px); }
  .btn-ghost:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - var(--header-h));
}
.hero .wrap {
  flex: 1;
  display: grid;
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
  padding-block: clamp(2rem, 6vw, 4rem) clamp(3rem, 7vw, 5rem);
}
@media (min-width: 960px) {
  .hero .wrap { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.005em;
  text-transform: uppercase;
}
.display > span { display: block; }

.hero h1 { font-size: clamp(3rem, 22vw, 10rem); }
@media (min-width: 960px) {
  .hero h1 { font-size: clamp(6rem, 11.5vw, 10.5rem); }
}
.hero h1 .alt { color: var(--name-alt); }

.lede {
  margin: 2rem 0 2.25rem;
  max-width: 34rem;
  font-size: clamp(1.15rem, 1.9vw, 1.375rem);
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Tile pattern ---------- */
.tiles-wrap {
  position: relative;
  width: 100%;
  max-width: 32rem;
}
@media (min-width: 960px) { .tiles-wrap { justify-self: end; } }

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  aspect-ratio: 1;
  overflow: hidden;
}

.t {
  position: relative;
  overflow: hidden;
  background: var(--tb);
  transition: background-color 0.45s ease;
}
.t > i {
  position: absolute;
  inset: 0;
  transition: transform 0.5s var(--ease-in-out);
}
.t > i::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tf);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition:
    background-color 0.45s ease,
    inset 0.5s var(--ease-in-out),
    border-radius 0.5s var(--ease-in-out),
    clip-path 0.5s var(--ease-in-out);
}
.tiles .t { cursor: pointer; }

.bg-o { --tb: var(--mandarin); }
.bg-g { --tb: var(--forest); }
.bg-c { --tb: var(--tile-c); }
.bg-i { --tb: var(--ink); }
.fg-o { --tf: var(--mandarin); }
.fg-g { --tf: var(--forest); }
.fg-c { --tf: var(--tile-c); }
.fg-i { --tf: var(--ink); }
.fg-y { --tf: var(--crest); }

.s-circle > i::before  { inset: 0; border-radius: 50%; }
.s-half > i::before    { inset: 50% 0 0 0; border-radius: 100vmax 100vmax 0 0; }
.s-quarter > i::before { inset: 0; border-radius: 100% 0 0 0; }
.s-tri > i::before     { inset: 0; clip-path: polygon(0 0, 0 0, 100% 100%, 0 100%); }
.s-dot > i::before     { inset: 31%; border-radius: 50%; }

.shuffle {
  position: absolute;
  right: -1rem;
  bottom: -1rem;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border: 0;
  border-radius: 50%;
  background: var(--crest);
  color: var(--forest);
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(16, 38, 31, 0.55);
  transition: transform 160ms var(--ease-out);
}
.shuffle[hidden] { display: none; }
.shuffle .icon { width: 1.5rem; height: 1.5rem; transition: transform 0.5s var(--ease-in-out); }
.shuffle:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .shuffle:hover { transform: scale(1.06); }
  .shuffle:hover:active { transform: scale(0.97); }
}
@media (max-width: 559px) {
  .shuffle { right: 0.75rem; bottom: 0.75rem; width: 3.5rem; height: 3.5rem; }
}

/* ---------- Checker stripe ---------- */
.checker {
  height: 1.25rem;
  background: repeating-linear-gradient(90deg, var(--forest) 0 2.5rem, var(--tile-c) 2.5rem 5rem);
}

/* ---------- Sections ---------- */
.section {
  display: grid;
  gap: 1.25rem 3rem;
  padding-block: clamp(4rem, 9vw, 7rem);
}
.section + .section { border-top: 1px solid var(--line); }
@media (min-width: 960px) {
  .section { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); }
}

.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  line-height: 0.92;
  text-transform: uppercase;
}

.prose {
  max-width: 40rem;
  font-size: clamp(1.2rem, 2.1vw, 1.55rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Row lists (projects, links) ---------- */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 2px solid currentColor;
}
.rows > li { border-bottom: 1px solid var(--line); }

.row {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 1.5rem 0.25rem;
  text-decoration: none;
  transition: color 0.25s ease, padding 0.35s var(--ease-out);
}
/* Crest-yellow sweep: the accent appears on interaction */
.row::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--crest);
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.35s var(--ease-out);
}
.row:focus-visible { outline-offset: 0; }

.row-title {
  display: block;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1;
  text-transform: uppercase;
}
.row-desc { display: block; margin-top: 0.5rem; color: var(--muted); transition: color 0.25s ease; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.85rem; }

.row-go {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  transition: transform 0.35s var(--ease-out), background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.row-go .icon { width: 1.35rem; height: 1.35rem; }

@media (hover: hover) and (pointer: fine) {
  .row:hover { color: var(--forest); padding-inline: 1.25rem; }
  .row:hover::before { clip-path: inset(0 0 0 0); }
  .row:hover .row-desc { color: var(--forest); }
  .row:hover .row-go { background: var(--forest); border-color: var(--forest); color: var(--crest); transform: rotate(-45deg); }
}
.row:focus-visible { color: var(--forest); }
.row:focus-visible::before { clip-path: inset(0 0 0 0); }
.row:focus-visible .row-desc { color: var(--forest); }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  background: var(--crest);
  color: var(--forest);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (hover: hover) and (pointer: fine) {
  .row:hover .tag { background: var(--forest); color: var(--crest); }
}
.row:focus-visible .tag { background: var(--forest); color: var(--crest); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.75rem;
  font-weight: 600;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}
.text-link:hover { text-decoration-color: currentColor; }

/* ---------- Contact band (Mandarin owns this region) ---------- */
.band {
  background: var(--mandarin);
  color: var(--ink);
  --line: rgba(16, 38, 31, 0.28);
  --muted: var(--ink);
  --focus: var(--ink);
}
.band .section { padding-block: clamp(4rem, 9vw, 6.5rem); }

/* ---------- Inner page heads ---------- */
.page-head .wrap {
  display: grid;
  align-items: end;
  gap: 2rem;
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4rem);
}
@media (min-width: 720px) {
  .page-head .wrap { grid-template-columns: minmax(0, 1fr) auto; }
}
.page-head h1 { font-size: clamp(4rem, 14vw, 9rem); }
.page-head p { max-width: 34rem; margin: 1.5rem 0 0; font-size: 1.2rem; color: var(--muted); }
.page-head .actions { margin-top: 2rem; }

.mini-tiles {
  display: grid;
  grid-template-columns: repeat(4, clamp(3rem, 7vw, 4.5rem));
  grid-auto-rows: clamp(3rem, 7vw, 4.5rem);
}

.page-body { padding-block: clamp(3rem, 7vw, 5rem); }

/* ---------- Login ---------- */
.login .wrap {
  display: grid;
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 7vw, 5.5rem);
}
@media (min-width: 960px) {
  .login .wrap { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
}
@media (max-width: 959px) {
  .login-art { display: none; }
}
.login h1 { font-size: clamp(4rem, 13vw, 8.5rem); }
.login-note { max-width: 30rem; margin: 1.5rem 0 0; font-size: 1.2rem; color: var(--muted); }

.form { display: grid; gap: 1.25rem; max-width: 26rem; margin-top: 2.25rem; }
.form .btn { justify-self: start; margin-top: 0.5rem; }

.field { display: grid; gap: 0.45rem; }
.field label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  height: 3.25rem;
  padding: 0 1rem;
  border: 2px solid var(--text);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16px+ so phones don't zoom on focus */
}
.field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--bg) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--mandarin);
}

.form-error {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--mandarin);
  color: var(--ink);
  font-weight: 500;
}
.form-error[hidden] { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--forest);
  color: var(--cream);
  --focus: var(--crest);
}
.footer-mark {
  display: block;
  width: 100%;
  height: auto;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.footer-mark text {
  font-family: var(--display);
  font-size: 160px;
  fill: var(--mandarin);
  text-transform: uppercase;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.75rem 2.25rem;
  font-size: 0.875rem;
  color: #B9D3C8;
}
.footer-row a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--cream);
  font-weight: 500;
  text-decoration: none;
}
.footer-row a:hover { color: var(--crest); }

/* ---------- The one authored moment: the hero assembles on load ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(0.18em); }
  to   { opacity: 1; transform: none; }
}
@keyframes tile-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* fill-mode "backwards": hold the start frame during the delay, then hand control back to
   normal styles so hover and press transforms still work afterwards. */
.hero h1 > span { animation: rise 0.8s var(--ease-out) backwards; }
.hero h1 > span:nth-child(2) { animation-delay: 70ms; }
.hero .lede, .hero .actions { animation: fade-in 0.6s ease backwards; animation-delay: 220ms; }
.tiles .t { animation: tile-in 0.55s var(--ease-out) backwards; animation-delay: calc(120ms + var(--d, 0) * 45ms); }
.shuffle { animation: tile-in 0.45s var(--ease-out) backwards; animation-delay: 520ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero h1 > span, .tiles .t, .shuffle { animation-name: fade-in; animation-duration: 0.3s; }
  .t, .t > i, .t > i::before, .row, .row::before, .row-go, .btn, .shuffle, .shuffle .icon { transition-duration: 0.01ms !important; }
  .row:hover { padding-inline: 0.25rem; }
  .row:hover .row-go { transform: none; }
}
