:root {
  color-scheme: light;
  --header: #f8faf8;
  --page: #e9fbf9;
  --ink: #171a19;
  --muted: #999d9b;
  --line: #d8d9d6;
  --blue: #64baff;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.site-header {
  height: 62px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 2.8%;
  background: var(--header);
  border-bottom: 2px dashed var(--blue);
}

.brand-time {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-image {
  width: 31px;
  height: 29px;
  flex: 0 0 auto;
  object-fit: contain;
}

.logo-admin-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.logo-admin-trigger:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.clock {
  color: var(--muted);
  font-size: 17px;
  letter-spacing: .25px;
  white-space: nowrap;
}

.primary-nav {
  width: 468px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-link {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: #fbfcfa;
  color: #414542;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
}

.nav-link:nth-child(1) { width: 70px; }
.nav-link:nth-child(2) { width: 135px; }
.nav-link:nth-child(3) { width: 89px; }
.nav-link:nth-child(4) { width: 80px; }

.nav-link:hover, .nav-link:focus-visible { border-color: #aeb8b4; }

.page-label {
  justify-self: end;
  color: #343936;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

.home-main {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5vw 140px;
}

.intro {
  width: min(1184px, 100%);
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr);
  align-items: center;
  column-gap: 111px;
}

.portrait-photo {
  width: 185px;
  height: 209px;
  border-radius: 50% / 43%;
  object-fit: cover;
  animation: intro-fade-in 900ms ease-out both;
}

.intro p {
  margin: 0;
  max-width: 850px;
  font-size: 17px;
  line-height: 1.63;
  font-weight: 400;
  animation: intro-fade-in 900ms ease-out 140ms both;
}

@keyframes intro-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .portrait-photo, .intro p { animation: none; }
}

.blank-main { min-height: calc(100vh - 62px); }

.projects-main {
  min-height: calc(100vh - 62px);
  display: flex;
  padding: clamp(24px, 4vw, 52px);
}

.project-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: space-evenly;
  gap: clamp(14px, 1.8vw, 30px);
}

.project-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  animation: project-tile-in 520ms ease-out both;
}

.project-item:nth-child(1) { animation-delay: 0ms; }
.project-item:nth-child(2) { animation-delay: 75ms; }
.project-item:nth-child(3) { animation-delay: 150ms; }
.project-item:nth-child(4) { animation-delay: 225ms; }
.project-item:nth-child(5) { animation-delay: 300ms; }
.project-item:nth-child(6) { animation-delay: 375ms; }
.project-item:nth-child(7) { animation-delay: 450ms; }
.project-item:nth-child(8) { animation-delay: 525ms; }
.project-item:nth-child(9) { animation-delay: 600ms; }
.project-item:nth-child(10) { animation-delay: 675ms; }

@keyframes project-tile-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: block;
  overflow: hidden;
  border: 1px solid #d4e0dd;
  border-radius: 18px;
  background: #e4f7f5;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.project-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 240ms ease;
}

.project-card::before,
.project-card::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}

.project-card::before {
  content: "";
  background: rgba(233, 251, 249, .76);
}

.project-card::after {
  content: attr(data-title);
  padding: 18px;
  color: #172320;
  font-size: clamp(14px, 1.4vw, 21px);
  font-weight: 600;
  text-align: center;
  letter-spacing: .4px;
}

.project-card:hover img, .project-card:focus-visible img { opacity: .38; }
.project-card:hover::before, .project-card:focus-visible::before,
.project-card:hover::after, .project-card:focus-visible::after { opacity: 1; }

.project-nameplate {
  min-height: 1.2em;
  color: #4d605c;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: .35px;
  text-align: center;
  transition: opacity 180ms ease;
}

.project-card:hover + .project-nameplate,
.project-card:focus-visible + .project-nameplate {
  opacity: 0;
}

.project-card:hover, .project-card:focus-visible {
  z-index: 1;
  transform: translateY(-7px) scale(1.035);
  box-shadow: 0 12px 28px rgba(35, 73, 69, .2);
}

