<?php
header('HTTP/1.1 404 Not Found', true, 404);

$strings = array(
    'en' => array(
        'lang' => 'en', 'dir' => 'ltr',
        'title' => 'Domain Not Found | uPress',
        'heading' => 'Domain Not Found',
        'lead' => 'The domain you’re looking for doesn’t exist or isn’t connected to a uPress account.',
        'go' => 'Go to uPress',
        'guide' => 'Domain connection guide',
        'help' => 'Need help?',
        'home' => 'https://www.upress.io/',
        'home_label' => 'uPress home',
        'guide_url' => 'https://support.upress.io/dev/domain-not-found-what-to-do/',
        'support' => 'https://support.upress.io/',
    ),
    'he' => array(
        'lang' => 'he', 'dir' => 'rtl',
        'title' => 'הדומיין לא נמצא | uPress',
        'heading' => 'הדומיין לא נמצא',
        'lead' => 'הדומיין שחיפשתם לא קיים או לא מחובר לחשבון ב-uPress.',
        'go' => 'מעבר ל-uPress',
        'guide' => 'מדריך לחיבור דומיין',
        'help' => 'צריכים עזרה?',
        'home' => 'https://www.upress.co.il/',
        'home_label' => 'דף הבית של uPress',
        'guide_url' => 'https://support.upress.co.il/dev/domain-not-found/',
        'support' => 'https://support.upress.co.il/',
    ),
);

// Hebrew when the browser lists it anywhere in Accept-Language
$lang = 'en';
$accept = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) : array();
foreach ($accept as $item) {
    if (preg_match('/^\s*he\b/i', $item)) {
        $lang = 'he';
        break;
    }
}
$s = $strings[$lang];
?>
<!doctype html>
<html lang="<?php echo $s['lang']; ?>" dir="<?php echo $s['dir']; ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<meta name="color-scheme" content="light">
<meta name="theme-color" content="#f4f7fd">
<title><?php echo $s['title']; ?></title>
<link rel="icon" type="image/png" href="https://cdn.upress.cloud/404/assets/favicon.png">
<link rel="apple-touch-icon" href="https://cdn.upress.cloud/404/assets/apple-touch-icon.png">
<link rel="preconnect" href="https://cdn.upress.cloud" crossorigin>
<link rel="preload" as="image" href="https://cdn.upress.cloud/404/assets/scene.webp?v=2" fetchpriority="high">
<link rel="preload" as="font" type="font/woff2" href="https://cdn.upress.cloud/404/assets/fonts/inter-700.woff2" crossorigin>
<style>
@font-face{font-family:"uPress Inter";font-style:normal;font-weight:400;font-display:swap;src:url("https://cdn.upress.cloud/404/assets/fonts/inter-400.woff2") format("woff2")}
@font-face{font-family:"uPress Inter";font-style:normal;font-weight:500;font-display:swap;src:url("https://cdn.upress.cloud/404/assets/fonts/inter-500.woff2") format("woff2")}
@font-face{font-family:"uPress Inter";font-style:normal;font-weight:600;font-display:swap;src:url("https://cdn.upress.cloud/404/assets/fonts/inter-600.woff2") format("woff2")}
@font-face{font-family:"uPress Inter";font-style:normal;font-weight:700;font-display:swap;src:url("https://cdn.upress.cloud/404/assets/fonts/inter-700.woff2") format("woff2")}

