/* ------------------------------------------------------------------
   Karthik Thivakar — Portfolio
   Medium-style: white background, serif reading body, green accent.
------------------------------------------------------------------- */

:root {
  --cream: #ffffff;
  --cream-deep: #f7f7f7;
  --ink: #242424;
  --ink-soft: #6b6b6b;
  --muted: #a0a0a0;
  --accent: #1a8917;
  --accent-soft: #d4ecd0;
  --line: rgba(0, 0, 0, 0.12);

  --font-display: "Fraunces", Georgia, serif;
  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --max-w: 1040px;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

a { color: inherit; }

img { display: block; max-width: 100%; }

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Medium-style UI chrome (sans-serif) ---------- */

.nav__links a, .nav, .hero__hello, .hero__meta span, .section__hint,
.work-card__tag, .work-card__cta, .carousel__caption, .carousel__cta,
.exp__role, .exp__co, .exp__time,
.case-hero__tag, .case-meta dt, .case-meta dd, .back-link, .case-note,
.tag-first, .qc-step__label, .video-card__label,
.case-figure figcaption, .essay-figure figcaption, .screens-row figcaption,
.ecosystem-figure figcaption, .case-video figcaption, .case-cover + .case-note,
.footer, .footer a {
  font-family: var(--font-ui);
}

/* placeholder cover for featured cards (swap back to <img> when new art lands) */
.work-card__media--soon {
  background: linear-gradient(135deg, #eef1ee, #dce8d6);
}

.work-card__media--soon span {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav__logo span { color: var(--accent); }

.nav__links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav__links a {
  text-decoration: none;
  font-size: 15px;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.nav__links a:hover { color: var(--accent); }

/* ---------- Hero ---------- */

.hero { padding-block: 88px 72px; }

.hero__hello {
  font-size: 15px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  max-width: 20ch;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero__sub {
  margin-top: 28px;
  max-width: 54ch;
  color: var(--ink-soft);
  font-size: 18px;
}

.hero__meta {
  margin-top: 36px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}

.hero__meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
}

/* ---------- Section headings ---------- */

.section { padding-block: 56px; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
}

.section__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.01em;
}

.section__hint { font-size: 14px; color: var(--muted); }

/* ---------- Featured works ---------- */

.works { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }

.work-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--cream-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.work-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(28, 25, 23, 0.1);
}

.work-card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #f7f7f7, #ececec);
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.work-card:hover .work-card__media img { transform: scale(1.03); }

.work-card__body {
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.work-card__tag {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
}

.work-card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 12px;
}

.work-card__desc { color: var(--ink-soft); font-size: 16px; }

.work-card__cta {
  margin-top: 22px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.work-card__cta::after {
  content: "→";
  transition: transform 0.2s ease;
}

.work-card:hover .work-card__cta { color: var(--accent); }
.work-card:hover .work-card__cta::after { transform: translateX(4px); }

/* ---------- Carousel ---------- */

.carousel { position: relative; }

.carousel__track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.carousel__track::-webkit-scrollbar { display: none; }

.carousel__item {
  flex: 0 0 min(420px, 82%);
  scroll-snap-align: start;
}

.carousel__item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f7f7f7;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel__item--link { text-decoration: none; color: inherit; display: block; }

.carousel__item--link:hover img {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(28, 25, 23, 0.12);
}

.carousel__cta {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}

.carousel__item--link:hover .carousel__cta { text-decoration: underline; }

.carousel__caption {
  margin-top: 12px;
  font-size: 15px;
  color: var(--ink-soft);
}

.carousel__caption strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
}

.carousel__nav {
  display: flex;
  gap: 10px;
}

.carousel__btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.carousel__btn:hover {
  background: var(--ink);
  color: var(--cream);
}

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

.exp { list-style: none; }

.exp li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.exp li:first-child { border-top: 1px solid var(--line); }

.exp__role { font-weight: 600; }

.exp__co { color: var(--ink-soft); font-size: 15px; margin-top: 2px; }

.exp__time {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  align-self: center;
}

/* ---------- About ---------- */

.about__body {
  max-width: 62ch;
  color: var(--ink-soft);
  display: grid;
  gap: 18px;
}

.about__body strong { color: var(--ink); }

.about__creds {
  margin-top: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}

.about__creds p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 3px 16px;
  align-items: baseline;
}

.about__creds span {
  min-width: 118px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ---------- Tools ---------- */

.tools__group { margin-bottom: 28px; }

.tools__group:last-child { margin-bottom: 0; }

.tools__label {
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.tools__label--ai { color: var(--accent); }

.tools__pills { display: flex; flex-wrap: wrap; gap: 10px; }

.tools__pills span {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
}

/* ---------- Contact / footer ---------- */

.contact {
  padding-block: 96px 72px;
  text-align: center;
}

.contact h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 52px);
  letter-spacing: -0.02em;
}

.contact h2 em { font-style: italic; color: var(--accent); }

.contact__email {
  display: inline-block;
  margin-top: 28px;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 3px;
  transition: color 0.2s ease;
}

.contact__email:hover { color: var(--accent); }

.footer {
  border-top: 1px solid var(--line);
  padding: 26px 0 40px;
}

.footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.footer a { color: var(--ink-soft); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer__links { display: flex; gap: 20px; }

/* ---------- Case study pages ---------- */

.case-hero { padding-block: 72px 48px; }

.case-hero__tag {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 16px;
}

.case-hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 22ch;
}

.case-hero__sub {
  margin-top: 20px;
  max-width: 58ch;
  color: var(--ink-soft);
  font-size: 18px;
}

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 40px 0;
}

