/* ─────────────────────────────────────────────────────────
   Debaditya Malakar — portfolio
   Layered on top of W3.CSS; W3.CSS handles the grid and bar,
   this file handles type, colour and everything bespoke.
   ───────────────────────────────────────────────────────── */

/* Palette sampled from the reference painting: night-navy sky (#193050),
   slate-blue cloudbank (#728592), warm ivory wings (#ffd09d), blonde
   (#eec37f) and an ember-gold flame (#ffaf0f). Kept pastel — low
   saturation, soft contrast — over a deep dark base. */

:root[data-theme="dark"] {
  --bg:        #0d1626;  /* below the sky, deepest night   */
  --bg-alt:    #13223a;  /* sky navy                        */
  --surface:   #1a2c46;  /* lit cloud in shadow             */
  --border:    #2a3f5e;
  --text:      #f3e4cf;  /* wing ivory                      */
  --text-soft: #aabbce;  /* pastel periwinkle cloud         */
  --text-dim:  #77899f;
  --accent:    #ffc46b;  /* softened flame gold             */
  --accent-2:  #f2a03c;  /* ember                           */
  --accent-dim:rgba(255, 196, 107, 0.13);
  --glow:      rgba(255, 175, 15, 0.16);
  --shadow:    0 1px 3px rgba(4, 9, 18, 0.55);
  --danger:    #e59a90;
}

:root[data-theme="light"] {
  --bg:        #f5f7fb;  /* daylit cloudbank                */
  --bg-alt:    #e9eef5;
  --surface:   #fffdf9;  /* warm ivory                      */
  --border:    #d5dee9;
  --text:      #15243a;
  --text-soft: #4c5f78;
  --text-dim:  #7d8ea5;
  --accent:    #a2620d;
  --accent-2:  #c07b18;
  --accent-dim:rgba(162, 98, 13, 0.10);
  --glow:      rgba(255, 175, 15, 0.14);
  --shadow:    0 1px 3px rgba(21, 36, 58, 0.08);
  --danger:    #b4443c;
}

:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

code, .mono, .project-index, .num, .ver, .eyebrow {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1060px; margin: 0 auto; width: 100%; }
.muted { color: var(--text-soft); }

/* ── reading progress ─────────────────────────────────── */

.progress-rail {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 2px;
  background: transparent; z-index: 6;
}
.progress-fill {
  height: 100%; width: 0;
  /* the flame sword, drawn edge-on */
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 8px var(--glow);
}

/* ── top bar ──────────────────────────────────────────── */

.site-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center;
  justify-content: flex-end;
  padding: 0 max(24px, calc((100% - 1060px) / 2));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-bar .w3-button { color: var(--text); background: transparent; }
.site-bar .w3-button:hover { background: var(--bg-alt); color: var(--text); }

.brand {
  margin-right: auto;
  font-weight: 600; letter-spacing: -0.01em;
  padding-left: 0 !important;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  color: var(--accent);
  margin-right: 6px;
  text-shadow: 0 0 10px var(--glow);
}

.nav-link {
  font-size: 14.5px;
  color: var(--text-soft) !important;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--text) !important; }
.nav-link.active {
  color: var(--text) !important;
  border-bottom-color: var(--accent);
}

.theme-btn, .menu-btn { font-size: 17px; line-height: 1; }

/* ── mobile drawer ────────────────────────────────────── */

.drawer {
  display: none;
  position: sticky; top: 51px; z-index: 5;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.drawer.open { display: block; }
.drawer a { display: block; color: var(--text) !important; }

/* ── hero ─────────────────────────────────────────────── */

.hero {
  padding: clamp(72px, 13vh, 132px) 24px clamp(56px, 9vh, 96px);
  position: relative;
  overflow: hidden;
  /* night sky settling into cloud, with a low warm ember off to one side */
  background:
    radial-gradient(120% 90% at 85% -10%, var(--bg-alt) 0%, transparent 62%),
    radial-gradient(60% 55% at 8% 88%, var(--glow) 0%, transparent 70%);
}
.hero::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 22%, var(--border) 78%, transparent);
}

.eyebrow {
  font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 20px;
}

.hero .wrap { position: relative; z-index: 1; }

.hero-title {
  font-size: clamp(2.6rem, 7.2vw, 4.6rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
  font-weight: 650;
  margin: 0 0 22px;
  /* ivory falling into blonde, as on the wings */
  background: linear-gradient(112deg, var(--text) 38%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: clamp(1.05rem, 2.1vw, 1.3rem);
  color: var(--text-soft);
  max-width: 40ch;
  margin: 0 0 34px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 52px; }

.btn-solid, .btn-ghost {
  border-radius: 3px; font-size: 15px; padding: 10px 20px;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}
.btn-solid {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #17233a; font-weight: 600;
}
.btn-solid:hover {
  color: #17233a; transform: translateY(-1px); text-decoration: none;
  box-shadow: 0 4px 18px var(--glow);
}
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-alt); border-color: var(--accent); color: var(--text); text-decoration: none; }

.hero-meta {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 14px 48px;
  border-top: 1px solid var(--border); padding-top: 26px;
}
.meta-item { display: flex; flex-direction: column; }
.meta-item strong {
  font-size: 1.7rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.2;
}
.meta-item span {
  font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-dim);
}

