:root {
  color-scheme: light;
  --bg: #f5f7f5;
  --surface: #ffffff;
  --text: #18201c;
  --muted: #68716c;
  --line: #dce2de;
  --green: #1f6545;
  --green-soft: #e8f3ed;
  --blue: #236e94;
  --facebook: #1877f2;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

.home-topbar {
  min-height: 68px;
  padding: 10px max(20px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
}

.home-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.home-brand img {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: contain;
}

.home-brand strong,
.home-brand span { display: block; }
.home-brand strong { font-size: 15px; }
.home-brand span { margin-top: 2px; color: var(--muted); font-size: 12px; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 13px;
}

.server-state,
.card-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.server-state i,
.card-status i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9da4a0;
}

.server-state.online i,
.card-status.online i { background: #27a05d; box-shadow: 0 0 0 3px #dff3e7; }
.server-state.offline i,
.card-status.offline i { background: #c23b33; box-shadow: 0 0 0 3px #fbe8e5; }

.home-main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 52px 20px 64px;
  flex: 1;
}

.school-intro {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-bottom: 44px;
  border-bottom: 1px solid var(--line);
}

.school-intro > img {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 42px; line-height: 1.08; }
h2 { font-size: 23px; line-height: 1.2; }
.intro-copy { max-width: 650px; margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

.portal-section { padding-top: 42px; }
.section-heading {
  margin-bottom: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.section-note { color: var(--muted); font-size: 12px; }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.portal-card {
  --accent: var(--green);
  min-width: 0;
  min-height: 236px;
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 17px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.portal-card:hover,
.portal-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  box-shadow: 0 10px 28px rgba(24, 32, 28, .08);
  transform: translateY(-2px);
  outline: none;
}

.portal-card.facebook { --accent: var(--facebook); }
.portal-card.monitoring { --accent: var(--blue); }

.card-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.card-icon img { width: 42px; height: 42px; object-fit: contain; }

.card-content { display: block; min-width: 0; }
.card-content strong { display: block; font-size: 17px; line-height: 1.35; }
.card-content > span { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.card-status { color: var(--muted); font-size: 12px; }
.card-action { color: var(--accent); font-size: 13px; font-weight: 800; }
.card-action b { margin-left: 4px; font-size: 16px; }

.home-admin {
  margin-top: 24px;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.home-admin a { color: var(--green); font-weight: 750; text-decoration: none; }
.home-admin a:hover { text-decoration: underline; }

.home-footer {
  min-height: 62px;
  padding: 18px max(20px, calc((100vw - 1120px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  background: #e9eeeb;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card { min-height: 0; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .card-icon { grid-row: 1 / span 2; }
  .card-content { grid-column: 2; }
  .card-status { grid-column: 2; }
  .card-action { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .home-topbar { align-items: flex-start; }
  .header-meta { padding-top: 4px; }
  #home-clock { display: none; }
  .server-state { max-width: 116px; line-height: 1.3; }
  .home-main { padding: 34px 14px 44px; }
  .school-intro { align-items: flex-start; gap: 17px; padding-bottom: 34px; }
  .school-intro > img { width: 72px; height: 72px; }
  h1 { font-size: 32px; }
  .intro-copy { font-size: 14px; }
  .portal-section { padding-top: 34px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .portal-card { padding: 18px; }
  .home-admin, .home-footer { align-items: flex-start; flex-direction: column; }
}

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