/* Page shell for the ATP Toolbox: background, logo, and the tool tabs.
   Each tool's own styles live in /tools/<name>/styles.css and are scoped to that tool. */

:root {
  --atp-blue: #5481c1;      /* the "T" in the ATP logo */
  --bg-blue: #1f3a5f;       /* darker blue behind the characters */
  --panel: rgba(14, 30, 52, 0.88);
  --line: rgba(84, 129, 193, 0.55);
  --text-dim: #b9c9df;
  --ok: #7fd6a0;
  --error: #ffcf66;
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-blue);
  color: #fff;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Logo, upper-left */
.site-header {
  position: relative;
  z-index: 2;
  padding: 16px 20px 0;
  pointer-events: none;
}

.logo-link {
  pointer-events: auto;
  display: inline-block;
  width: clamp(190px, 20vw, 270px);
}

.logo-link img {
  display: block;
  width: 100%;
  height: auto;
  /* Soft shadow keeps the logo readable over the falling characters. */
  filter: drop-shadow(0 0 6px rgba(15, 30, 50, 0.95)) drop-shadow(0 0 14px rgba(15, 30, 50, 0.8));
  transition: filter 0.25s ease;
}

.logo-link:hover img,
.logo-link:focus-visible img {
  filter:
    drop-shadow(0 0 3px rgba(0, 0, 0, 0.9))
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.85));
}

.logo-link:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 6px;
  border-radius: 6px;
}

/* Tool area. The box is anchored near the top instead of centered so the tabs
   stay in the same place when tools of different heights are switched. */
.content {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 110px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1.5rem, 6vh, 4rem) 16px 3rem;
  pointer-events: none; /* let the mouse reach the canvas outside the box */
}

.toolbox {
  width: min(520px, 100%);
}

/* ---------- Tool tabs, attached to the top of the box ---------- */

.tool-tabs {
  display: flex;
  pointer-events: auto;
}

.tool-tab {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.4rem 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-dim);
  text-decoration: none;
  background: rgba(14, 30, 52, 0.62);
  border: 1px solid rgba(84, 129, 193, 0.35);
  border-bottom-color: var(--line);
  border-radius: 10px 10px 0 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.tool-tab + .tool-tab { margin-left: -1px; }

.tool-tab svg { flex: 0 0 auto; }

.tool-tab:hover {
  color: #fff;
  background: rgba(30, 56, 92, 0.8);
}

.tool-tab:focus-visible {
  z-index: 2;
  outline: 2px solid #fff;
  outline-offset: -3px;
}

/* Selected tab: same fill as the box, no line underneath, blue bar on top. */
.tool-tab[aria-selected="true"],
html:not([data-tool]) .tool-tab[data-tool="password"],
html[data-tool="password"] .tool-tab[data-tool="password"],
html[data-tool="phonetic"] .tool-tab[data-tool="phonetic"],
html[data-tool="hours"] .tool-tab[data-tool="hours"],
html[data-tool="subnet"] .tool-tab[data-tool="subnet"] {
  z-index: 1;
  color: #fff;
  background: var(--panel);
  border-color: var(--line);
  border-bottom-color: transparent;
}

.tool-tab[aria-selected="true"]::before,
html:not([data-tool]) .tool-tab[data-tool="password"]::before,
html[data-tool="password"] .tool-tab[data-tool="password"]::before,
html[data-tool="phonetic"] .tool-tab[data-tool="phonetic"]::before,
html[data-tool="hours"] .tool-tab[data-tool="hours"]::before,
html[data-tool="subnet"] .tool-tab[data-tool="subnet"]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 9px;
  right: 9px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--atp-blue);
}

/* ---------- Tool panels ---------- */

/* Only the selected tool shows. html[data-tool] is set by toolbox.js before the page draws. */
.tool { display: none; }

html:not([data-tool]) .tool-password,
html[data-tool="password"] .tool-password,
html[data-tool="phonetic"] .tool-phonetic,
html[data-tool="hours"] .tool-hours,
html[data-tool="subnet"] .tool-subnet { display: block; }

/* The box's top edge is drawn by the tabs, so square off its top corners. */
.toolbox .tool .panel,
.toolbox .tool .face {
  border-top-color: transparent;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

[hidden] { display: none !important; }

/* Used by the hours calculator's copy fallback, which adds a textarea to <body>. */
.offscreen {
  position: fixed;
  top: 0;
  left: -9999px;
  opacity: 0;
}

@media (max-width: 480px) {
  .content { min-height: calc(100vh - 90px); padding-top: 1.25rem; }
  .tool-tab {
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0.2rem 0.45rem;
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-link img, .tool-tab { transition: none; }
}
