/*
Theme Name: SG HR Theme
Theme URI: https://example.com/sg-hr-theme
Description: Front page, sign-in, employee portal and administration pages for the SG HR OS plugin, plus a guided setup for the plugin's encryption keys. Requires the SG HR OS plugin for the portal pages.
Author: Wei Yun
Version: 1.0.0
Requires at least: 6.2
Requires PHP: 8.1
License: Proprietary
Text Domain: sg-hr-theme
*/

:root {
  --sghr-bg: #f7f8fb; --sghr-surface: #ffffff; --sghr-ink: #14213d; --sghr-muted: #5b6478; --sghr-line: #e3e7ef;
  --sghr-accent: #1b5fd1; --sghr-accent-ink: #ffffff; --sghr-accent-soft: #e8f0fd; --sghr-ok: #1a7f4b; --sghr-warn: #a15c00; --sghr-bad: #b3261e;
  --sghr-radius: 14px; --sghr-shadow: 0 1px 2px rgba(20,33,61,.06), 0 8px 24px rgba(20,33,61,.06);
  --sghr-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --sghr-bg: #0e1422; --sghr-surface: #151d30; --sghr-ink: #eef2fb; --sghr-muted: #9aa5bd; --sghr-line: #26314b; --sghr-accent: #6ea0ff; --sghr-accent-ink: #0b1220; --sghr-accent-soft: #1a2846; --sghr-shadow: none; }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--sghr-bg); color: var(--sghr-ink); font-family: var(--sghr-font); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--sghr-accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--sghr-accent); outline-offset: 2px; border-radius: 4px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; left: 12px; top: 12px; z-index: 100001; background: var(--sghr-surface); color: var(--sghr-ink); padding: 10px 14px; border-radius: 8px; width: auto; height: auto; clip: auto; box-shadow: var(--sghr-shadow); }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); } h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); } h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

/* header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--sghr-surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--sghr-line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--sghr-ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--sghr-accent); color: var(--sghr-accent-ink); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.brand img { max-height: 38px; width: auto; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--sghr-line); border-radius: 10px; padding: 8px 12px; color: var(--sghr-ink); font: inherit; cursor: pointer; }
.primary-nav { margin-left: auto; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; }
.primary-nav li { position: relative; }
.primary-nav a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--sghr-ink); text-decoration: none; font-size: .95rem; font-weight: 500; }
.primary-nav a:hover, .primary-nav .current-menu-item > a { background: var(--sghr-accent-soft); color: var(--sghr-accent); }
.primary-nav .sub-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 220px; flex-direction: column; align-items: stretch; background: var(--sghr-surface); border: 1px solid var(--sghr-line); border-radius: 12px; padding: 6px; box-shadow: var(--sghr-shadow); }
.primary-nav li:hover > .sub-menu, .primary-nav li:focus-within > .sub-menu { display: flex; }
.primary-nav .menu-cta > a { background: var(--sghr-accent); color: var(--sghr-accent-ink); }
.primary-nav .menu-cta > a:hover { background: var(--sghr-accent); color: var(--sghr-accent-ink); filter: brightness(1.08); }
body:not(.sghr-logged-in) .sghr-in { display: none; }
body.sghr-logged-in .sghr-out { display: none; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .primary-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--sghr-surface); border-bottom: 1px solid var(--sghr-line); padding: 10px 20px 18px; }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; align-items: stretch; }
  .primary-nav .sub-menu { display: flex; position: static; border: 0; box-shadow: none; padding: 0 0 0 14px; }
}

/* buttons & cards */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 22px; border-radius: 12px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 600; }
.btn-primary { background: var(--sghr-accent); color: var(--sghr-accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--sghr-ink); border-color: var(--sghr-line); }
.btn-ghost:hover { border-color: var(--sghr-accent); color: var(--sghr-accent); }
.card { background: var(--sghr-surface); border: 1px solid var(--sghr-line); border-radius: var(--sghr-radius); padding: 24px; box-shadow: var(--sghr-shadow); }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.icon { width: 44px; height: 44px; border-radius: 12px; background: var(--sghr-accent-soft); color: var(--sghr-accent); display: grid; place-items: center; margin-bottom: 14px; }
.icon svg { width: 22px; height: 22px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--sghr-accent); margin-bottom: 10px; }
.muted { color: var(--sghr-muted); }
section.band { padding: clamp(56px, 8vw, 96px) 0; }
section.band.alt { background: var(--sghr-surface); border-block: 1px solid var(--sghr-line); }
.section-head { max-width: 680px; margin-bottom: 36px; }

