:root {
  color-scheme: light;
  --navy: #133352;
  --ink: #172f43;
  --muted: #526578;
  --blue: #174c73;
  --accent: #286287;
  --line: #d5e0e9;
  --paper: #f0f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: var(--blue); text-underline-offset: .2em; }
::selection { background: #c4e4f5; color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }

.shell {
  width: min(100% - 3rem, 67rem);
  margin-inline: auto;
}

.site-header {
  background: #fff;
  border-top: 4px solid var(--navy);
  border-bottom: 1px solid var(--line);
}

.masthead {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 72px;
  color: var(--navy);
  font-size: 1.125rem;
  font-weight: 650;
}

.masthead img { flex: none; object-fit: contain; }

.portal { padding-block: 2rem 3rem; }

.intro {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 2.15rem 2.25rem;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
}

.intro::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 93% 155%, transparent 0 41%, #335a7d 41.2% 41.5%, transparent 41.7% 50%, #335a7d 50.2% 50.5%, transparent 50.7%) right bottom / 52% 100% no-repeat;
  content: "";
}

.intro h1 {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 720;
  line-height: 1.3;
}

.intro p {
  margin: .65rem 0 0;
  color: #dbe9f4;
  font-size: 1rem;
  line-height: 1.6;
}

.directory {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 1.5rem 1rem;
  margin-top: 1.5rem;
}

.collection { min-width: 0; }
.collection-wide { grid-column: span 2; }
.collection:only-child { grid-column: 1 / -1; }

.collection h2 {
  margin: 0 0 .65rem;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-grid > li { display: flex; min-width: 0; }

.service {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  width: 100%;
  min-height: 10rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}

.service:hover { border-color: #81a6bf; background: #f8fbfe; }
.service:active { background: #dcecf7; }
.service:hover .service-action, .service:focus-visible .service-action {
  text-decoration: underline;
  text-underline-offset: .2em;
}

.service-header { display: flex; align-items: center; gap: .75rem; }

.service-icon {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #e8f1f8;
  color: var(--blue);
}

.service-icon svg { width: 24px; height: 24px; }
.service-name, .service-description { margin: 0; overflow-wrap: anywhere; }
.service-name { font-size: 1.125rem; font-weight: 650; line-height: 1.4; }
.service-description { color: var(--muted); font-size: 1rem; line-height: 1.55; }
.service-action { margin-top: auto; color: var(--blue); font-size: .875rem; font-weight: 650; }

.state-panel {
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
}

.state-panel .button { margin-inline-start: .75rem; }

.admin-toolbar, .actions, .row-actions { display: flex; align-items: center; gap: .5rem; }
.admin-toolbar { justify-content: space-between; flex-wrap: wrap; margin: 1.25rem 0 .5rem; }
.admin-status { min-height: 1.5em; margin: .5rem 0; color: var(--muted); }

.button {
  min-height: 42px;
  padding: .45rem .85rem;
  border: 1px solid #c3d3df;
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-weight: 550;
  cursor: pointer;
}

.button:not(:disabled):hover { background: #e7f1f9; }
.button.primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.button.primary:not(:disabled):hover { background: var(--blue); }
.button.danger { color: #982a32; }
.button:disabled { opacity: .55; cursor: default; }

.editor-row {
  min-width: 0;
  margin: 0 0 1rem;
  padding: .75rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.editor-row legend {
  max-width: 100%;
  padding-inline: .35rem;
  color: var(--navy);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.editor-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.editor-fields label {
  display: grid;
  align-content: start;
  gap: .25rem;
  min-width: 0;
  color: var(--muted);
  font-size: .875rem;
}

.url-field { grid-column: span 2; }

.editor-fields input, .editor-fields select, .editor-fields textarea {
  width: 100%;
  min-height: 42px;
  padding: .5rem .6rem;
  border: 1px solid #bfceda;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}

.editor-fields textarea { resize: vertical; }

.row-actions { margin-top: .75rem; flex-wrap: wrap; }
.row-actions .button { min-height: 38px; font-size: .875rem; }

@media (max-width: 55rem) {
  .directory { grid-template-columns: 1fr; }
  .collection-wide { grid-column: auto; }
}

@media (max-width: 46rem) {
  .shell { width: calc(100% - 2rem); }
  .masthead { min-height: 60px; font-size: 1.0625rem; }
  .masthead img { width: 36px; height: 32px; }
  .portal { padding-block: 1rem 2rem; }
  .intro { padding: 1.45rem 1.25rem; }
  .intro::after { opacity: .5; }
  .intro h1 { font-size: 1.75rem; }
  .intro p { margin-top: .4rem; font-size: .875rem; }
  .directory { gap: 1.25rem; margin-top: 1.25rem; }
  .service-grid { gap: .75rem; }
  .service { min-height: 0; padding: .875rem 1rem; }
  .service-icon { flex-basis: 36px; width: 36px; height: 36px; }
  .service-icon svg { width: 22px; height: 22px; }
  .editor-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .url-field { grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .service { transition: none; }
}
