/* Sky blue accent (#82C8E5) on a clean, Apple-style surface system.
   Principle: white page, crisp type, hairline borders, glass only where
   Apple uses it (the nav). Color is used sparingly, as an accent. */

:root {
  --global-theme-color: #82c8e5 !important;
  --global-hover-color: #5fb3d6 !important;
  --global-code-bg-color: rgba(130, 200, 229, 0.12) !important;

  --ng-blue: #82c8e5;
  --ng-blue-deep: #5fb3d6;
  --ng-ink: #111417;
  --ng-muted: rgba(17, 20, 23, 0.6);

  --page-bg: #fbfcfd;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --hairline: rgba(17, 20, 23, 0.08);
  --hairline-strong: rgba(17, 20, 23, 0.14);
  --shadow-sm: 0 1px 2px rgba(17, 20, 23, 0.04);
  --shadow-md: 0 1px 2px rgba(17, 20, 23, 0.04), 0 12px 32px rgba(17, 20, 23, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-blur: blur(20px) saturate(1.8);
}

html[data-theme="dark"] {
  --global-theme-color: #82c8e5 !important;
  --global-hover-color: #a3d8ee !important;

  --ng-ink: #f2f5f7;
  --ng-muted: rgba(242, 245, 247, 0.62);

  --page-bg: #0e1317;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.06);
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.28);
}

a,
.navbar.navbar-light .navbar-nav .nav-item.active > .nav-link,
.navbar.navbar-light .navbar-brand.social a:hover i::before,
.publications ol.bibliography li .abbr abbr {
  color: var(--global-theme-color);
}

.publications ol.bibliography li .abbr abbr {
  background-color: var(--global-theme-color) !important;
}

/* ---- Page backdrop: near-white with one quiet wash of blue at the top ---- */
html {
  background: var(--page-bg);
}

body {
  background: transparent !important;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 38% at 50% -8%, rgba(130, 200, 229, 0.22), transparent 70%),
    radial-gradient(38% 26% at 92% 6%, rgba(130, 200, 229, 0.09), transparent 70%);
}

html[data-theme="dark"] body::before {
  background:
    radial-gradient(70% 38% at 50% -8%, rgba(130, 200, 229, 0.12), transparent 70%),
    radial-gradient(38% 26% at 92% 6%, rgba(130, 200, 229, 0.05), transparent 70%);
}

.container[role="main"],
footer {
  position: relative;
  z-index: 1;
}

.container[role="main"] {
  background: transparent !important;
}

/* ---- Nav: the one place glass belongs ---- */
.navbar {
  z-index: 1030;
  background: rgba(251, 252, 253, 0.72) !important;
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border-bottom: 1px solid var(--hairline);
  box-shadow: none !important;
}

html[data-theme="dark"] .navbar {
  background: rgba(14, 19, 23, 0.72) !important;
}

/* ---- Shared surface ---- */