/* ── sections ─────────────────────────────────────────── */

.section { padding: clamp(64px, 9vh, 104px) 24px; }
.section.alt { background: var(--bg-alt); }

.section-title {
  font-size: clamp(1.5rem, 3vw, 1.95rem);
  font-weight: 600; letter-spacing: -0.025em;
  margin: 0 0 28px;
  display: flex; align-items: baseline; gap: 14px;
}
.num { font-size: 0.72em; color: var(--accent); font-weight: 400; }

.section-note { color: var(--text-soft); margin: -14px 0 30px; font-size: 15px; }

.lead { font-size: 1.1rem; margin: 0 0 18px; }
.prose-row { display: flex; flex-wrap: wrap; gap: 32px 0; }
.prose-row .w3-col { padding: 0; }
.prose-row .w3-col.l7 { max-width: 58%; }
.prose-row .w3-col.l4 { max-width: 34%; margin-left: auto; }

/* ── cards ────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600;
  margin: 0 0 16px;
}

.principles ul { list-style: none; margin: 0; padding: 0; }
.principles li {
  padding: 9px 0 9px 20px; position: relative;
  color: var(--text-soft); font-size: 14.5px;
  border-top: 1px solid var(--border);
}
.principles li:first-child { border-top: none; padding-top: 0; }
.principles li::before {
  content: "◆"; position: absolute; left: 0; top: 9px;
  color: var(--accent); font-size: 8px;
}
.principles li:first-child::before { top: 0; }

/* ── tags ─────────────────────────────────────────────── */

.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: 12.5px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-soft);
  background: var(--bg);
  white-space: nowrap;
}

/* ── skills ───────────────────────────────────────────── */

/* W3.CSS columns float, so `height: 100%` on a card is a no-op and cards in a
   row end up ragged. Make the row a stretch flex container and let each column
   be a flex box the card can fill. */
.skill-grid, .activity-grid { display: flex; flex-wrap: wrap; align-items: stretch; }
.skill-col, .activity-col { display: flex; margin-bottom: 22px; float: none; }
.skill-card, .activity { width: 100%; }

/* ── projects ─────────────────────────────────────────── */

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.chip {
  font-size: 13px; padding: 5px 14px; border-radius: 100px;
  background: transparent; color: var(--text-soft);
  border: 1px solid var(--border);
}
.chip:hover { background: var(--surface); color: var(--text); }
.chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.project {
  margin-bottom: 22px; padding: 30px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.project:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow), 0 0 26px -12px var(--glow);
}
.project[hidden] { display: none; }

.project-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 4px; }
.project-index { color: var(--text-dim); font-size: 13px; }
.project-name { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.project-name a { color: var(--text); }
.project-name a:hover { color: var(--accent); text-decoration: none; }

.badge {
  margin-left: auto;
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 100px;
  background: var(--accent-dim); color: var(--accent);
}

.project-tagline { color: var(--text-soft); margin: 0 0 6px; }
.project-url { font-size: 13.5px; word-break: break-all; }
.project-note {
  font-size: 13px; color: var(--accent);
  margin: 10px 0 0;
}

.project-points { margin: 18px 0 20px; padding-left: 18px; }
.project-points li { margin-bottom: 9px; color: var(--text-soft); font-size: 15px; }
.project-points li::marker { color: var(--accent); }

.empty { padding: 30px 0; }

/* ── activities ───────────────────────────────────────── */

.activity p { margin: 0; font-size: 15px; }

/* ── contact ──────────────────────────────────────────── */

.contact-wrap { max-width: 640px; }

.contact-form { margin: 30px 0 40px; }
.field { display: block; margin-bottom: 16px; }
.field span {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
}
.field input, .field textarea {
  width: 100%; padding: 11px 13px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font: inherit; font-size: 15px;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
}
.field input.invalid { border-color: var(--danger); }

.form-error { color: var(--danger); font-size: 14px; margin: 0 0 14px; }
.form-hint { font-size: 13px; color: var(--text-dim); margin: 12px 0 0; }
.form-hint code { color: var(--text-soft); font-size: 12.5px; }

.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.links li {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  padding: 13px 0; border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.link-label {
  min-width: 150px;
  font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
  align-self: center;
}

/* ── footer ───────────────────────────────────────────── */

.site-footer { border-top: 1px solid var(--border); padding: 30px 24px; }
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  justify-content: space-between; align-items: center;
  font-size: 14px;
}
.footer-inner p { margin: 0; }
.ver { color: var(--text-dim); font-size: 12px; }

.noscript-note {
  padding: 24px; border-top: 1px solid var(--border); color: var(--text-soft);
}

/* ── reveal-on-scroll ─────────────────────────────────── */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.shown {
  opacity: 1; transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ── responsive ───────────────────────────────────────── */

@media (max-width: 992px) {
  .prose-row .w3-col.l7,
  .prose-row .w3-col.l4 { max-width: 100%; margin-left: 0; }
  .site-bar { padding: 0 16px; }
  .hero, .section { padding-left: 18px; padding-right: 18px; }
  .site-footer { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .project { padding: 22px; }
  .badge { margin-left: 0; }
  .hero-meta { gap: 18px 32px; }
  .link-label { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn-solid:hover { transform: none; }
}
