/* ============================================================
   Tharaka De Silva — personal journal
   Type: Fraunces (display) · Inter (text) · IBM Plex Mono (data)
   ============================================================ */

:root {
  --paper: #f2efe8;
  --paper-deep: #e9e4d9;
  --ink: #17130c;
  --ink-soft: #4b463c;
  --ink-faint: #8a8375;
  --copper: #c2531d;
  --thermal: #5b2d86;
  --line: rgba(23, 19, 12, 0.16);
  --font-display: "Fraunces", Georgia, serif;
  --font-text: "Inter", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --gutter: clamp(1.25rem, 4vw, 4rem);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

a { color: inherit; }

/* ---------- texture grain ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--gutter);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.nav.scrolled {
  background: rgba(242, 239, 232, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}

.nav-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: 500;
}

.nav-name span { color: var(--copper); }

.nav-links {
  display: flex;
  gap: 2.25rem;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
  transition: color 0.25s;
}

.nav-links a:hover, .nav-links a.active { color: var(--ink); }

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -5px;
  width: 100%;
  height: 1px;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1);
}

.nav-links a:hover::after, .nav-links a.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-clock {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

@media (max-width: 960px) {
  .nav-clock { display: none; }
}

@media (max-width: 860px) {
  .nav { padding: 1rem var(--gutter); }
  .nav-name { font-size: 0.7rem; letter-spacing: 0.1em; }
  .nav-links { gap: 1.1rem; }
  .nav-links a { font-size: 0.66rem; letter-spacing: 0.1em; }
}

@media (max-width: 380px) {
  .nav-name { font-size: 0.66rem; }
  .nav-links { gap: 0.85rem; }
}

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7rem var(--gutter) 4rem;
  position: relative;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hero-eyebrow::before {
  content: "";
  width: 3rem;
  height: 1px;
  background: var(--copper);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(3rem, 10.5vw, 8.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 15ch;
}

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

.hero-sub {
  margin-top: 2.75rem;
  max-width: 44ch;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--ink-soft);
}

.hero-meta {
  position: absolute;
  bottom: 2.5rem;
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.hero-meta .scroll-hint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hero-meta .scroll-hint::after {
  content: "↓";
  animation: bob 1.8s ease-in-out infinite;
  color: var(--copper);
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* ---------- marquee ---------- */
.marquee {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
  padding: 0.9rem 0;
  background: var(--ink);
  color: var(--paper);
}

.marquee-track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 36s linear infinite;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
}

.marquee-track span i {
  font-style: normal;
  color: var(--copper);
  margin-left: 3rem;
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- section scaffolding ---------- */
.section {
  padding: clamp(5rem, 10vw, 9rem) var(--gutter);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(2rem, 4.5vw, 3.6rem);
  letter-spacing: -0.02em;
}

.section-head h2 em { font-style: italic; color: var(--copper); font-weight: 300; }

.section-head .count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

/* ---------- work list ---------- */
.work-list { display: flex; flex-direction: column; }

.work-item {
  display: grid;
  grid-template-columns: 5rem 1fr minmax(280px, 42%);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  position: relative;
}

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

.work-index {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  align-self: start;
  padding-top: 0.5rem;
}

.work-info h3 {
  font-family: var(--font-display);
  font-weight: 380;
  font-size: clamp(1.6rem, 3.2vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  max-width: 18ch;
  transition: color 0.3s;
}

.work-item:hover .work-info h3 { color: var(--copper); }

.work-info p {
  margin-top: 1.1rem;
  color: var(--ink-soft);
  max-width: 46ch;
  font-size: 0.98rem;
}

.work-tags {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.work-tags span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--ink-soft);
}

.work-media {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
}

.work-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.6s;
  filter: saturate(0.92);
}

.work-item:hover .work-media img {
  transform: scale(1.045);
  filter: saturate(1.05);
}

