/* ==========================================================================
   Sudmun Hakim Soudho, personal site
   Type: STIX Two Text (scientific publishing serif) for reading,
         Public Sans for small interface text.
   Colour: cool paper with Bangladesh green as the single accent.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */

:root {
  --serif: 'STIX Two Text', 'STIXGeneral', 'Times New Roman', Georgia, serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;

  --margin-col: 9.5rem;   /* left column that holds section names */
  --gutter: 2.75rem;
  --measure: 38rem;       /* ~75 characters of body text */
}

/* Day */
:root,
:root[data-theme='light'] {
  color-scheme: light;
  --paper:       #f4f6f3;
  --panel:       #e7eee9;
  --ink:         #1f2b27;
  --muted:       #52615a;
  --faint:       #5f6e67;
  --rule:        #d3dcd6;
  --rule-strong: #8a9c93;
  --accent:      #006a4e;
  --accent-deep: #004d38;
  --on-accent:   #ffffff;
}

/* Night */
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper:       #111916;
  --panel:       #18231f;
  --ink:         #e2eae5;
  --muted:       #a3b4ac;
  --faint:       #8d9e96;
  --rule:        #2a3833;
  --rule-strong: #5a6f65;
  --accent:      #6fc59f;
  --accent-deep: #9ad9bd;
  --on-accent:   #0c1411;
}

/* Follow the OS setting when the theme script has not run. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper:       #111916;
    --panel:       #18231f;
    --ink:         #e2eae5;
    --muted:       #a3b4ac;
    --faint:       #8d9e96;
    --rule:        #2a3833;
    --rule-strong: #5a6f65;
    --accent:      #6fc59f;
    --accent-deep: #9ad9bd;
    --on-accent:   #0c1411;
  }
}

/* --- Base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.62;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
}

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

p {
  margin: 0 0 0.9em;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

a:hover {
  color: var(--accent-deep);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

cite {
  font-style: italic;
}

sup {
  line-height: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 0.875rem/1 var(--sans);
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus {
  top: 1rem;
}

/* --- Page frame ---------------------------------------------------------- */

.page {
  max-width: calc(var(--margin-col) + var(--gutter) + var(--measure));
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* --- Theme toggle -------------------------------------------------------- */

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--rule-strong);
}

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-moon {
  fill: currentColor;
  stroke: none;
}

/* Show the icon of the theme you would switch to. */
:root[data-theme='light'] .theme-toggle .icon-sun,
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

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

.hero {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: var(--gutter);
  align-items: start;
  padding-top: clamp(4.5rem, 10vw, 7rem);
}

.hero__portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  margin-top: 0.55rem;
}

.hero__name {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.5rem, 6vw, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.018em;
  font-variant-numeric: lining-nums;
}

.hero__lead {
  margin: 0 0 1.25rem;
  max-width: 30ch;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  line-height: 1.32;
  font-style: italic;
  color: var(--ink);
}

.hero__bio {
  max-width: var(--measure);
  color: var(--ink);
}

.hero__links {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
}

/* --- Sections ------------------------------------------------------------ */

.section {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  column-gap: var(--gutter);
  padding-top: clamp(3rem, 7vw, 4.5rem);
}

.section > h2 {
  grid-column: 1;
  margin: 0.2rem 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.3;
  color: var(--accent);
}

.section__body {
  grid-column: 2;
  max-width: var(--measure);
}

/* --- Entries ------------------------------------------------------------- */

.entry + .entry {
  margin-top: 2.1rem;
}

.entry__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  font-variant-numeric: lining-nums;
}

.entry__title a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent);
}

.entry__title a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.entry__context {
  margin: 0.3rem 0 0.7rem;
  font: 400 0.875rem/1.5 var(--sans);
  color: var(--muted);
}

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

.entry__links {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  font: 600 0.875rem/1.5 var(--sans);
}

.entry--media {
  display: flow-root; /* contain the floated image */
}

.entry__image {
  float: right;
  width: 8.5rem;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  margin: 0.3rem 0 0.75rem 1.5rem;
  border-radius: 3px;
  background: var(--panel);
}

/* --- Lists --------------------------------------------------------------- */

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}

.plain-list li + li {
  margin-top: 0.55rem;
}

.plain-list li::marker {
  color: var(--accent);
}

.skills {
  margin: 0;
  display: grid;
  gap: 0.7rem;
}

.skills div {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  column-gap: 1rem;
}

.skills dt {
  font: 600 0.875rem/1.9 var(--sans);
  color: var(--muted);
}

.skills dd {
  margin: 0;
}

/* --- Footer -------------------------------------------------------------- */

.footer {
  margin-top: clamp(3.5rem, 8vw, 5.5rem);
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  font: 400 0.8125rem/1.5 var(--sans);
  color: var(--faint);
}

.footer p {
  margin: 0;
}

/* --- Small screens ------------------------------------------------------- */

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

  .hero__portrait {
    width: 6.5rem;
    margin: 0 0 1.4rem;
  }

  .section {
    grid-template-columns: 1fr;
  }

  .section > h2 {
    margin: 0 0 1.1rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--rule);
  }

  .section__body {
    grid-column: 1;
  }

  .entry__image {
    float: none;
    width: 100%;
    max-width: 16rem;
    margin: 0 0 0.9rem;
  }

  .skills div {
    grid-template-columns: 1fr;
  }

  .skills dt {
    line-height: 1.5;
  }
}

/* --- Motion and print ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .theme-toggle,
  .skip-link {
    display: none;
  }
}