.case-meta dt {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.case-meta dd { font-size: 15px; color: var(--ink); }

.case-cover {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #f7f7f7, #ececec);
  padding: 24px;
  display: flex;
  justify-content: center;
}

.case-cover img {
  max-width: 100%;
  max-height: 560px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
}

.case-section { padding-block: 48px; max-width: 720px; }

.case-note {
  max-width: 620px;
  margin-top: 20px;
  padding: 16px 20px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}

.case-highlight {
  background: linear-gradient(150deg, #f6f8f6, #edf1ec);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 8px 0;
}

.case-highlight strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--ink);
}

.case-highlight p { margin: 0; color: var(--ink-soft); font-size: 16px; }

.case-highlight {
  background: linear-gradient(150deg, #f6f8f6, #edf1ec);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 8px 0;
}

.case-highlight strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--ink);
}

.case-highlight p { margin: 0; color: var(--ink-soft); font-size: 16px; }

.case-section h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  margin-bottom: 18px;
}

.case-section p { color: var(--ink-soft); margin-bottom: 16px; }

.case-section ul {
  color: var(--ink-soft);
  padding-left: 22px;
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.case-figure { margin: 28px 0; }

.case-figure img {
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: linear-gradient(135deg, #f7f7f7, #ececec);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
}

.case-figure figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.case-quote {
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 22px;
  margin: 28px 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-style: italic;
  color: var(--ink);
  line-height: 1.4;
}

.case-next {
  border-top: 1px solid var(--line);
  padding: 56px 24px 72px;
  text-align: center;
}

.case-next p {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.case-next a {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 4vw, 40px);
  text-decoration: none;
  transition: color 0.2s ease;
}

.case-next a:hover { color: var(--accent); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 15px;
  color: var(--ink-soft);
  text-decoration: none;
}

.back-link:hover { color: var(--accent); }

/* ---------- Video ---------- */

.case-gallery { padding-block: 24px 40px; }

.case-gallery__head { max-width: 720px; margin-bottom: 28px; }

.case-gallery h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  margin-bottom: 12px;
}

.case-gallery__sub { color: var(--ink-soft); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.video-card { display: flex; flex-direction: column; }

.video-embed {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--ink);
  cursor: pointer;
}

.video-embed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.video-embed:hover img { transform: scale(1.03); }

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(247, 242, 233, 0.94);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding-left: 4px;
  pointer-events: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.video-embed:hover .video-embed__play { transform: scale(1.08); background: var(--cream); }

.video-card__label { margin-top: 12px; font-weight: 600; font-size: 15px; }

.case-video { margin: 28px 0; }

.case-video figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* ---------- Ecosystem grid ---------- */

.case-ecosystem { padding-block: 24px 40px; }

.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.ecosystem-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(150deg, #f6f8f6, #edf1ec);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.ecosystem-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 21px;
  margin-bottom: 8px;
}

.ecosystem-card p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.tag-first {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.ecosystem-figure { margin-top: 26px; }

.ecosystem-figure img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.ecosystem-figure figcaption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Quick-commerce alternating flow ---------- */

.qc-step {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
  padding-block: 46px;
  border-bottom: 1px solid var(--line);
}

.qc-step:last-child { border-bottom: none; }

.qc-step__media { display: flex; justify-content: center; }

.qc-step__media img {
  max-height: 640px;
  width: auto;
  max-width: 86%;
  border-radius: 26px;
  box-shadow: 0 18px 44px rgba(28, 25, 23, 0.15);
}

.qc-step--flip .qc-step__media { order: -1; }

.qc-step__label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
}

.qc-step__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qc-step h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 27px;
  line-height: 1.2;
  margin-bottom: 14px;
}

.qc-step p { color: var(--ink-soft); font-size: 16px; }

.qc-step p b { color: var(--ink); font-weight: 600; }

@media (max-width: 760px) {
  .qc-step {
    grid-template-columns: 1fr;
    gap: 26px;
    padding-block: 34px;
  }
  .qc-step--flip .qc-step__media { order: 0; }
  .qc-step__media img { max-height: 560px; }
}

/* ---------- Essay / long-form (Chennai One) ---------- */

.essay-figure { margin: 16px 0; }

.essay-figure img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.essay-figure figcaption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  max-width: 640px;
}

.screens-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin: 12px 0;
}

.screens-row figure { margin: 0; }

.screens-row img {
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 32px rgba(28, 25, 23, 0.13);
}

.screens-row figcaption {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.essay-lead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
}

@media (max-width: 760px) {
  .screens-row { grid-template-columns: 1fr; justify-items: center; }
  .screens-row figure { max-width: 300px; }
}

/* ---------- Reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .works { grid-template-columns: 1fr; }
  .work-card__body { padding: 26px; }
  .nav { flex-wrap: wrap; gap: 10px 16px; }
  .nav__logo { font-size: 20px; }
  .nav__links { gap: 14px; }
  .nav__links a { font-size: 14px; }
  .hero { padding-block: 56px 48px; }
  .exp li { grid-template-columns: 1fr; gap: 4px; }
  .video-grid { grid-template-columns: 1fr; }
  .ecosystem-grid { grid-template-columns: 1fr; }
}