:root{
  --bg:#f4f7fd;
  --ink:#0b1630;
  --muted:#4a5470;
  --blue:#0d69f0;
  --blue-hover:#0a5ad6;
  --blue-ink:#0d55d8;
  --line:#dde5f1;
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{
  margin:0;min-height:100vh;min-height:100dvh;
  display:flex;flex-direction:column;
  background-color:#f3f6fd;
  background-image:radial-gradient(60% 50% at 50% 62%,#f9fbff 0%,rgba(249,251,255,0) 100%),linear-gradient(180deg,#f0f4fd 0%,#f4f7fd 45%,#f3f6fc 100%);
  background-attachment:fixed;
  color:var(--ink);
  font-family:"uPress Inter",Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;
}
a{color:inherit}

.top{position:absolute;top:0;left:0;right:0;z-index:2;padding:22px clamp(16px,6.4vw,115px) 0}
.top a{display:inline-block;border-radius:8px}
.top img{display:block;height:42px;width:auto}

main{flex:1;display:flex;flex-direction:column;align-items:center;text-align:center;padding:0 16px 56px}

.scene{width:100%;max-width:1802px;height:clamp(250px,25.64vw,462px);pointer-events:none;user-select:none}
.scene img{
  display:block;width:100%;height:100%;object-fit:cover;object-position:50% 100%;
  -webkit-mask-image:linear-gradient(90deg,transparent 0,#000 9%,#000 91%,transparent 100%),linear-gradient(180deg,transparent 0,#000 10%,#000 86%,transparent 100%);
  -webkit-mask-composite:source-in;
          mask-image:linear-gradient(90deg,transparent 0,#000 9%,#000 91%,transparent 100%),linear-gradient(180deg,transparent 0,#000 10%,#000 86%,transparent 100%);
          mask-composite:intersect;
}

h1{margin:2px 0 0;font-weight:700;font-size:clamp(2.1rem,1.15rem + 3.3vw,3.9rem);line-height:1.1;letter-spacing:-.02em;color:var(--ink)}
.lead{margin:18px 0 0;max-width:60rem;text-wrap:balance;font-size:clamp(1.02rem,.94rem + .36vw,1.36rem);line-height:1.5;color:var(--muted)}

.actions{display:flex;flex-wrap:wrap;justify-content:center;gap:16px 28px;margin-top:40px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:12px;
  height:60px;padding:0 44px;border-radius:14px;
  font-size:1.15rem;font-weight:600;line-height:1;text-decoration:none;white-space:nowrap;
  transition:background-color .15s ease,box-shadow .15s ease,transform .15s ease,border-color .15s ease;
}
.btn svg{width:24px;height:24px;flex:none}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:none}
.btn:focus-visible,.help:focus-visible,.top a:focus-visible{outline:3px solid rgba(13,105,240,.45);outline-offset:3px}
.btn-primary{min-width:272px;background:var(--blue);color:#fff;box-shadow:0 10px 24px -10px rgba(13,105,240,.65)}
.btn-primary:hover{background:var(--blue-hover);box-shadow:0 14px 28px -12px rgba(13,105,240,.7)}
.btn-secondary{background:#fff;color:var(--blue-ink);border:1px solid var(--line);box-shadow:0 8px 22px -14px rgba(16,40,90,.35)}
.btn-secondary:hover{border-color:#c9d6ec;box-shadow:0 12px 26px -14px rgba(16,40,90,.4)}

.help{display:inline-flex;align-items:center;gap:10px;margin-top:52px;border-radius:6px;color:var(--blue-ink);font-size:1.15rem;font-weight:500;text-decoration:underline;text-underline-offset:4px;text-decoration-thickness:1px}
.help svg{width:24px;height:24px;flex:none}
.help:hover{color:var(--blue-hover);text-decoration-thickness:2px}

@media (max-width:640px){
  .top{padding-top:18px}
  .top img{height:34px}
  .lead{max-width:30rem}
  .actions{flex-direction:column;align-items:stretch;width:100%;max-width:420px;gap:14px;margin-top:32px}
  .btn{width:100%;min-width:0;height:56px;padding:0 20px;font-size:1.05rem}
  .help{margin-top:36px;font-size:1.05rem}
}
@media (prefers-reduced-motion:reduce){.btn{transition:none}.btn:hover{transform:none}}

/* Hebrew: Inter has no Hebrew glyphs, and negative tracking hurts Hebrew text */
html[lang="he"] body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans Hebrew",sans-serif}
html[lang="he"] h1{letter-spacing:0}
</style>
</head>
<body>
<header class="top">
  <a href="<?php echo $s['home']; ?>" aria-label="<?php echo $s['home_label']; ?>">
    <img src="https://cdn.upress.cloud/404/assets/upress-logo.png" width="120" height="42" alt="uPress">
  </a>
</header>

<main>
  <div class="scene">
    <img src="https://cdn.upress.cloud/404/assets/scene.webp?v=2" width="1802" height="462" alt="" fetchpriority="high" decoding="async">
  </div>

  <h1><?php echo $s['heading']; ?></h1>
  <p class="lead"><?php echo $s['lead']; ?></p>

  <div class="actions">
    <a class="btn btn-primary" href="<?php echo $s['home']; ?>">
      <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M11.29 3.29a1 1 0 0 1 1.42 0l8.5 8.5A1 1 0 0 1 20.5 13.5H19V20a1 1 0 0 1-1 1h-3.5v-5.5h-5V21H6a1 1 0 0 1-1-1v-6.5H3.5a1 1 0 0 1-.71-1.71z"/></svg>
      <?php echo $s['go']; ?>
    </a>
    <a class="btn btn-secondary" href="<?php echo $s['guide_url']; ?>">
      <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 7v14"/><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"/></svg>
      <?php echo $s['guide']; ?>
    </a>
  </div>

  <a class="help" href="<?php echo $s['support']; ?>">
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z"/><path d="M21 16v2a4 4 0 0 1-4 4h-5"/></svg>
    <?php echo $s['help']; ?>
  </a>
</main>
</body>
</html>