.pub-entry,
.get-in-touch,
.dtap-chart-wrap,
.card,
.projects .card {
  background: var(--surface) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card,
.projects .card {
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.card:hover,
.projects .card:hover {
  border-color: var(--hairline-strong) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}

/* Profile photo */
.profile .profile-photo {
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
}

/* ---- Bibliography: plain rows with hairline dividers ---- */
.publications ol.bibliography li {
  padding: 1rem 0 1.1rem;
  margin: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
}

.publications ol.bibliography li:last-child {
  border-bottom: none;
}

/* al-folio uses col-sm-2 + col-sm-8 with thumbnails, leaving 2 empty
   columns. Stretch the text column to the full remaining width. */
@media (min-width: 576px) {
  .publications ol.bibliography li .row > .col-sm-8 {
    flex: 0 0 83.3333%;
    max-width: 83.3333%;
  }
}

.publications ol.bibliography li .author {
  white-space: normal;
}

/* ---- Get in touch ---- */
.get-in-touch {
  clear: both;
  margin-top: 2.5rem;
  padding: 1.5rem 1.5rem 1.6rem;
  font-family: inherit;
}

.get-in-touch h2,
.get-in-touch p,
.get-in-touch input,
.get-in-touch textarea,
.get-in-touch button {
  font-family: inherit;
}

.get-in-touch h2 {
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.contact-intro {
  color: var(--ng-muted);
  margin-bottom: 1.1rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: none;
}

.contact-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .contact-field-row {
    grid-template-columns: 1fr;
  }
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  background: var(--surface-strong);
  color: inherit;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--ng-blue);
  box-shadow: 0 0 0 3px rgba(130, 200, 229, 0.25);
}

.contact-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.contact-hp {
  position: absolute !important;
  left: -10000px !important;
  height: 1px !important;
  width: 1px !important;
  overflow: hidden !important;
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.15rem;
}

.contact-send {
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.4rem;
  background: var(--ng-blue);
  color: #0b1a22;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    transform 140ms ease;
}

.contact-send:hover {
  background: var(--ng-blue-deep);
}

.contact-send:active {
  transform: translateY(1px);
}

.contact-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.contact-status {
  font-size: 0.92rem;
  color: var(--ng-muted);
}

.contact-status.ok {
  color: #176b52;
}

.contact-status.err {
  color: #a33;
}

.social-after-contact {
  margin-top: 1.75rem;
  padding-top: 0.25rem;
}

/* ---- Publications narrative layout ---- */
.pub-entry {
  margin: 0 0 1.5rem;
  padding: 1.5rem 1.6rem 1.6rem;
}

.pub-entry-title {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.pub-entry-meta {
  color: var(--ng-muted);
  margin-bottom: 0.75rem;
}

.pub-entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}

.pub-thinking {
  width: 100%;
}

.pub-thinking p {
  max-width: none;
  width: 100%;
}

/* ---- Projects listing ---- */
.projects h2.category {
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ng-muted);
  background: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.5rem;
  margin: 2.2rem 0 1.2rem;
}

.projects .card img.card-img-top {
  height: 185px;
  width: 100%;
  object-fit: cover;
  border-bottom: 1px solid var(--hairline);
}

.projects .card .card-title {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.projects .card .card-title-link,
.projects .card .card-text-link {
  color: inherit;
  text-decoration: none;
}

.projects .card .card-title-link:hover {
  color: var(--ng-blue-deep);
}

.projects .card .title-gh-icon {
  flex: 0 0 auto;
  color: var(--ng-ink);
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.72;
}

.projects .card .title-gh-icon:hover {
  color: var(--ng-blue-deep);
  opacity: 1;
}

html[data-theme="dark"] .projects .card .title-gh-icon {
  color: rgba(255, 255, 255, 0.82);
}

.projects .card .card-text {
  font-size: 0.92rem;
  color: var(--ng-muted);
}

/* ---- Project pages ---- */
.proj-banner {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0.15rem 0 1rem;
}

.proj-banner.pixel {
  image-rendering: pixelated;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.proj-banner.demo {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.proj-meta {
  font-size: 0.9rem;
  color: var(--ng-muted);
  margin-bottom: 0.85rem;
}

.proj-figure {
  margin: 0.85rem auto 1.15rem;
  max-width: 720px;
}

.proj-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: #fff;
}

.proj-figure figcaption {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--ng-muted);
}

.proj-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 0.9rem;
  margin: 0.7rem 0 1rem;
}

.proj-grid .proj-figure {
  margin: 0;
  max-width: none;
}

.proj-phone {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0.85rem auto 1.15rem;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

.proj-shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  max-width: 560px;
  margin: 0.7rem auto 0.4rem;
}

.proj-shots img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: #111417;
}

.proj-log {
  margin: 0.7rem auto 1.1rem;
  max-width: 640px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: #111417;
  color: #d7dee4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
}

.uav-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "mission fea"
    "spec fea";
  gap: 0.55rem;
  aspect-ratio: 1;
  max-width: 680px;
  margin: 0.85rem auto 0.35rem;
}

.uav-board figure {
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.uav-board .mission {
  grid-area: mission;
}
.uav-board .spec {
  grid-area: spec;
}
.uav-board .fea {
  grid-area: fea;
}

.uav-board img {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}

.uav-board figcaption {
  margin-top: 0.28rem;
  font-size: 0.75rem;
  color: var(--ng-muted);
}

@media (max-width: 640px) {
  .proj-grid,
  .proj-shots,
  .uav-board {
    grid-template-columns: 1fr;
    grid-template-areas: none;
    aspect-ratio: auto;
  }

  .uav-board .mission,
  .uav-board .spec,
  .uav-board .fea {
    grid-area: auto;
  }

  .uav-board img {
    height: auto;
  }
}

.post-title.title-with-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem 0.85rem;
}

