/* =====================================================================
   Sofiane Ezzehi – personal website
   Layout: top navigation, profile sidebar on the left, page content on the right.
   Palette taken from a geological cross-section (CO2 storage reservoir).
   ===================================================================== */

:root {
  --paper: #f7f8f7;
  --ink: #1b2530;
  --muted: #56616d;
  --link: #22507a;
  --link-hover: #163a5a;
  --rule: #dfe3e2;
  --button-bg: #22507a;
  --button-ink: #ffffff;

  --overburden: #ddd8cb;
  --shale: #9aa5ad;
  --caprock: #3d4a57;
  --reservoir: #c7a46a;
  --basement: #67737e;

  --serif: "Spectral", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

  --page: 64rem;
  --sidebar: 15rem;
  --date-col: 9rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151b21;
    --ink: #e4e7e8;
    --muted: #a3acb4;
    --link: #9cc2e6;
    --link-hover: #c4dcf2;
    --rule: #2a333c;
    --button-bg: #9cc2e6;
    --button-ink: #151b21;

    --overburden: #3a3d3e;
    --shale: #4e5961;
    --caprock: #232c35;
    --reservoir: #8c7346;
    --basement: #36414b;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  font-variant-numeric: oldstyle-nums proportional-nums;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

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

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.8rem;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

/* ---------- Top navigation ---------- */

.site-header {
  padding: calc(env(safe-area-inset-top, 0px) + 1.1rem) 1.5rem 1.1rem;
}

.nav {
  max-width: var(--page);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 2rem;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  font-size: 1.0625rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--reservoir);
}

/* ---------- Strata band ----------
   Thin horizontal rock layers under the menu.
   To remove the band entirely, replace this rule's content with: display: none; */

.strata {
  height: 14px;
  background: linear-gradient(to bottom,
    var(--overburden) 0 4px,
    var(--shale)      4px 7px,
    var(--caprock)    7px 9px,
    var(--reservoir)  9px 12px,
    var(--basement)   12px 14px);
}

/* ---------- Two-column layout ---------- */

.layout {
  max-width: calc(var(--page) + 3rem);
  margin: 0 auto;
  padding: 2.75rem 1.5rem 1rem;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
}

/* ---------- Profile sidebar ---------- */

.profile {
  position: sticky;
  top: 1.5rem;
}

.portrait {
  display: block;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.25rem;
}

.profile p { margin: 0; }

.profile-name {
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1.15;
}

.profile .profile-role {
  font-style: italic;
  color: var(--muted);
  margin-top: 0.25rem;
}

.profile .profile-affil {
  font-size: 1rem;
  line-height: 1.55;
  margin-top: 1rem;
}

.profile .profile-email {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 1rem;
  overflow-wrap: anywhere;
}

.profile .profile-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.1rem;
  margin-top: 1.1rem;
  font-size: 1rem;
}

.button {
  display: inline-block;
  background: var(--button-bg);
  color: var(--button-ink);
  text-decoration: none;
  padding: 0.35rem 0.9rem;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1.4;
}
.button:hover {
  color: var(--button-ink);
  background: var(--link-hover);
  text-decoration: none;
}
@media (prefers-color-scheme: dark) {
  .button:hover { background: var(--link-hover); }
}

/* ---------- Main content ---------- */

.main { max-width: 44rem; }

.page-title {
  font-size: 2.2rem;
  font-weight: 300;
  line-height: 1.15;
  margin: 0 0 1.25rem;
}

h2 {
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.25;
  margin: 2.5rem 0 0.9rem;
}

p { margin: 0 0 1rem; }

.lead { color: var(--muted); }

.plain-list,
.site-map {
  margin: 0;
  padding-left: 1.2rem;
}
.plain-list li,
.site-map li { margin-bottom: 0.3rem; }
.plain-list li::marker,
.site-map li::marker { color: var(--reservoir); }

/* Dated entries */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  display: grid;
  grid-template-columns: var(--date-col) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 0.6rem 0;
}
.entry + .entry { border-top: 1px solid var(--rule); }

.entry p { margin: 0; }
.entry p + p { margin-top: 0.2rem; }

.when {
  color: var(--muted);
  font-size: 1rem;
  font-variant-numeric: lining-nums tabular-nums;
  padding-top: 0.12rem;
}

.entry-title { font-weight: 600; }

.hours {
  font-weight: 400;
  color: var(--muted);
  font-size: 1rem;
  font-variant-numeric: lining-nums;
  margin-left: 0.4rem;
  white-space: nowrap;
}

.detail {
  color: var(--muted);
  font-size: 1rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.2rem;
  font-size: 1rem;
}

.cta { margin-top: 2rem; }

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

.site-footer {
  max-width: calc(var(--page) + 3rem);
  margin: 3rem auto 0;
  padding: 1.5rem 1.5rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 3rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  /* top rule aligned with the content, not the padding */
  background: linear-gradient(var(--rule), var(--rule)) top center / calc(100% - 3rem) 1px no-repeat;
}
.site-footer address { font-style: normal; }
.site-footer p { margin: 0; }

/* ---------- Smaller screens ---------- */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2rem;
  }

  /* Profile becomes a compact card: photo left, details right */
  .profile {
    position: static;
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 1.25rem;
    align-items: start;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--rule);
  }
  .portrait { width: 7rem; height: 7rem; margin: 0; }
  .profile-name { font-size: 1.4rem; }

  /* On phones the profile card only appears on the home page,
     so other pages open directly on their content. */
  .subpage .profile { display: none; }
  .profile .profile-affil { margin-top: 0.6rem; }
}

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .site-header { padding-left: 1.1rem; padding-right: 1.1rem; }
  .layout { padding-left: 1.1rem; padding-right: 1.1rem; }
  .site-footer { padding-left: 1.1rem; padding-right: 1.1rem; background-size: calc(100% - 2.2rem) 1px; }
  .nav-links { gap: 0.2rem 1.1rem; }
  .profile { grid-template-columns: 5.5rem 1fr; gap: 1rem; }
  .portrait { width: 5.5rem; height: 5.5rem; }
  .entry { grid-template-columns: 1fr; gap: 0.1rem; }
  .page-title { font-size: 1.9rem; }
}

/* ---------- Print ---------- */

@media print {
  .site-header, .strata, .skip-link, .profile-links { display: none; }
  .layout { display: block; }
  .profile { position: static; margin-bottom: 1.5rem; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
}