.work-cta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper);
  margin-top: 1.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.work-cta::after { content: "→"; transition: transform 0.3s; }
.work-item:hover .work-cta::after { transform: translateX(6px); }

@media (max-width: 820px) {
  .work-item { grid-template-columns: 1fr; gap: 1.5rem; }
  .work-index { padding-top: 0; }
  .work-media { order: -1; }
}

.work-media--empty {
  background: var(--paper-deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23c2531d' stroke-opacity='.18'/%3E%3C/svg%3E");
}

.work-loading {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 3rem 0;
  border-top: 1px solid var(--line);
}

/* ---------- statement band ---------- */
.statement {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(6rem, 12vw, 10rem) var(--gutter);
  text-align: left;
}

.statement p {
  font-family: var(--font-display);
  font-weight: 330;
  font-size: clamp(1.7rem, 4vw, 3.4rem);
  line-height: 1.28;
  letter-spacing: -0.01em;
  max-width: 26ch;
}

.statement p em { font-style: italic; color: var(--copper); }

.statement .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(242, 239, 232, 0.45);
  display: block;
  margin-bottom: 2.5rem;
}

/* ---------- about teaser ---------- */
.about-teaser {
  display: grid;
  grid-template-columns: minmax(260px, 38%) 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

.about-teaser .frame {
  position: relative;
  overflow: hidden;
}

.about-teaser .frame img { filter: saturate(0.9); transition: filter .6s; width: 100%; }
.about-teaser .frame:hover img { filter: saturate(1.05); }

.about-teaser .frame .tag {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--paper);
  padding: 0.4rem 0.8rem;
}

.about-teaser h2 {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(1.9rem, 3.6vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 1.75rem;
}

.about-teaser h2 em { font-style: italic; color: var(--copper); font-weight: 300; }

.about-teaser p { color: var(--ink-soft); max-width: 52ch; margin-bottom: 1.25rem; }

@media (max-width: 760px) {
  .about-teaser { grid-template-columns: 1fr; }
}

.text-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--copper);
  padding-bottom: 0.3rem;
  transition: color 0.25s;
  display: inline-block;
  margin-top: 0.75rem;
}

.text-link:hover { color: var(--copper); }

/* ---------- footer ---------- */
.footer {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(5rem, 10vw, 8rem) var(--gutter) 2rem;
}

.footer-cta {
  margin-bottom: clamp(4rem, 8vw, 6rem);
}

.footer-cta .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(242, 239, 232, 0.45);
  display: block;
  margin-bottom: 1.75rem;
}

.footer-cta a.big {
  font-family: var(--font-display);
  font-weight: 330;
  font-size: clamp(2rem, 6.5vw, 5.5rem);
  letter-spacing: -0.02em;
  text-decoration: none;
  line-height: 1.05;
  display: inline-block;
  position: relative;
  transition: color 0.3s;
  word-break: break-word;
}

.footer-cta a.big:hover { color: var(--copper); font-style: italic; }

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(242, 239, 232, 0.15);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(242, 239, 232, 0.55);
}

.footer-grid a {
  color: rgba(242, 239, 232, 0.8);
  text-decoration: none;
  transition: color 0.25s;
}

.footer-grid a:hover { color: var(--copper); }

.footer-grid .col { display: flex; flex-direction: column; gap: 0.6rem; }

/* ---------- article pages ---------- */
.article-hero {
  padding: 10rem var(--gutter) 3rem;
}

.article-hero .crumb {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
  display: inline-flex;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.article-hero .crumb:hover { color: var(--copper); }
.article-hero .crumb::before { content: "←"; }

.article-hero h1 {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  max-width: 20ch;
}

.article-hero h1 em { font-style: italic; color: var(--copper); font-weight: 300; }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 4rem);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.article-meta .kv span { display: block; color: var(--ink-faint); margin-bottom: 0.35rem; }
.article-meta .kv b { font-weight: 500; color: var(--ink); }

