/*
Theme Name: Engineering Coming Soon
Theme URI: https://example.com/
Author: Your Name
Description: Temporary "Website Under Construction" theme for engineering and technical services companies. Single-screen layout (no scrolling) with a Tic-Tac-Toe game. Customize company name, tagline, progress and contact details from Appearance > Customize.
Version: 1.2
License: GPL v2 or later
Text Domain: eng-coming-soon
*/

:root {
  --bg: #0b1c2e;
  --bg2: #102a43;
  --line: rgba(255, 255, 255, 0.06);
  --accent: #f5a623;
  --text: #e8eef5;
  --muted: #9fb3c8;
  --card: rgba(255, 255, 255, 0.04);
  --o: #6cc4ff;
  /* board size: fills the leftover screen height (mobile default) */
  --b: min(84vw, 320px, max(150px, calc(100vh - 480px)));
}

@supports (height: 100dvh) {
  :root { --b: min(84vw, 320px, max(150px, calc(100dvh - 480px))); }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, var(--bg2), var(--bg) 70%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  line-height: 1.4;
  overflow-x: hidden;
}

/* ---------- Page layout: everything fits in one screen ---------- */
.ecs-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "game" "bottom" "footer";
  align-content: space-evenly;
  row-gap: 10px;
  text-align: center;
}

.ecs-top { grid-area: top; }
.ecs-game { grid-area: game; }
.ecs-bottom { grid-area: bottom; }
.ecs-footer { grid-area: footer; }

