/* Light is the default theme. Dark applies when <html data-theme="dark"> (set by the toggle). */
:root {
  color-scheme: light;
  --bg: #fcfcfa;
  --fg: #1a1a1a;
  --muted: #5f5f5f;
  --link: #0b57d0;
  --rule: #dcdcd6;
  --field: #ffffff;
  --field-border: #b9b9b2;
  --ok: #1a7f37;
  --err: #c62828;
  --btn-bg: #1a1a1a;
  --btn-fg: #fcfcfa;
  /* contribution graph: empty day -> busiest day (shades of the link color) */
  --c0: #ebebe5;
  --c1: #c9dcf7;
  --c2: #8fb8ef;
  --c3: #4d8be0;
  --c4: #0b57d0;
  --font: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --fg: #e6e6e6;
  --muted: #9a9a9a;
  --link: #7cb7ff;
  --rule: #262626;
  --field: #111111;
  --field-border: #3a3a3a;
  --ok: #3fb950;
  --err: #ff7b72;
  --btn-bg: #e6e6e6;
  --btn-fg: #0a0a0a;
  --c0: #161616;
  --c1: #16304d;
  --c2: #245a94;
  --c3: #4a8fdb;
  --c4: #7cb7ff;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--font);
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }

/* Header: photo | name + clock + nav | theme toggle */
.head { display: flex; align-items: flex-start; gap: 1rem; }
.who { flex: 1; min-width: 0; }

.avatar {
  flex: none;
  width: 148px;
  height: 148px;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--field);
}
.avatar[hidden] { display: none; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--fg);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--muted); }
.icon-btn:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; }
h2 {
  font-size: 1.05rem;
  margin: 2.25rem 0 .75rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--rule);
}

#tagline, footer, .label, dt, .muted { color: var(--muted); }
#tagline { margin: 0; }
.sep { color: var(--muted); }

.clock {
  margin: .15rem 0 0;
  min-height: 1.4em;           /* reserve the line so the page doesn't jump when the clock starts */
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

nav { margin-top: .75rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; }

p { margin: 0 0 1rem; }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li { margin: 0 0 .85rem; }
ul.list li a { font-weight: 600; }
.meta { color: var(--muted); }
.doc-title { font-weight: 600; }

dl { margin: 0; }
.row { display: grid; grid-template-columns: 11rem 1fr; gap: .25rem 1rem; margin-bottom: .6rem; }
dt { margin: 0; }
dd { margin: 0; }

/* GitHub contribution graph */
.gh-box { min-height: 10.5rem; }       /* reserved so the page doesn't jump when the graph loads */
.gh-msg { color: var(--muted); margin: 0; }
.gh-total { margin: 0 0 .6rem; color: var(--muted); font-size: .9rem; }
.gh-scroll { overflow-x: auto; padding-bottom: .35rem; }
.gh-inner { min-width: 640px; }
.gh-months {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 3px;
  margin-bottom: .3rem;
  font-size: .7rem;
  line-height: 1;
  color: var(--muted);
}
.gh-months span { white-space: nowrap; }
.gh-grid {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
}
.gh-cell, .gh-pad { display: block; aspect-ratio: 1; border-radius: 2px; }
.gh-cell { background: var(--c0); }
.gh-cell[data-l="1"] { background: var(--c1); }
.gh-cell[data-l="2"] { background: var(--c2); }
.gh-cell[data-l="3"] { background: var(--c3); }
.gh-cell[data-l="4"] { background: var(--c4); }
.gh-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: .4rem;
  font-size: .7rem;
  color: var(--muted);
}
.gh-legend .gh-cell { width: 11px; aspect-ratio: auto; height: 11px; }
.gh-legend span:first-child { margin-right: 2px; }
.gh-legend span:last-child { margin-left: 2px; }

/* Certificates */
.certs { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.25rem 1rem; }
.cert { display: block; color: inherit; text-decoration: none; }
.cert-img {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--field);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}
.cert-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cert:hover .cert-img { border-color: var(--muted); }
.cert:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }
.cert-text { display: block; margin-top: .5rem; }
.cert-name { display: block; font-weight: 600; color: var(--link); }
.cert:hover .cert-name { text-decoration: underline; }
.cert-issuer { display: block; font-size: .85rem; color: var(--muted); }
/* shown when the image file is missing */
.cert-img.noimg { display: grid; place-items: center; border-style: dashed; }
.cert-img.noimg img { display: none; }
.cert-img.noimg::after { content: "Image not added yet"; font-size: .85rem; color: var(--muted); }

/* Contact form */
#contact-form { display: grid; gap: .9rem; margin: 0 0 1.75rem; }
#contact-form label { display: grid; gap: .3rem; }
#contact-form label span { color: var(--muted); font-size: .9rem; }
#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form textarea {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--field);
  border: 1px solid var(--field-border);
  border-radius: 6px;
  padding: .6rem .7rem;
}
#contact-form textarea { min-height: 8rem; resize: vertical; }
#contact-form input:focus-visible,
#contact-form textarea:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.hp { display: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.primary {
  font: inherit;
  font-weight: 600;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 0;
  border-radius: 6px;
  padding: .6rem 1.1rem;
  cursor: pointer;
}
.primary:hover { opacity: .88; }
.primary:disabled { opacity: .55; cursor: progress; }
.primary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.status { margin: 0; font-size: .9rem; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .85rem; }

@media (max-width: 34rem) {
  body { font-size: 15px; }
  .head { position: relative; flex-direction: column; align-items: center; text-align: center; gap: .75rem; }
  .avatar { width: 72px; height: 72px; }
  .icon-btn { position: absolute; top: 0; right: 0; }
  nav { justify-content: center; }
  .row { grid-template-columns: 1fr; gap: 0; margin-bottom: .85rem; }
  .certs { grid-template-columns: 1fr; }
}

@media print {
  nav, .icon-btn, #contact-form { display: none; }
  a { color: inherit; }
}