.project-card:focus-visible {
  outline: 3px solid #64baff;
  outline-offset: 4px;
}

.project-viewer {
  width: min(1100px, 92vw);
  height: min(900px, 90vh);
  max-width: none;
  max-height: none;
  padding: 0;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 20px 70px rgba(18, 43, 40, .25);
}

.project-viewer[open] { display: flex; }

.project-viewer::backdrop { background: rgba(15, 30, 28, .72); }

.viewer-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 18px;
  border-bottom: 1px solid #e1e7e5;
}

.viewer-toolbar h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.viewer-close {
  padding: 7px 11px;
  border: 1px solid #d8d9d6;
  border-radius: 8px;
  background: #fbfcfa;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.viewer-close span { margin-left: 4px; font-size: 18px; line-height: 0; }

#viewer-frame {
  width: 100%;
  min-height: 0;
  flex: 1;
  border: 0;
  background: #fff;
}

.admin-dialog {
  position: relative;
  width: min(460px, 92vw);
  max-width: none;
  max-height: min(90vh, 720px);
  margin: auto;
  padding: 30px;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  background: #fbfffe;
  color: var(--ink);
  box-shadow: 0 20px 70px rgba(18, 43, 40, .25);
}

.admin-dialog::backdrop { background: rgba(15, 30, 28, .58); }
.admin-dialog h2 { margin: 0 32px 8px 0; font-size: 20px; }
.admin-dialog p { line-height: 1.5; }

.admin-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid #d8e1df;
  border-radius: 50%;
  background: #fff;
  color: #34413e;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 16px 0;
  color: #394642;
  font-size: 13px;
  font-weight: 600;
}

.admin-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cfdad7;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.admin-field input[type="file"] { padding: 7px; font-weight: 400; }
.admin-field input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.admin-error {
  min-height: 1.2em;
  margin: 4px 0 10px;
  color: #b43b39;
  font-size: 13px;
}

.admin-note {
  min-height: 1.5em;
  margin: 14px 0;
  color: #63716d;
  font-size: 12px;
}

.admin-submit {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #bfd3ce;
  border-radius: 9px;
  background: #e9fbf9;
  color: #21312d;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-submit:hover { background: #ddf4f1; }
.admin-submit:disabled { cursor: wait; opacity: .65; }

@media (prefers-reduced-motion: reduce) {
  .project-item { opacity: 1; animation: none; }
  .project-card { transition: none; }
  .project-card:hover, .project-card:focus-visible { transform: none; }
  .project-card img, .project-card::before, .project-card::after,
  .project-nameplate { transition: none; }
}

@media (max-width: 900px) {
  .site-header { padding-inline: 20px; grid-template-columns: 1fr auto; }
  .page-label { display: none; }
  .primary-nav { width: auto; gap: 10px; }
  .nav-link:nth-child(n) { width: auto; }
  .nav-link { padding-inline: 10px; letter-spacing: .45px; }
  .clock { display: none; }
  .home-main { padding: 50px 28px 90px; }
  .intro { grid-template-columns: 150px minmax(0, 1fr); column-gap: 42px; }
  .portrait-photo { width: 150px; height: 170px; }
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .site-header { height: auto; min-height: 62px; grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; }
  .brand-time { display: none; }
  .primary-nav { width: auto; flex-wrap: wrap; gap: 8px; }
  .nav-link { min-height: 29px; font-size: 11px; }
  .home-main { min-height: calc(100vh - 62px); padding: 48px 24px; }
  .intro { grid-template-columns: 1fr; justify-items: center; row-gap: 30px; text-align: center; }
  .intro p { font-size: 16px; }
  .projects-main { min-height: calc(100vh - 62px); padding: 24px 18px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .project-viewer { width: 96vw; height: 92vh; border-radius: 10px; }
  .viewer-toolbar { min-height: 48px; padding-inline: 12px; }
  .admin-dialog { padding: 26px 20px 22px; }
}
