:root {
  --ink: #071820;
  --muted: #5c7279;
  --teal: #009bd3;
  --green: #8fcf50;
  --yellow: #f2e500;
  --orange: #f8bd59;
  --paper: #f8f8f1;
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(242, 229, 0, 0.2), transparent 25%),
    radial-gradient(circle at 82% 80%, rgba(0, 155, 211, 0.22), transparent 30%),
    #eaf2f1;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.home-link {
  position: fixed;
  z-index: 20;
  top: 18px;
  left: 18px;
  min-height: 42px;
  border-radius: 8px;
  padding: 11px 14px;
  background: rgba(7, 24, 32, 0.86);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 850;
  text-decoration: none;
}

.square-kiosk {
  position: relative;
  display: grid;
  grid-template-rows: clamp(96px, 15vmin, 146px) minmax(0, 1fr) clamp(72px, 10vmin, 104px) clamp(92px, 13vmin, 132px);
  width: min(100vw, 100vh);
  aspect-ratio: 1;
  max-width: 1080px;
  max-height: 1080px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 24, 32, 0.96), rgba(12, 62, 73, 0.94) 16%, rgba(248, 248, 241, 0.96) 16%),
    var(--paper);
  box-shadow: 0 28px 90px rgba(7, 24, 32, 0.18);
}

.square-header {
  display: grid;
  grid-template-columns: minmax(200px, 330px) auto;
  align-items: center;
  justify-content: space-between;
  min-height: 0;
  padding: clamp(16px, 3vmin, 28px) clamp(28px, 5vmin, 42px) clamp(12px, 2.2vmin, 22px);
}

.brand {
  width: 100%;
  max-height: clamp(62px, 10vmin, 92px);
  object-fit: contain;
  object-position: left center;
}

.counter {
  min-width: 94px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 13px 16px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
}

.square-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(290px, 42%) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 3vmin, 38px);
  min-height: 0;
  padding: clamp(10px, 2vmin, 26px) clamp(54px, 8vmin, 64px) clamp(8px, 1.5vmin, 16px);
}

.portrait-ring {
  position: relative;
  width: 100%;
  max-width: clamp(230px, 39vmin, 410px);
  aspect-ratio: 1;
  justify-self: center;
  overflow: hidden;
  border: 10px solid #ffffff;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(7, 24, 32, 0.2);
}

.portrait-ring::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(0, 155, 211, 0.26);
  border-radius: inherit;
  pointer-events: none;
}

.portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: opacity 220ms ease, transform 520ms ease;
}

.portrait.is-changing {
  opacity: 0;
  transform: scale(1.04);
}

.details {
  min-width: 0;
}

.period-badge {
  display: inline-flex;
  min-height: clamp(34px, 5vmin, 44px);
  align-items: center;
  border-radius: 8px;
  padding: 0 clamp(10px, 1.7vmin, 16px);
  background: linear-gradient(90deg, var(--yellow), var(--green), var(--teal));
  color: var(--ink);
  font-size: clamp(0.92rem, 1.7vmin, 1.28rem);
  font-weight: 900;
}

h1 {
  margin: clamp(10px, 2vmin, 18px) 0 6px;
  color: #426169;
  font-size: clamp(0.76rem, 1.3vmin, 1.15rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5vmin, 4.8rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-wrap: balance;
}

#office {
  margin: clamp(8px, 1.5vmin, 14px) 0 0;
  color: #31535c;
  font-size: clamp(0.92rem, 1.7vmin, 1.55rem);
  font-weight: 700;
  line-height: 1.2;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: clamp(8px, 1.6vmin, 18px);
}

.meta-row span {
  min-height: clamp(32px, 4.4vmin, 38px);
  border: 1px solid rgba(0, 155, 211, 0.22);
  border-radius: 8px;
  padding: 7px 10px;
  background: #ffffff;
  color: #25434a;
  font-size: clamp(0.76rem, 1.25vmin, 0.92rem);
  font-weight: 800;
}

.nav-button {
  position: absolute;
  z-index: 5;
  top: 50%;
  display: grid;
  width: clamp(56px, 6vw, 72px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(7, 24, 32, 0.76);
  color: #ffffff;
  cursor: pointer;
  transform: translateY(-50%);
}

.nav-button span {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
}

.previous {
  left: 20px;
}

.next {
  right: 20px;
}

.nav-button:hover,
.nav-button:focus-visible {
  background: var(--teal);
  outline: none;
}

.square-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 1.4fr);
  gap: clamp(8px, 1.6vmin, 12px);
  padding: 4px clamp(28px, 5vmin, 42px) clamp(10px, 2vmin, 18px);
}

.search-wrap,
.decade-tabs,
.timeline {
  border: 1px solid rgba(7, 24, 32, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.search-wrap {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
}

.search-wrap label {
  color: #49666f;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-wrap input {
  width: 100%;
  min-height: clamp(34px, 5vmin, 42px);
  border: 1px solid rgba(7, 24, 32, 0.1);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
}

.decade-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 8px;
}

.decade-tabs button {
  min-height: clamp(38px, 5.8vmin, 52px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #38545c;
  font-size: clamp(0.74rem, 1.25vmin, 0.88rem);
  font-weight: 900;
  cursor: pointer;
}

.decade-tabs button.active {
  background: var(--ink);
  color: #ffffff;
}

.timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(clamp(120px, 18vmin, 154px), 1fr);
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 clamp(28px, 5vmin, 42px) clamp(18px, 3vmin, 32px);
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) transparent;
}

.timeline-item {
  display: grid;
  align-content: center;
  min-height: clamp(70px, 10vmin, 92px);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.timeline-item.active {
  background: linear-gradient(180deg, rgba(0, 155, 211, 0.16), rgba(248, 189, 89, 0.22));
  box-shadow: inset 0 4px 0 var(--teal);
}

.item-period {
  color: #006a91;
  font-size: clamp(0.66rem, 1.05vmin, 0.76rem);
  font-weight: 900;
}

.item-name {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(0.72rem, 1.22vmin, 0.88rem);
  font-weight: 900;
  line-height: 1.08;
  text-overflow: ellipsis;
}

.item-office {
  display: none;
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-aspect-ratio: 4 / 5) {
  body {
    overflow: auto;
  }

  .square-kiosk {
    width: 100vw;
    height: auto;
  }
}