.post-title.title-with-logo > span {
  flex: 1 1 12rem;
  min-width: 0;
}

.title-logo {
  height: 2.35rem;
  width: auto;
  max-width: 7.5rem;
  object-fit: contain;
  flex: 0 0 auto;
}

html[data-theme="dark"] .title-logo-invert {
  filter: invert(1) hue-rotate(180deg);
}

.pub-figure {
  margin: 1rem auto 1.35rem;
  max-width: 640px;
}

.pub-figure.wide {
  max-width: none;
  width: 100%;
}

.pub-figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: #fff;
}

.pub-figure figcaption,
.dtap-chart-wrap > figcaption {
  margin-top: 0.65rem;
  font-size: 0.92rem;
  color: var(--ng-muted);
}

.pub-divider {
  margin: 2rem 0 1.5rem;
  border: none;
  border-top: 1px solid var(--hairline);
}

/* ---- DTap chart ---- */
.dtap-chart-wrap {
  margin: 1.5rem 0 0;
  padding: 1rem;
}

.dtap-ctrl {
  border: 1px solid var(--hairline-strong) !important;
  background: var(--surface-strong) !important;
  color: inherit !important;
}

.dtap-ctrl:hover {
  border-color: var(--ng-blue) !important;
}

.dtap-ctrl.active {
  background: var(--ng-ink) !important;
  color: var(--page-bg) !important;
  border-color: var(--ng-ink) !important;
}

.dtap-ctrl:focus-visible {
  outline: 2px solid var(--ng-blue) !important;
  outline-offset: 2px;
}

.dtap-canvas-box {
  background: #fff !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius-sm) !important;
}

.dtap-y-caption,
.dtap-legend-title span,
.dtap-leg-hint,
.dtap-controls span {
  color: var(--ng-muted) !important;
}

.dtap-legend-title {
  color: var(--ng-ink) !important;
}

.dtap-callout {
  background: rgba(130, 200, 229, 0.12) !important;
  border-left: 3px solid var(--ng-blue) !important;
  color: inherit !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

/* ---- Footer ---- */
footer,
footer.fixed-bottom {
  background: var(--page-bg) !important;
  border-top: 1px solid var(--hairline);
  box-shadow: none !important;
  color: #5a6168 !important;
  font-size: 0.9rem;
}

html[data-theme="dark"] footer,
html[data-theme="dark"] footer.fixed-bottom {
  color: rgba(242, 245, 247, 0.72) !important;
}

footer a,
footer.fixed-bottom a {
  color: var(--ng-blue-deep) !important;
}

html[data-theme="dark"] footer a,
html[data-theme="dark"] footer.fixed-bottom a {
  color: var(--ng-blue) !important;
}

footer .container,
footer.fixed-bottom .container {
  color: inherit !important;
}

/* Blog index: thumbnail on the left, same idea as a publication row. */
.post-list li.blog-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.post-list .blog-thumb {
  flex: 0 0 18%;
  max-width: 8.75rem;
  min-width: 5.75rem;
}

.post-list .blog-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: #111417;
}

.post-list .blog-row-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.post-list .blog-row-copy h3 {
  margin-top: 0;
}

/* Blog: a reaction gif is about a paragraph tall, caption under it, text wraps. */
.post figure.react {
  float: right;
  width: min(20rem, 46%);
  margin: 0.15rem 0 0.85rem 1.15rem;
}

.post figure.react img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.post figure.react figcaption {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--ng-muted);
}

.post h2 {
  clear: both;
}

@media (max-width: 520px) {
  .post figure.react {
    float: none;
    width: min(20rem, 100%);
    margin: 0.85rem 0 1rem;
  }
}

.post figure.ref {
  margin: 1.15rem 0 1.35rem;
  clear: both;
}

.post figure.ref img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: #fff;
}

.post figure.ref figcaption {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--ng-muted);
}