/* hero */
.hero { padding: clamp(56px, 9vw, 110px) 0 clamp(48px, 7vw, 88px); background: radial-gradient(1200px 500px at 85% -10%, var(--sghr-accent-soft), transparent 60%); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero p.lead { font-size: 1.2rem; color: var(--sghr-muted); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-note { margin-top: 18px; font-size: .9rem; color: var(--sghr-muted); }
.lifecycle { display: grid; gap: 10px; }
.lifecycle li { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--sghr-line); border-radius: 12px; background: var(--sghr-surface); font-weight: 500; }
.lifecycle { margin: 0; padding: 0; }
.lifecycle .n { width: 26px; height: 26px; border-radius: 50%; background: var(--sghr-accent-soft); color: var(--sghr-accent); display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { padding-left: 30px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .45em; width: 18px; height: 18px; border-radius: 50%; background: var(--sghr-accent-soft); box-shadow: inset 0 0 0 5px var(--sghr-accent); }
.faq details { border: 1px solid var(--sghr-line); border-radius: 12px; background: var(--sghr-surface); padding: 4px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
.cta-band { background: var(--sghr-accent); color: var(--sghr-accent-ink); border-radius: 24px; padding: clamp(32px, 5vw, 56px); text-align: center; }
.cta-band a.btn { background: var(--sghr-accent-ink); color: var(--sghr-accent); }

/* content pages */
.page-head { padding: 48px 0 12px; }
.page-content { padding: 12px 0 72px; max-width: 760px; }
.page-content.wide { max-width: none; }
.notice { border: 1px solid var(--sghr-line); border-left: 4px solid var(--sghr-warn); background: var(--sghr-surface); border-radius: 10px; padding: 14px 18px; margin: 0 0 20px; }
.notice.ok { border-left-color: var(--sghr-ok); } .notice.bad { border-left-color: var(--sghr-bad); }
.status-bar { background: #fff4e0; color: #5c3a00; border-bottom: 1px solid #f1d29a; padding: 10px 0; font-size: .92rem; }
.status-bar a { color: inherit; font-weight: 600; }

/* portal */
body.sghr-portal { background: var(--sghr-bg); }
.portal-shell { padding: 20px 0 48px; }
.portal-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; padding: 0; list-style: none; }
.portal-tabs a { display: inline-block; padding: 7px 14px; border: 1px solid var(--sghr-line); border-radius: 999px; background: var(--sghr-surface); color: var(--sghr-ink); text-decoration: none; font-size: .9rem; }
.portal-tabs a:hover { border-color: var(--sghr-accent); color: var(--sghr-accent); }
.portal-tabs a[aria-current="page"] { background: var(--sghr-accent); color: var(--sghr-accent-ink); border-color: var(--sghr-accent); }
.portal-noscript, .portal-missing { max-width: 640px; margin: 48px auto; }

/* login */
.login-card { max-width: 440px; margin: 56px auto 80px; }
.login-card form p { margin: 0 0 14px; }
.login-card label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.login-card input[type=text], .login-card input[type=password] { width: 100%; padding: 12px 14px; border: 1px solid var(--sghr-line); border-radius: 10px; background: var(--sghr-bg); color: var(--sghr-ink); font: inherit; }
.login-card input[type=submit] { width: 100%; padding: 13px; border-radius: 12px; border: 0; background: var(--sghr-accent); color: var(--sghr-accent-ink); font: inherit; font-weight: 700; cursor: pointer; }
.login-card .login-remember { display: flex; gap: 8px; align-items: center; } .login-card .login-remember label { margin: 0; font-weight: 400; }

/* setup screen (wp-admin) */
.sghrt-setup { max-width: 860px; }
.sghrt-setup table.widefat td, .sghrt-setup table.widefat th { padding: 10px 12px; }
.sghrt-setup .ok { color: #1a7f4b; font-weight: 600; } .sghrt-setup .bad { color: #b3261e; font-weight: 600; } .sghrt-setup .warn { color: #a15c00; font-weight: 600; }
.sghrt-setup textarea.code { width: 100%; min-height: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* footer */
.site-footer { border-top: 1px solid var(--sghr-line); background: var(--sghr-surface); padding: 40px 0; font-size: .92rem; color: var(--sghr-muted); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--sghr-muted); }
@media print { .site-header, .site-footer, .portal-tabs, .status-bar { display: none !important; } body { background: #fff; } }
