/* Kasun Jayasuriyage — personal profile site, styled with the TuncLab style guide.
   Design notes:
   - Palette, type and spacing come straight from the guide: Ubuntu (Light/Regular/Bold),
     H1 50/70, H2 42/60, H3 34/50, H4 26, body 16/28, 20px paragraph gap, black + greys + yellow.
   - Yellow (#FFED00, hover #FFDA00) is a FILL colour: buttons, markers, highlights. It fails
     contrast as text on white, so text stays black and links get a yellow underline instead.
     (The guide prints the yellow swatches as #133ABD / #0F309F, which are blues. We use the
     sampled swatch colours; confirm the intended hex with the brand owner.)
   - Light is the default. Dark mode is derived from the same palette (black canvas, yellow accent)
     and follows the OS unless the visitor picks a theme with the toggle (data-theme on <html>).
   - Item titles use the guide's H4 size (26px) so multi-line titles stay compact on cards. */

/* ---- fonts ---- */
@font-face { font-family: "Ubuntu"; font-weight: 300; font-display: swap; src: url("assets/fonts/ubuntu-300.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu"; font-weight: 400; font-display: swap; src: url("assets/fonts/ubuntu-400.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu"; font-weight: 700; font-display: swap; src: url("assets/fonts/ubuntu-700.woff2") format("woff2"); }

/* ---- tokens ---- */
:root {
  --yellow: #ffed00;
  --yellow-hover: #ffda00;
  --bg: #ffffff;
  --surface: #fafafa;        /* Mono 4 */
  --card: #ffffff;
  --text: #000000;
  --text-hover: #3c3c3c;
  --muted: #707070;          /* Mono 1 — 4.9:1 on white */
  --line: #b9b9b9;           /* Mono 2 */
  --soft: #f0f0f0;           /* Mono 3 */
  --tag-bg: #f0f0f0;
  --tag-ink: #000000;
  --shadow: 0 4px 24px rgba(0, 0, 0, .07);
  --focus: #000000;
  --radius: 8px;
  --wrap: 80rem;          /* content width; grows to this on wide screens */
  --gutter: clamp(1.25rem, 5vw, 5rem);
  --font: "Ubuntu", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #0d0d0d; --card: #151515; --text: #ffffff; --text-hover: #b9b9b9;
    --muted: #b9b9b9; --line: #3c3c3c; --soft: #262626; --tag-bg: #262626; --tag-ink: #ffffff;
    --shadow: none; --focus: #ffed00; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #0d0d0d; --card: #151515; --text: #ffffff; --text-hover: #b9b9b9;
  --muted: #b9b9b9; --line: #3c3c3c; --soft: #262626; --tag-bg: #262626; --tag-ink: #ffffff;
  --shadow: none; --focus: #ffed00; color-scheme: dark;
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/28px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, ul, ol, dl, dd { margin: 0; }
p { margin: 0 0 20px; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--yellow-hover); text-decoration-thickness: 3px; text-underline-offset: 3px; }
a:hover { color: var(--text-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--yellow); color: #000; padding: .5rem 1rem; z-index: 100; border-radius: 4px; }
.skip:focus { left: .5rem; }

section { padding-block: clamp(3.5rem, 8vw, 6rem); }
section.alt { background: var(--surface); }

/* guide type scale: sizes shrink on small screens, reach the guide values from ~48rem up */
h1 { font-size: clamp(2.25rem, 7vw, 50px); line-height: 1.4; font-weight: 700; }
h2 { font-size: clamp(1.75rem, 5vw, 42px); line-height: clamp(2.25rem, 7vw, 60px); font-weight: 700; margin-bottom: 1.75rem; }
h2::after { content: "." / ""; color: var(--yellow-hover); }   /* echoes the TUNCLAB. wordmark dot */
h3 { font-size: 26px; line-height: 1.35; font-weight: 700; }
.lede { color: var(--muted); font-size: 18px; }
.meta { color: var(--muted); font-size: 14px; line-height: 22px; margin-bottom: 0; }
.dot { color: var(--yellow-hover); }

/* ---- header ---- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--soft); }
.bar { display: flex; align-items: center; gap: 1.25rem; min-height: 4rem; }
.brand { display: flex; align-items: center; gap: .65rem; margin-right: auto; font-weight: 700; font-size: 17px; text-decoration: none; }
.brand img { height: 28px; width: auto; }
.bar nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.9rem); }
.bar nav a { text-decoration: none; padding: .5rem 0; border-bottom: 3px solid transparent; }
.bar nav a:hover { color: var(--text); border-bottom-color: var(--yellow-hover); }
.theme-toggle { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; background: none; color: var(--text); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.theme-toggle:hover { border-color: var(--text); background: var(--soft); }

/* ---- buttons: yellow fill, black text; hover darkens the yellow, like the guide's hover swatch ---- */
.cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.75rem 0 0; }
.btn { display: inline-block; padding: .7rem 1.5rem; border: 2px solid var(--text); border-radius: 999px; color: var(--text); background: transparent; text-decoration: none; font-weight: 700; transition: background-color .2s, transform .2s; }
.btn:hover { background: var(--soft); color: var(--text); transform: translateY(-1px); }
.btn--primary { background: var(--yellow); border-color: var(--yellow); color: #000; }
.btn--primary:hover { background: var(--yellow-hover); border-color: var(--yellow-hover); color: #000; }

/* ---- hero: text beside the portrait ---- */
.hero { padding-top: clamp(2.5rem, 7vw, 6rem); padding-bottom: clamp(3rem, 7vw, 5rem); }
.hero__grid { display: grid; gap: 3rem; align-items: center; }
.eyebrow { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-weight: 400; margin-bottom: 1rem; }
.eyebrow::before { content: ""; width: 2rem; height: 6px; background: var(--yellow); flex: none; }
.tagline { font-size: clamp(1.4rem, 3vw, 34px); line-height: 1.35; font-weight: 300; max-width: 40rem; margin: 1.25rem 0 0; }
.intro { color: var(--muted); max-width: 42rem; margin: 1.25rem 0 0; font-size: 18px; }
.where { color: var(--muted); font-size: 14px; margin: 1.25rem 0 0; }

/* The photo has a black studio background. A yellow block (with the brand mark's diagonal cut)
   sits behind and offset, so the portrait reads as a deliberate frame on white, and
   merges naturally into the black canvas in dark mode. */
.portrait { position: relative; margin: 0; width: min(100%, 28rem); justify-self: center; isolation: isolate; }
.portrait::before {
  content: ""; position: absolute; z-index: -1; inset: 1.25rem -1.25rem -1.25rem 1.25rem;
  background: var(--yellow); border-radius: 12px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 26% 100%, 0 74%);
}
.portrait img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 30%; border-radius: 12px; background: #000; }

/* ---- about ---- */
.about { display: grid; gap: 2.5rem; }
.prose { max-width: 40rem; }
.facts h3 { font-size: 14px; line-height: 22px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.75rem 0 .5rem; }
.facts h3:first-child { margin-top: 0; }
.facts p { margin: 0; }
.certs li { padding: .5rem 0; border-bottom: 1px solid var(--soft); }
.year { display: inline-block; min-width: 3rem; color: var(--muted); font-size: 14px; font-weight: 700; }

/* ---- cards & tags ---- */
.cards { display: grid; gap: 1.25rem; }
.card { background: var(--card); border: 1px solid var(--soft); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
[data-theme="dark"] .card { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { border-color: var(--line); } }
.card h3 { margin-bottom: .9rem; }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 0; }
.card > .tags:first-of-type { margin-top: 0; }
.tags li { background: var(--tag-bg); color: var(--tag-ink); font-size: 13px; line-height: 18px; padding: .3rem .65rem; border-radius: 4px; }

/* ---- timeline ---- */
.timeline { position: relative; border-left: 2px solid var(--line); margin-left: .45rem; padding-left: 1.75rem; display: grid; gap: 2.75rem; }
.timeline > li { position: relative; }
.timeline > li::before { content: ""; position: absolute; left: calc(-1.75rem - 8px); top: .7rem; width: 10px; height: 10px; background: var(--yellow); border: 3px solid var(--text); border-radius: 50%; box-sizing: content-box; }
.org { font-weight: 400; color: var(--muted); font-size: 18px; }
.timeline .note { color: var(--muted); margin: .5rem 0 0; }
.timeline ul:not(.tags) { margin-top: .75rem; display: grid; gap: .35rem; }
.timeline ul:not(.tags) li { position: relative; padding-left: 1.1rem; max-width: 46rem; }
.timeline ul:not(.tags) li::before { content: ""; position: absolute; left: 0; top: 11px; width: 6px; height: 6px; background: var(--text); }

/* wide screens: role + dates on the left, details on the right, so the width is used well */
@media (min-width: 64rem) {
  .timeline > li { display: grid; grid-template-columns: 19rem 1fr; column-gap: 3rem; align-items: start; }
  .timeline > li > h3, .timeline > li > .meta, .timeline > li > .note { grid-column: 1; }
  .timeline > li > ul:not(.tags) { grid-column: 2; grid-row: 1 / span 3; margin-top: .4rem; }
  .timeline > li > .tags { grid-column: 2; }
  .timeline .org { display: block; margin-top: .15rem; }
}

/* ---- projects ---- */
.project .meta { margin-bottom: .25rem; }
.project .lede { font-size: 16px; margin: -.4rem 0 1rem; }
.project dl { display: grid; gap: .5rem; }
.project dt { font-size: 13px; line-height: 22px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding-left: .6rem; border-left: 4px solid var(--yellow); }
.project dd { margin: 0 0 .4rem; }


/* ---- two-column bands (community, contact): message left, content right ---- */
.split { display: grid; gap: 2rem; align-items: start; }
.split .lede { max-width: 34rem; margin: 0; }
.interests h3 { font-size: 14px; line-height: 22px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .75rem; }
.tags--large { margin: 0; gap: .6rem; }
.tags--large li { font-size: 16px; line-height: 24px; padding: .55rem 1rem; border-radius: 999px; }

.links { border-top: 1px solid var(--line); }
.links li { border-bottom: 1px solid var(--line); }
.links a { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; padding: 1.25rem .25rem; text-decoration: none; transition: padding .2s; }
.links a:hover { padding-inline: 1rem; background: var(--yellow); color: #000; }
.links span { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.links a:hover span { color: #000; }
.links strong { font-size: clamp(1.15rem, 2.6vw, 26px); text-align: right; overflow-wrap: anywhere; }

/* ---- footer ---- */
.site-footer { padding-block: 2rem; color: var(--muted); font-size: 14px; border-top: 1px solid var(--soft); }
.site-footer p { margin: 0; }

/* ---- larger screens ---- */
@media (min-width: 56rem) {
  .split { grid-template-columns: 1fr 1fr; gap: 5rem; }
  .hero__grid { grid-template-columns: 1.25fr 1fr; gap: 4rem; }
  .portrait { justify-self: end; }
}
@media (min-width: 80rem) {
  /* wide screens: bigger type so the text fills its column instead of floating in it */
  .hero__grid { grid-template-columns: 1fr 1fr; gap: 5rem; }
  .portrait { width: min(100%, 36rem); }
  .tagline { font-size: 42px; max-width: 46rem; }
  .intro { font-size: 20px; line-height: 34px; max-width: 44rem; }
  .about { grid-template-columns: 1.25fr 1fr; gap: 6rem; }
  .prose { max-width: 48rem; font-size: 18px; line-height: 32px; }
  .prose p { margin-bottom: 22px; }
  .facts { font-size: 17px; }
  .lede { font-size: 20px; line-height: 34px; }
}
@media (min-width: 100rem) {
  :root { --wrap: 92rem; }      /* very wide monitors (1600px+): use more of the screen */
}
@media (max-width: 55.99rem) {
  .portrait { order: -1; width: min(70%, 20rem); justify-self: start; margin-right: 1.25rem; }
}
@media (min-width: 48rem) {
  .about { grid-template-columns: 1.5fr 1fr; gap: 4rem; }
  .cards--2 { grid-template-columns: repeat(2, 1fr); }
  .cards--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 64rem) {
  /* 5 cards: 3 on the first row, 2 wider ones on the second, so no empty slot */
  .cards--3 { grid-template-columns: repeat(6, 1fr); }
  .cards--3 > .card { grid-column: span 2; }
  .cards--3 > .card:nth-child(n+4) { grid-column: span 3; }
}
@media (max-width: 40rem) {
  .bar nav a:first-child { display: none; }  /* keep the header on one line on phones */
  .brand span { font-size: 15px; }
}
@media (max-width: 30rem) {
  .brand span { display: none; }              /* mark only on very small screens */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

/* ---- print: clean one-column CV-style page ---- */
@media print {
  .site-header, .theme-toggle, .cta, .skip { display: none; }
  section, section.alt { padding-block: 1.25rem; background: none; }
  body { color: #000; background: #fff; }
  .card { box-shadow: none; }
}
