/* Shared styles for every page on bratchuk.com. No build step — plain CSS. */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: #e8e8ea;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #181d2d;
  overflow-x: hidden;
}

/* ---- Home page: full-bleed portrait ------------------------------------ */

/* Full-height photo pinned to the left edge. width:auto keeps the whole
   image visible top-to-bottom (never cropped vertically); the mask fades
   its right edge into the dark-blue page background. */
.bg {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: auto;
  max-width: none;
  z-index: -1;
  -webkit-mask-image: linear-gradient(to right, #000 40%, rgba(0, 0, 0, 0) 86%);
  mask-image: linear-gradient(to right, #000 40%, rgba(0, 0, 0, 0) 86%);
}

/* Scrim: keeps the text readable over the photo */
.page {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* when the text is too tall to center without riding up under the fixed
     nav, pin it to the top instead (padding-top below keeps the 15px gap) */
  align-items: safe center;
  padding: calc(3.5rem + 15px) 1.5rem 2rem;
  background: linear-gradient(
    110deg,
    rgba(24, 29, 45, 0) 26%,
    rgba(24, 29, 45, 0.35) 46%,
    rgba(24, 29, 45, 0.72) 66%,
    rgba(24, 29, 45, 0.95) 100%
  );
}

/* Invisible block covering the area the portrait's head occupies, so the
   text is always pushed clear of it: to the right of the face on wide
   screens, or (when flex-wrap kicks in) onto its own row below the face.
   The photo is pinned top-left and scaled to 100vh tall -> 150vh wide
   (3:2), so the head's right edge is ~0.52*150vh and its chin ~0.42*100vh. */
.face-spacer {
  flex: 0 0 auto;
  width: 80vh;
  height: 47vh;
  pointer-events: none;
}

.content {
  /* flex-basis / min-width decide when the text drops below the face; once
     it sits beside the face it grows to fill the space up to max-width, so
     wide screens don't leave a big empty gap to its right. */
  flex: 1 1 400px;
  min-width: min(320px, 100%);
  max-width: 38rem;
  margin: 0 auto;
}

/* ---- Subpages -------------------------------------------------------- */

.subpage {
  max-width: 620px;
  margin: 0 auto;
  /* top value = room for the fixed nav + 15px gap to the content */
  padding: calc(6rem + 15px) 1.25rem 4rem;
}
.subpage--wide {
  max-width: 960px;
}

/* ---- Selected Work: grid of fixed-width floated cards -------------- */

.works::after {
  content: "";
  display: block;
  clear: both;
}
/* drop a <div class="row-break"></div> between cards to force a new row */
.works .row-break {
  clear: both;
}
.work {
  float: left;
  width: 250px;
  min-height:320px;
  margin: 0 1.5rem 2rem 0;
}
.work-year {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  color: #8a8fa0;
}
.work-img {
  display: block;
  max-width: 250px;
  max-height: 150px;
  object-fit:contain;
  margin: 0 0 0.55rem;
}
.work-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.work-desc {
  margin: 0;
  font-size: 0.85rem;
}
.work-link {
  display: inline-block;
  margin-top: 0.3rem;
  text-decoration: none;
  opacity: 0.8;
}
.work-link:hover {
  opacity: 1;
}
.work-position {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: #8a8fa0;
}

/* ---- Writing & Speaking: list of entries -------------------------- */

.ws-section {
  margin-top: 2rem;
}
.ws-section > h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ws-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ws-item {
  padding: 0.75rem 0;
  border-top: 1px solid #262b3a;
}
.ws-year {
  margin: 0 0 0.15rem;
  font-size: 0.8rem;
  color: #8a8fa0;
}
.ws-title {
  margin: 0;
  font-weight: 600;
}
.ws-meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: #8a8fa0;
}
/* publication logo floated beside an entry. clear:right keeps consecutive
   logos (the media section stacks several entries in one <li>) each lined
   up with their own entry instead of piling up side by side. */
.ws-logo {
  float: right;
  clear: right;
  width: auto;
  height: auto;
  max-width: 130px;
  max-height: 34px;
  margin: 0.15rem 0 0.5rem 1.5rem;
}

/* ---- Typography ----------------------------------------------------- */

h1 {
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.25rem;
  padding-bottom:10px;
}

.title {
  color: #b9b9c2;
  margin: 0 0 1.25rem;
  font-size: 1rem;
}

p {
  color: #d2d2d8;
  line-height: 1.6;
  margin: 0 0 1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* small emoji/icon link sitting at the end of a line of body text */
.icon-link {
  text-decoration: none;
  opacity: 0.8;
}
.icon-link:hover {
  opacity: 1;
}

/* Credly badge icons — floated box the certifications paragraph wraps around.
   Laid out with inline-block (not flex) so a literal <br> breaks the row. */
.badges {
  float: right;
  width: 160px;
  margin: 0.2rem 0 0.4rem 1.1rem;
  font-size: 0; /* removes the whitespace gaps between inline-block icons */
}
.badges a {
  display: inline-block;
  vertical-align: top;
  margin: 0 8px 8px 0;
  line-height: 0;
  opacity: 0.9;
}
.badges a:hover {
  opacity: 1;
}
.badges img {
  width: 30px;
  height: auto;
  display: block;
}

/* ---- Buttons / inline links --------------------------------------- */

.links {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 2rem;
}

.linkedin {
  color: #d7d7dc;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid #3a3e4a;
  padding: 0.5rem 0.9rem;
  backdrop-filter: blur(2px);
}
.linkedin:hover {
  border-color: #6a6e7a;
  color: #fff;
}

.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.95rem;
  color: #0b0d12;
  background: #e8e8ea;
  border: 1px solid #e8e8ea;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: #c7c7cc;
}

/* ---- Top navigation ---------------------------------------------------
   Injected on every page by nav.js so there is a single source of truth.
   Right-aligned so it stays clear of the home-page portrait's face, and
   split into clusters set apart by a gap wider than the one between links
   within a cluster (2.75rem vs 1.3rem). */
.topnav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.5rem 2.75rem;
  padding: 1rem 1.75rem;
  background: linear-gradient(to bottom, rgba(15, 18, 28, 0.6), rgba(15, 18, 28, 0));
  pointer-events: none;
}
.topnav .cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.3rem;
  pointer-events: auto;
}
.topnav a {
  color: #dcdce1;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; }
/* Name on subpages: sits at the far left, margin-right:auto shoves the
   clusters over to the right edge. */
.topnav .brand {
  margin-right: auto;
  color: #fff;
  font-weight: 600;
  pointer-events: auto;
}
/* en | uk language switcher (rendered by nav.js) */
.topnav .lang-switch {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  pointer-events: auto;
}
.topnav .lang-switch .sep { color: #7c8398; }
.topnav .lang-switch .current {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---- Contact form ------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: rgba(20, 24, 38, 0.5);
  border: 1px solid #262b3a;
  padding: 1.5rem;
}
.form label {
  font-size: 0.85rem;
  color: #9a9aa2;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form input,
.form textarea {
  font: inherit;
  background: #0b0d12;
  color: #e8e8ea;
  border: 1px solid #2a2d36;
  padding: 0.5rem 0.6rem;
  resize: vertical;
}
.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: #6a7cff;
}
.form .actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.form .submit {
  font: inherit;
  background: #e8e8ea;
  color: #0b0d12;
  border: 1px solid #e8e8ea;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}
.form .submit:disabled {
  opacity: 0.6;
  cursor: default;
}
.form .status {
  font-size: 0.85rem;
  min-height: 1.2em;
}
.form .status.error { color: #ff8080; }
.form .status.ok { color: #7ee787; }

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Narrow screens ---------------------------------------------- */

@media (max-width: 720px) {
  /* Show the photo full-width at the top and fade its bottom edge into the
     background; text sits below it. */
  .bg {
    height: auto;
    width: 100%;
    max-width: 100%;
    -webkit-mask-image: linear-gradient(to bottom, #000 40%, rgba(0, 0, 0, 0) 95%);
    mask-image: linear-gradient(to bottom, #000 40%, rgba(0, 0, 0, 0) 95%);
  }
  .page {
    align-items: flex-start;
    background: linear-gradient(
      180deg,
      rgba(24, 29, 45, 0) 0%,
      rgba(24, 29, 45, 0.5) 30%,
      rgba(24, 29, 45, 0.92) 60%,
      rgba(24, 29, 45, 0.98) 100%
    );
  }
  /* Photo is full-width now (height ~66.7vw); the chin sits at ~0.42*66.7vw.
     Full-width spacer forces the text onto its own row, clear below the face. */
  .face-spacer {
    width: 100%;
    height: 34vw;
  }
  .content {
    max-width: 520px;
  }
  .subpage {
    padding-top: calc(6.5rem + 15px);
  }
  h1 { font-size: 1.6rem; }
  .topnav {
    gap: 0.4rem 1.6rem;
    padding: 0.7rem 1rem;
  }
  .topnav .cluster { gap: 0.4rem 0.95rem; }
  .topnav a { font-size: 0.82rem; }
}

@media (max-width: 400px) {
  /* the nav wraps to three rows here (name + two link rows + switcher) */
  .subpage { padding-top: calc(8rem + 15px); }
}