.ecs-brand {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecs-brand strong { color: var(--accent); }

.ecs-gears {
  display: none;
  position: relative;
  width: 100px;
  height: 70px;
  margin: 0 auto 10px;
}

.ecs-gear { position: absolute; height: auto; fill: none; stroke: var(--accent); stroke-width: 6; }
.ecs-gear.big { width: 59%; left: 6%; top: 0; animation: ecs-spin 10s linear infinite; }
.ecs-gear.small { width: 39%; left: 53%; top: 42%; stroke: var(--text); animation: ecs-spin 6.6s linear infinite reverse; }

@keyframes ecs-spin { to { transform: rotate(360deg); } }

.ecs-badge {
  display: inline-block;
  padding: 3px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

h1.ecs-title {
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1.15;
  margin-bottom: 6px;
}

p.ecs-sub {
  max-width: 560px;
  margin: 0 auto 10px;
  color: var(--muted);
  font-size: 13px;
}

.ecs-progress { max-width: 420px; margin: 0 auto; text-align: left; }

.ecs-progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ecs-bar { height: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }

.ecs-bar-fill {
  height: 100%;
  background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 12px, #e09412 12px, #e09412 24px);
  background-size: 34px 34px;
  animation: ecs-stripes 1.2s linear infinite;
  border-radius: 999px;
}

@keyframes ecs-stripes { to { background-position: 34px 0; } }

/* ---------- Services + contact ---------- */
.ecs-services {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ecs-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.2s;
}

.ecs-pill:hover { border-color: var(--accent); }
.ecs-pill i { font-style: normal; font-size: 14px; }

.ecs-contact h2 { font-size: 14px; margin-bottom: 4px; }

.ecs-contact a {
  display: inline-block;
  margin: 3px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ecs-contact a.alt { background: transparent; color: var(--text); border: 1px solid var(--muted); }

.ecs-footer { font-size: 11px; color: var(--muted); }

/* ---------- Tic-Tac-Toe game ---------- */
.ecs-game {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 12px;
  background: #122539; /* solid: page grid lines must not show through */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  position: relative;
  z-index: 1;
}

.ecs-game h2, .ecs-game-sub { display: none; }

.ecs-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.ecs-modes { display: inline-flex; border: 1px solid var(--muted); border-radius: 999px; overflow: hidden; }

.ecs-mode, .ecs-btn, .ecs-level select {
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ecs-mode {
  padding: 6px 10px;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
  border: 0;
  transition: background 0.2s, color 0.2s;
}

.ecs-mode.on { background: var(--accent); color: #1a1a1a; font-weight: 600; }

.ecs-level { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ecs-level-text { display: none; }

.ecs-level select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--muted);
  background: var(--bg2);
  color: var(--text);
}

.ecs-scoreboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }

.ecs-score {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.ecs-score .n { font-size: 20px; font-weight: 700; line-height: 1.1; }
.ecs-score .l { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ecs-score.x .n { color: var(--accent); }
.ecs-score.o .n { color: var(--o); }
.ecs-score.bump { animation: ecs-bump 0.45s ease; }

@keyframes ecs-bump { 40% { transform: scale(1.1); border-color: var(--accent); } }

.ecs-status {
  min-height: 22px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
}

.ecs-status-win { color: #5fd38d; }
.ecs-status-lose { color: #ff7a7a; }
.ecs-status-draw { color: var(--accent); }
.ecs-status-think { color: var(--muted); font-weight: 500; }

.ecs-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: var(--b);
  margin: 0 auto 8px;
}

.ecs-cell {
  aspect-ratio: 1 / 1;
  font: inherit;
  font-size: calc(var(--b) * 0.16);
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.ecs-cell:hover:not(:disabled) { background: rgba(245, 166, 35, 0.12); border-color: var(--accent); }
.ecs-cell:focus-visible, .ecs-mode:focus-visible, .ecs-btn:focus-visible, .ecs-level select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ecs-cell:disabled { cursor: default; }
.ecs-cell.ecs-x { color: var(--accent); animation: ecs-pop 0.25s ease; }
.ecs-cell.ecs-o { color: var(--o); animation: ecs-pop 0.25s ease; }
.ecs-cell.ecs-win { background: rgba(95, 211, 141, 0.2); border-color: #5fd38d; }

@keyframes ecs-pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ecs-game-actions { display: flex; gap: 8px; justify-content: center; }

.ecs-btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 600;
}

.ecs-btn.alt { background: transparent; color: var(--text); border-color: var(--muted); font-weight: 500; }

/* ---------- Mobile: hide the least important bits on short screens ---------- */
@media (max-width: 599px) {
  p.ecs-sub { display: none; }
}

@media (max-height: 720px) {
  p.ecs-sub { display: none; }
  .ecs-contact h2 { display: none; }
}

@media (max-height: 700px) {
  .ecs-services { display: none; }
}

@media (min-height: 701px) {
  :root { --b: min(84vw, 320px, max(150px, calc(100vh - 590px))); }
}

@supports (height: 100dvh) {
  @media (min-height: 701px) {
    :root { --b: min(84vw, 320px, max(150px, calc(100dvh - 590px))); }
  }
}

/* ---------- Desktop / tablet landscape: two columns ---------- */
@media (min-width: 900px), (orientation: landscape) and (min-width: 600px) {
  :root { --b: min(360px, max(170px, calc(100vh - 330px))); }

  .ecs-wrap {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    grid-template-areas: "top game" "bottom game" "footer footer";
    align-content: center;
    column-gap: 40px;
    row-gap: 18px;
    padding: 20px 32px;
    text-align: left;
  }

  .ecs-top { align-self: end; }
  .ecs-bottom { align-self: start; }
  .ecs-game { align-self: center; justify-self: center; padding: 18px 20px; }
  .ecs-footer { text-align: center; }

  .ecs-brand { font-size: 13px; margin-bottom: 12px; }
  .ecs-badge { font-size: 12px; padding: 4px 14px; margin-bottom: 12px; }
  h1.ecs-title { font-size: clamp(26px, 5.6vh, 48px); margin-bottom: 10px; }
  p.ecs-sub { display: block; font-size: 16px; margin: 0 0 16px; }
  .ecs-progress { margin: 0; max-width: 480px; }

  .ecs-services { justify-content: flex-start; gap: 8px; margin-bottom: 14px; }
  .ecs-pill { font-size: 14px; padding: 6px 14px; }
  .ecs-contact h2 { display: block; font-size: 16px; margin-bottom: 6px; }
  .ecs-contact a { margin: 4px 8px 4px 0; padding: 10px 18px; font-size: 14px; }

  .ecs-game h2 { display: block; font-size: 20px; margin-bottom: 2px; }
  .ecs-game-sub { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
  .ecs-status { font-size: 16px; }
  .ecs-level-text { display: inline; }
  .ecs-mode { padding: 6px 13px; }
  .ecs-brand { letter-spacing: 2px; }
  .ecs-score .n { font-size: 22px; }
  .ecs-footer { font-size: 12px; }
}

/* short desktop/laptop screens: free up vertical space */
@media (min-width: 900px) and (max-height: 760px) {
  :root { --b: min(360px, max(170px, calc(100vh - 270px))); }
  .ecs-game h2, .ecs-game-sub { display: none; }
  p.ecs-sub { font-size: 14px; margin-bottom: 10px; }
}

@media (min-width: 900px) and (max-height: 600px) {
  p.ecs-sub { display: none; }
  .ecs-services { display: none; }
}

/* roomy desktop screens: show the spinning gears */
@media (min-width: 900px) and (min-height: 780px) {
  .ecs-gears { display: block; width: 110px; height: 78px; margin: 0 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ecs-gear, .ecs-bar-fill, .ecs-cell, .ecs-score { animation: none !important; }
}