.article-lead-media {
  padding: 2rem var(--gutter) 0;
}

.article-lead-media img {
  width: 100%;
  max-height: 78vh;
  object-fit: cover;
}

.article-body {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 7vw, 6rem) var(--gutter);
}

.article-body > * + * { margin-top: 1.6rem; }

.article-body h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-top: 3.5rem;
}

.article-body h2::before {
  content: "◦ ";
  color: var(--copper);
}

.article-body p { color: var(--ink-soft); }
.article-body strong { color: var(--ink); }
.article-body a { color: var(--ink); text-decoration-color: var(--copper); text-underline-offset: 3px; }
.article-body a:hover { color: var(--copper); }

.article-body ul, .article-body ol { padding-left: 1.4rem; color: var(--ink-soft); }
.article-body li { margin-top: 0.5rem; }
.article-body li::marker { color: var(--copper); font-family: var(--font-mono); font-size: .85em; }

.callout {
  border-left: 2px solid var(--copper);
  padding: 1.25rem 1.5rem;
  background: var(--paper-deep);
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.callout b {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--copper);
  display: block;
  margin-bottom: 0.5rem;
}

.data-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 2.5rem 0 !important;
}

.data-strip .cell {
  background: var(--paper);
  padding: 1.25rem 1rem;
}

.data-strip .cell b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  display: block;
  letter-spacing: -0.02em;
}

.data-strip .cell span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

figure { margin: 3rem 0 !important; }

figure img { width: 100%; background: var(--paper-deep); }

figure.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

figure.duo img { height: 100%; object-fit: cover; }

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

figcaption {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-top: 0.9rem;
  text-transform: uppercase;
}

figcaption::before { content: "fig. "; color: var(--copper); }

/* prev / next */
.article-nav {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.article-nav a {
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter);
  text-decoration: none;
  transition: background 0.3s;
}

.article-nav a:hover { background: var(--paper-deep); }

.article-nav a + a { border-left: 1px solid var(--line); text-align: right; }

.article-nav .dir {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 0.9rem;
}

.article-nav .title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.article-nav a:hover .title { color: var(--copper); }

@media (max-width: 560px) {
  .article-nav { grid-template-columns: 1fr; }
  .article-nav a + a { border-left: 0; border-top: 1px solid var(--line); text-align: left; }
}

/* ---------- about page ---------- */
.about-hero {
  padding: 10rem var(--gutter) 4rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: end;
}

.about-hero h1 {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: clamp(2.6rem, 7vw, 6rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.about-hero h1 em { font-style: italic; color: var(--copper); font-weight: 300; }

.about-hero .portrait { position: relative; }

.about-hero .portrait img { width: 100%; filter: saturate(0.9); }

.about-hero .portrait .tag {
  position: absolute;
  bottom: 1rem; left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--paper);
  padding: 0.4rem 0.8rem;
}

@media (max-width: 760px) {
  .about-hero { grid-template-columns: 1fr; }
}

.about-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(2rem, 5vw, 4rem);
}

.about-cols h3 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper);
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.about-cols p { color: var(--ink-soft); font-size: 0.98rem; }
.about-cols p + p { margin-top: 1rem; }

.about-cols ul { list-style: none; }

.about-cols li {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.about-cols li b { color: var(--ink); font-weight: 500; }
.about-cols li span { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); letter-spacing: .08em; white-space: nowrap; align-self: center;}

.photo-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 0 var(--gutter) clamp(5rem, 10vw, 8rem);
}

.photo-band figure { margin: 0 !important; }
.photo-band img { aspect-ratio: 3/4; object-fit: cover; width: 100%; filter: saturate(0.9); transition: filter .5s; }
.photo-band img:hover { filter: saturate(1.1); }

@media (max-width: 640px) { .photo-band { grid-template-columns: 1fr; } .photo-band img { aspect-ratio: 4/3; } }

/* ---------- reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .marquee-track { animation: none; }
}
